1; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s
2
3; CHECK: {{^}}main1:
4; CHECK: MOV * T{{[0-9]+\.[XYZW], KC0}}
5define amdgpu_kernel void @main1() #0 {
6main_body:
7  %tmp = load <4 x float>, <4 x float> addrspace(8)* null
8  %tmp7 = extractelement <4 x float> %tmp, i32 0
9  %tmp8 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
10  %tmp9 = extractelement <4 x float> %tmp8, i32 0
11  %tmp10 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
12  %tmp11 = extractelement <4 x float> %tmp10, i32 0
13  %tmp12 = fcmp ogt float %tmp7, 0.000000e+00
14  %tmp13 = select i1 %tmp12, float %tmp9, float %tmp11
15  %tmp14 = load <4 x float>, <4 x float> addrspace(8)* null
16  %tmp15 = extractelement <4 x float> %tmp14, i32 1
17  %tmp16 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
18  %tmp17 = extractelement <4 x float> %tmp16, i32 1
19  %tmp18 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
20  %tmp19 = extractelement <4 x float> %tmp18, i32 1
21  %tmp20 = fcmp ogt float %tmp15, 0.000000e+00
22  %tmp21 = select i1 %tmp20, float %tmp17, float %tmp19
23  %tmp22 = load <4 x float>, <4 x float> addrspace(8)* null
24  %tmp23 = extractelement <4 x float> %tmp22, i32 2
25  %tmp24 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
26  %tmp25 = extractelement <4 x float> %tmp24, i32 2
27  %tmp26 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
28  %tmp27 = extractelement <4 x float> %tmp26, i32 2
29  %tmp28 = fcmp ogt float %tmp23, 0.000000e+00
30  %tmp29 = select i1 %tmp28, float %tmp25, float %tmp27
31  %tmp30 = load <4 x float>, <4 x float> addrspace(8)* null
32  %tmp31 = extractelement <4 x float> %tmp30, i32 3
33  %tmp32 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
34  %tmp33 = extractelement <4 x float> %tmp32, i32 3
35  %tmp34 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
36  %tmp35 = extractelement <4 x float> %tmp34, i32 3
37  %tmp36 = fcmp ogt float %tmp31, 0.000000e+00
38  %tmp37 = select i1 %tmp36, float %tmp33, float %tmp35
39  %max.0.i = call float @llvm.maxnum.f32(float %tmp13, float 0.000000e+00)
40  %clamp.i = call float @llvm.minnum.f32(float %max.0.i, float 1.000000e+00)
41  %max.0.i5 = call float @llvm.maxnum.f32(float %tmp21, float 0.000000e+00)
42  %clamp.i6 = call float @llvm.minnum.f32(float %max.0.i5, float 1.000000e+00)
43  %max.0.i3 = call float @llvm.maxnum.f32(float %tmp29, float 0.000000e+00)
44  %clamp.i4 = call float @llvm.minnum.f32(float %max.0.i3, float 1.000000e+00)
45  %max.0.i1 = call float @llvm.maxnum.f32(float %tmp37, float 0.000000e+00)
46  %clamp.i2 = call float @llvm.minnum.f32(float %max.0.i1, float 1.000000e+00)
47  %tmp38 = insertelement <4 x float> undef, float %clamp.i, i32 0
48  %tmp39 = insertelement <4 x float> %tmp38, float %clamp.i6, i32 1
49  %tmp40 = insertelement <4 x float> %tmp39, float %clamp.i4, i32 2
50  %tmp41 = insertelement <4 x float> %tmp40, float %clamp.i2, i32 3
51  call void @llvm.r600.store.swizzle(<4 x float> %tmp41, i32 0, i32 0)
52  ret void
53}
54
55; CHECK: {{^}}main2:
56; CHECK-NOT: MOV
57define amdgpu_kernel void @main2() #0 {
58main_body:
59  %tmp = load <4 x float>, <4 x float> addrspace(8)* null
60  %tmp7 = extractelement <4 x float> %tmp, i32 0
61  %tmp8 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
62  %tmp9 = extractelement <4 x float> %tmp8, i32 0
63  %tmp10 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
64  %tmp11 = extractelement <4 x float> %tmp10, i32 1
65  %tmp12 = fcmp ogt float %tmp7, 0.000000e+00
66  %tmp13 = select i1 %tmp12, float %tmp9, float %tmp11
67  %tmp14 = load <4 x float>, <4 x float> addrspace(8)* null
68  %tmp15 = extractelement <4 x float> %tmp14, i32 1
69  %tmp16 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
70  %tmp17 = extractelement <4 x float> %tmp16, i32 0
71  %tmp18 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
72  %tmp19 = extractelement <4 x float> %tmp18, i32 1
73  %tmp20 = fcmp ogt float %tmp15, 0.000000e+00
74  %tmp21 = select i1 %tmp20, float %tmp17, float %tmp19
75  %tmp22 = load <4 x float>, <4 x float> addrspace(8)* null
76  %tmp23 = extractelement <4 x float> %tmp22, i32 2
77  %tmp24 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
78  %tmp25 = extractelement <4 x float> %tmp24, i32 3
79  %tmp26 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
80  %tmp27 = extractelement <4 x float> %tmp26, i32 2
81  %tmp28 = fcmp ogt float %tmp23, 0.000000e+00
82  %tmp29 = select i1 %tmp28, float %tmp25, float %tmp27
83  %tmp30 = load <4 x float>, <4 x float> addrspace(8)* null
84  %tmp31 = extractelement <4 x float> %tmp30, i32 3
85  %tmp32 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
86  %tmp33 = extractelement <4 x float> %tmp32, i32 3
87  %tmp34 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
88  %tmp35 = extractelement <4 x float> %tmp34, i32 2
89  %tmp36 = fcmp ogt float %tmp31, 0.000000e+00
90  %tmp37 = select i1 %tmp36, float %tmp33, float %tmp35
91  %max.0.i = call float @llvm.maxnum.f32(float %tmp13, float 0.000000e+00)
92  %clamp.i = call float @llvm.minnum.f32(float %max.0.i, float 1.000000e+00)
93  %max.0.i5 = call float @llvm.maxnum.f32(float %tmp21, float 0.000000e+00)
94  %clamp.i6 = call float @llvm.minnum.f32(float %max.0.i5, float 1.000000e+00)
95  %max.0.i3 = call float @llvm.maxnum.f32(float %tmp29, float 0.000000e+00)
96  %clamp.i4 = call float @llvm.minnum.f32(float %max.0.i3, float 1.000000e+00)
97  %max.0.i1 = call float @llvm.maxnum.f32(float %tmp37, float 0.000000e+00)
98  %clamp.i2 = call float @llvm.minnum.f32(float %max.0.i1, float 1.000000e+00)
99  %tmp38 = insertelement <4 x float> undef, float %clamp.i, i32 0
100  %tmp39 = insertelement <4 x float> %tmp38, float %clamp.i6, i32 1
101  %tmp40 = insertelement <4 x float> %tmp39, float %clamp.i4, i32 2
102  %tmp41 = insertelement <4 x float> %tmp40, float %clamp.i2, i32 3
103  call void @llvm.r600.store.swizzle(<4 x float> %tmp41, i32 0, i32 0)
104  ret void
105}
106
107declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32) #0
108declare float @llvm.minnum.f32(float, float) #1
109declare float @llvm.maxnum.f32(float, float) #1
110
111attributes #0 = { nounwind }
112attributes #1 = { nounwind readnone }
113