2012-12-11 21:25:42 +00:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
|
|
|
|
|
|
|
|
; Test using an integer literal constant.
|
|
|
|
; Generated ASM should be:
|
2013-07-23 01:48:18 +00:00
|
|
|
; ADD_INT KC0[2].Z literal.x, 5
|
2012-12-11 21:25:42 +00:00
|
|
|
; or
|
2013-07-23 01:48:18 +00:00
|
|
|
; ADD_INT literal.x KC0[2].Z, 5
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2013-03-09 18:25:40 +00:00
|
|
|
; CHECK: @i32_literal
|
2013-09-04 19:53:46 +00:00
|
|
|
; CHECK: ADD_INT {{\** *}}T{{[0-9]\.[XYZW]}}, KC0[2].Z, literal.x
|
|
|
|
; CHECK-NEXT: LSHR
|
2013-05-02 21:52:30 +00:00
|
|
|
; CHECK-NEXT: 5
|
2012-12-11 21:25:42 +00:00
|
|
|
define void @i32_literal(i32 addrspace(1)* %out, i32 %in) {
|
|
|
|
entry:
|
|
|
|
%0 = add i32 5, %in
|
|
|
|
store i32 %0, i32 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test using a float literal constant.
|
|
|
|
; Generated ASM should be:
|
2013-07-23 01:48:18 +00:00
|
|
|
; ADD KC0[2].Z literal.x, 5.0
|
2012-12-11 21:25:42 +00:00
|
|
|
; or
|
2013-07-23 01:48:18 +00:00
|
|
|
; ADD literal.x KC0[2].Z, 5.0
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2013-02-05 17:09:11 +00:00
|
|
|
; CHECK: @float_literal
|
2013-09-04 19:53:46 +00:00
|
|
|
; CHECK: ADD {{\** *}}T{{[0-9]\.[XYZW]}}, KC0[2].Z, literal.x
|
|
|
|
; CHECK-NEXT: LSHR
|
2013-05-02 21:52:30 +00:00
|
|
|
; CHECK-NEXT: 1084227584(5.0
|
2012-12-11 21:25:42 +00:00
|
|
|
define void @float_literal(float addrspace(1)* %out, float %in) {
|
|
|
|
entry:
|
|
|
|
%0 = fadd float 5.0, %in
|
|
|
|
store float %0, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2013-08-16 01:11:55 +00:00
|
|
|
|
|
|
|
; Make sure inline literals are folded into REG_SEQUENCE instructions.
|
|
|
|
; CHECK: @inline_literal_reg_sequence
|
2013-09-04 19:53:46 +00:00
|
|
|
; CHECK: MOV {{\** *}}T[[GPR:[0-9]]].X, 0.0
|
|
|
|
; CHECK-NEXT: MOV {{\** *}}T[[GPR]].Y, 0.0
|
|
|
|
; CHECK-NEXT: MOV {{\** *}}T[[GPR]].Z, 0.0
|
|
|
|
; CHECK-NEXT: MOV {{\** *}}T[[GPR]].W, 0.0
|
2013-08-16 01:11:55 +00:00
|
|
|
|
|
|
|
define void @inline_literal_reg_sequence(<4 x i32> addrspace(1)* %out) {
|
|
|
|
entry:
|
|
|
|
store <4 x i32> <i32 0, i32 0, i32 0, i32 0>, <4 x i32> addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
2013-09-12 23:44:53 +00:00
|
|
|
|
|
|
|
; CHECK: @inline_literal_dot4
|
|
|
|
; CHECK: DOT4 T[[GPR:[0-9]]].X, 1.0
|
|
|
|
; CHECK-NEXT: DOT4 T[[GPR]].Y (MASKED), 1.0
|
|
|
|
; CHECK-NEXT: DOT4 T[[GPR]].Z (MASKED), 1.0
|
|
|
|
; CHECK-NEXT: DOT4 * T[[GPR]].W (MASKED), 1.0
|
|
|
|
define void @inline_literal_dot4(float addrspace(1)* %out) {
|
|
|
|
entry:
|
|
|
|
%0 = call float @llvm.AMDGPU.dp4(<4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>)
|
|
|
|
store float %0, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare float @llvm.AMDGPU.dp4(<4 x float>, <4 x float>) #1
|
|
|
|
|
|
|
|
attributes #1 = { readnone }
|