2015-06-27 04:29:10 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s
|
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
|
|
|
|
|
|
|
|
; GCN-LABEL: {{^}}main:
|
|
|
|
; SI: v_lshl_b32_e32 v{{[0-9]+}}, 1, v{{[0-9]+}}
|
|
|
|
; VI: v_lshlrev_b32_e64 v{{[0-9]+}}, v{{[0-9]+}}, 1
|
2016-05-18 23:48:44 +08:00
|
|
|
define amdgpu_ps void @main(float %arg0, float %arg1) #0 {
|
2016-01-26 12:38:08 +08:00
|
|
|
bb:
|
2016-05-18 23:48:44 +08:00
|
|
|
%tmp = fptosi float %arg0 to i32
|
2016-01-26 12:38:08 +08:00
|
|
|
%tmp1 = call <4 x float> @llvm.SI.image.load.v4i32(<4 x i32> undef, <8 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
|
|
|
|
%tmp2.f = extractelement <4 x float> %tmp1, i32 0
|
|
|
|
%tmp2 = bitcast float %tmp2.f to i32
|
|
|
|
%tmp3 = and i32 %tmp, 7
|
|
|
|
%tmp4 = shl i32 1, %tmp3
|
|
|
|
%tmp5 = and i32 %tmp2, %tmp4
|
|
|
|
%tmp6 = icmp eq i32 %tmp5, 0
|
2016-05-18 23:48:44 +08:00
|
|
|
%tmp7 = select i1 %tmp6, float 0.000000e+00, float %arg1
|
2016-01-26 12:38:08 +08:00
|
|
|
%tmp8 = call i32 @llvm.SI.packf16(float undef, float %tmp7)
|
|
|
|
%tmp9 = bitcast i32 %tmp8 to float
|
|
|
|
call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float undef, float %tmp9, float undef, float %tmp9)
|
2015-06-27 04:29:10 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-01-26 12:38:08 +08:00
|
|
|
declare <4 x float> @llvm.SI.image.load.v4i32(<4 x i32>, <8 x i32>, i32, i32, i32, i32, i32, i32, i32, i32) #1
|
2015-06-27 04:29:10 +08:00
|
|
|
declare i32 @llvm.SI.packf16(float, float) #1
|
|
|
|
declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
|
|
|
|
|
2016-07-12 07:35:48 +08:00
|
|
|
attributes #0 = { nounwind }
|
2015-06-27 04:29:10 +08:00
|
|
|
attributes #1 = { nounwind readnone }
|