[x32] Fix FrameIndex check in SelectLEA64_32Addr
[oota-llvm.git] / test / CodeGen / R600 / vop-shrink.ll
1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2
3 ; Test that we correctly commute a sub instruction
4 ; FUNC-LABEL: @sub_rev
5 ; SI-NOT: V_SUB_I32_e32 v{{[0-9]+}}, s
6 ; SI: V_SUBREV_I32_e32 v{{[0-9]+}}, s
7
8 ; ModuleID = 'vop-shrink.ll'
9
10 define void @sub_rev(i32 addrspace(1)* %out, <4 x i32> %sgpr, i32 %cond) {
11 entry:
12   %vgpr = call i32 @llvm.r600.read.tidig.x() #1
13   %tmp = icmp eq i32 %cond, 0
14   br i1 %tmp, label %if, label %else
15
16 if:                                               ; preds = %entry
17   %tmp1 = getelementptr i32 addrspace(1)* %out, i32 1
18   %tmp2 = extractelement <4 x i32> %sgpr, i32 1
19   store i32 %tmp2, i32 addrspace(1)* %out
20   br label %endif
21
22 else:                                             ; preds = %entry
23   %tmp3 = extractelement <4 x i32> %sgpr, i32 2
24   %tmp4 = sub i32 %vgpr, %tmp3
25   store i32 %tmp4, i32 addrspace(1)* %out
26   br label %endif
27
28 endif:                                            ; preds = %else, %if
29   ret void
30 }
31
32 ; Test that we fold an immediate that was illegal for a 64-bit op into the
33 ; 32-bit op when we shrink it.
34
35 ; FUNC-LABEL: @add_fold
36 ; SI: V_ADD_F32_e32 v{{[0-9]+}}, 0x44800000
37 define void @add_fold(float addrspace(1)* %out) {
38 entry:
39   %tmp = call i32 @llvm.r600.read.tidig.x()
40   %tmp1 = uitofp i32 %tmp to float
41   %tmp2 = fadd float %tmp1, 1.024000e+03
42   store float %tmp2, float addrspace(1)* %out
43   ret void
44 }
45
46 ; Function Attrs: nounwind readnone
47 declare i32 @llvm.r600.read.tidig.x() #0
48
49 attributes #0 = { nounwind readnone }
50 attributes #1 = { readnone }