2015-01-07 02:00:21 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
|
2015-01-28 01:27:15 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
|
2014-08-01 08:32:28 +08:00
|
|
|
|
|
|
|
; Test that we correctly commute a sub instruction
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}sub_rev:
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI-NOT: v_sub_i32_e32 v{{[0-9]+}}, s
|
|
|
|
; SI: v_subrev_i32_e32 v{{[0-9]+}}, s
|
2014-08-01 08:32:28 +08:00
|
|
|
|
|
|
|
; ModuleID = 'vop-shrink.ll'
|
|
|
|
|
|
|
|
define void @sub_rev(i32 addrspace(1)* %out, <4 x i32> %sgpr, i32 %cond) {
|
|
|
|
entry:
|
|
|
|
%vgpr = call i32 @llvm.r600.read.tidig.x() #1
|
|
|
|
%tmp = icmp eq i32 %cond, 0
|
|
|
|
br i1 %tmp, label %if, label %else
|
|
|
|
|
|
|
|
if: ; preds = %entry
|
|
|
|
%tmp1 = getelementptr i32 addrspace(1)* %out, i32 1
|
|
|
|
%tmp2 = extractelement <4 x i32> %sgpr, i32 1
|
|
|
|
store i32 %tmp2, i32 addrspace(1)* %out
|
|
|
|
br label %endif
|
|
|
|
|
|
|
|
else: ; preds = %entry
|
|
|
|
%tmp3 = extractelement <4 x i32> %sgpr, i32 2
|
|
|
|
%tmp4 = sub i32 %vgpr, %tmp3
|
|
|
|
store i32 %tmp4, i32 addrspace(1)* %out
|
|
|
|
br label %endif
|
|
|
|
|
|
|
|
endif: ; preds = %else, %if
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:33 +08:00
|
|
|
; Test that we fold an immediate that was illegal for a 64-bit op into the
|
|
|
|
; 32-bit op when we shrink it.
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}add_fold:
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI: v_add_f32_e32 v{{[0-9]+}}, 0x44800000
|
2014-08-01 08:32:33 +08:00
|
|
|
define void @add_fold(float addrspace(1)* %out) {
|
|
|
|
entry:
|
|
|
|
%tmp = call i32 @llvm.r600.read.tidig.x()
|
|
|
|
%tmp1 = uitofp i32 %tmp to float
|
|
|
|
%tmp2 = fadd float %tmp1, 1.024000e+03
|
|
|
|
store float %tmp2, float addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-08-01 08:32:28 +08:00
|
|
|
; Function Attrs: nounwind readnone
|
|
|
|
declare i32 @llvm.r600.read.tidig.x() #0
|
|
|
|
|
|
|
|
attributes #0 = { nounwind readnone }
|
|
|
|
attributes #1 = { readnone }
|