1; RUN: llc -march=r600 < %s | FileCheck %s
2
3; CHECK: DOT4 * T{{[0-9]\.W}} (MASKED)
4; CHECK: MAX T{{[0-9].[XYZW]}}, 0.0, PV.X
5define amdgpu_vs void @main(<4 x float> inreg %reg0, <4 x float> inreg %reg1, <4 x float> inreg %reg2, <4 x float> inreg %reg3, <4 x float> inreg %reg4, <4 x float> inreg %reg5, <4 x float> inreg %reg6, <4 x float> inreg %reg7) {
6main_body:
7  %tmp = extractelement <4 x float> %reg1, i32 0
8  %tmp13 = extractelement <4 x float> %reg1, i32 1
9  %tmp14 = extractelement <4 x float> %reg1, i32 2
10  %tmp15 = extractelement <4 x float> %reg1, i32 3
11  %tmp16 = extractelement <4 x float> %reg2, i32 0
12  %tmp17 = extractelement <4 x float> %reg2, i32 1
13  %tmp18 = extractelement <4 x float> %reg2, i32 2
14  %tmp19 = extractelement <4 x float> %reg2, i32 3
15  %tmp20 = extractelement <4 x float> %reg3, i32 0
16  %tmp21 = extractelement <4 x float> %reg3, i32 1
17  %tmp22 = extractelement <4 x float> %reg3, i32 2
18  %tmp23 = extractelement <4 x float> %reg3, i32 3
19  %tmp24 = extractelement <4 x float> %reg4, i32 0
20  %tmp25 = extractelement <4 x float> %reg4, i32 1
21  %tmp26 = extractelement <4 x float> %reg4, i32 2
22  %tmp27 = extractelement <4 x float> %reg4, i32 3
23  %tmp28 = extractelement <4 x float> %reg5, i32 0
24  %tmp29 = extractelement <4 x float> %reg5, i32 1
25  %tmp30 = extractelement <4 x float> %reg5, i32 2
26  %tmp31 = extractelement <4 x float> %reg5, i32 3
27  %tmp32 = extractelement <4 x float> %reg6, i32 0
28  %tmp33 = extractelement <4 x float> %reg6, i32 1
29  %tmp34 = extractelement <4 x float> %reg6, i32 2
30  %tmp35 = extractelement <4 x float> %reg6, i32 3
31  %tmp36 = extractelement <4 x float> %reg7, i32 0
32  %tmp37 = extractelement <4 x float> %reg7, i32 1
33  %tmp38 = extractelement <4 x float> %reg7, i32 2
34  %tmp39 = extractelement <4 x float> %reg7, i32 3
35  %tmp40 = load <4 x float>, <4 x float> addrspace(8)* null
36  %tmp41 = extractelement <4 x float> %tmp40, i32 0
37  %tmp42 = fmul float %tmp, %tmp41
38  %tmp43 = load <4 x float>, <4 x float> addrspace(8)* null
39  %tmp44 = extractelement <4 x float> %tmp43, i32 1
40  %tmp45 = fmul float %tmp, %tmp44
41  %tmp46 = load <4 x float>, <4 x float> addrspace(8)* null
42  %tmp47 = extractelement <4 x float> %tmp46, i32 2
43  %tmp48 = fmul float %tmp, %tmp47
44  %tmp49 = load <4 x float>, <4 x float> addrspace(8)* null
45  %tmp50 = extractelement <4 x float> %tmp49, i32 3
46  %tmp51 = fmul float %tmp, %tmp50
47  %tmp52 = 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)
48  %tmp53 = extractelement <4 x float> %tmp52, i32 0
49  %tmp54 = fmul float %tmp13, %tmp53
50  %tmp55 = fadd float %tmp54, %tmp42
51  %tmp56 = 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)
52  %tmp57 = extractelement <4 x float> %tmp56, i32 1
53  %tmp58 = fmul float %tmp13, %tmp57
54  %tmp59 = fadd float %tmp58, %tmp45
55  %tmp60 = 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)
56  %tmp61 = extractelement <4 x float> %tmp60, i32 2
57  %tmp62 = fmul float %tmp13, %tmp61
58  %tmp63 = fadd float %tmp62, %tmp48
59  %tmp64 = 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)
60  %tmp65 = extractelement <4 x float> %tmp64, i32 3
61  %tmp66 = fmul float %tmp13, %tmp65
62  %tmp67 = fadd float %tmp66, %tmp51
63  %tmp68 = 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)
64  %tmp69 = extractelement <4 x float> %tmp68, i32 0
65  %tmp70 = fmul float %tmp14, %tmp69
66  %tmp71 = fadd float %tmp70, %tmp55
67  %tmp72 = 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)
68  %tmp73 = extractelement <4 x float> %tmp72, i32 1
69  %tmp74 = fmul float %tmp14, %tmp73
70  %tmp75 = fadd float %tmp74, %tmp59
71  %tmp76 = 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  %tmp77 = extractelement <4 x float> %tmp76, i32 2
73  %tmp78 = fmul float %tmp14, %tmp77
74  %tmp79 = fadd float %tmp78, %tmp63
75  %tmp80 = 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)
76  %tmp81 = extractelement <4 x float> %tmp80, i32 3
77  %tmp82 = fmul float %tmp14, %tmp81
78  %tmp83 = fadd float %tmp82, %tmp67
79  %tmp84 = 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 3)
80  %tmp85 = extractelement <4 x float> %tmp84, i32 0
81  %tmp86 = fmul float %tmp15, %tmp85
82  %tmp87 = fadd float %tmp86, %tmp71
83  %tmp88 = 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 3)
84  %tmp89 = extractelement <4 x float> %tmp88, i32 1
85  %tmp90 = fmul float %tmp15, %tmp89
86  %tmp91 = fadd float %tmp90, %tmp75
87  %tmp92 = 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 3)
88  %tmp93 = extractelement <4 x float> %tmp92, i32 2
89  %tmp94 = fmul float %tmp15, %tmp93
90  %tmp95 = fadd float %tmp94, %tmp79
91  %tmp96 = 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 3)
92  %tmp97 = extractelement <4 x float> %tmp96, i32 3
93  %tmp98 = fmul float %tmp15, %tmp97
94  %tmp99 = fadd float %tmp98, %tmp83
95  %tmp100 = insertelement <4 x float> undef, float %tmp16, i32 0
96  %tmp101 = insertelement <4 x float> %tmp100, float %tmp17, i32 1
97  %tmp102 = insertelement <4 x float> %tmp101, float %tmp18, i32 2
98  %tmp103 = insertelement <4 x float> %tmp102, float 0.000000e+00, i32 3
99  %tmp104 = insertelement <4 x float> undef, float %tmp16, i32 0
100  %tmp105 = insertelement <4 x float> %tmp104, float %tmp17, i32 1
101  %tmp106 = insertelement <4 x float> %tmp105, float %tmp18, i32 2
102  %tmp107 = insertelement <4 x float> %tmp106, float 0.000000e+00, i32 3
103  %tmp108 = call float @llvm.r600.dot4(<4 x float> %tmp103, <4 x float> %tmp107)
104  %tmp109 = call float @llvm.fabs.f32(float %tmp108)
105  %tmp110 = call float @llvm.r600.recipsqrt.clamped.f32(float %tmp109)
106  %tmp111 = fmul float %tmp16, %tmp110
107  %tmp112 = fmul float %tmp17, %tmp110
108  %tmp113 = fmul float %tmp18, %tmp110
109  %tmp114 = 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 4)
110  %tmp115 = extractelement <4 x float> %tmp114, i32 0
111  %tmp116 = fmul float %tmp115, %tmp20
112  %tmp117 = fadd float %tmp116, %tmp32
113  %tmp118 = 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 4)
114  %tmp119 = extractelement <4 x float> %tmp118, i32 1
115  %tmp120 = fmul float %tmp119, %tmp21
116  %tmp121 = fadd float %tmp120, %tmp33
117  %tmp122 = 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 4)
118  %tmp123 = extractelement <4 x float> %tmp122, i32 2
119  %tmp124 = fmul float %tmp123, %tmp22
120  %tmp125 = fadd float %tmp124, %tmp34
121  %max.0.i = call float @llvm.maxnum.f32(float %tmp117, float 0.000000e+00)
122  %clamp.i = call float @llvm.minnum.f32(float %max.0.i, float 1.000000e+00)
123  %max.0.i11 = call float @llvm.maxnum.f32(float %tmp121, float 0.000000e+00)
124  %clamp.i12 = call float @llvm.minnum.f32(float %max.0.i11, float 1.000000e+00)
125  %max.0.i9 = call float @llvm.maxnum.f32(float %tmp125, float 0.000000e+00)
126  %clamp.i10 = call float @llvm.minnum.f32(float %max.0.i9, float 1.000000e+00)
127  %max.0.i7 = call float @llvm.maxnum.f32(float %tmp27, float 0.000000e+00)
128  %clamp.i8 = call float @llvm.minnum.f32(float %max.0.i7, float 1.000000e+00)
129  %tmp126 = 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 5)
130  %tmp127 = extractelement <4 x float> %tmp126, i32 0
131  %tmp128 = 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 5)
132  %tmp129 = extractelement <4 x float> %tmp128, i32 1
133  %tmp130 = 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 5)
134  %tmp131 = extractelement <4 x float> %tmp130, i32 2
135  %tmp132 = insertelement <4 x float> undef, float %tmp111, i32 0
136  %tmp133 = insertelement <4 x float> %tmp132, float %tmp112, i32 1
137  %tmp134 = insertelement <4 x float> %tmp133, float %tmp113, i32 2
138  %tmp135 = insertelement <4 x float> %tmp134, float 0.000000e+00, i32 3
139  %tmp136 = insertelement <4 x float> undef, float %tmp127, i32 0
140  %tmp137 = insertelement <4 x float> %tmp136, float %tmp129, i32 1
141  %tmp138 = insertelement <4 x float> %tmp137, float %tmp131, i32 2
142  %tmp139 = insertelement <4 x float> %tmp138, float 0.000000e+00, i32 3
143  %tmp140 = call float @llvm.r600.dot4(<4 x float> %tmp135, <4 x float> %tmp139)
144  %tmp141 = 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 7)
145  %tmp142 = extractelement <4 x float> %tmp141, i32 0
146  %tmp143 = 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 7)
147  %tmp144 = extractelement <4 x float> %tmp143, i32 1
148  %tmp145 = 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 7)
149  %tmp146 = extractelement <4 x float> %tmp145, i32 2
150  %tmp147 = insertelement <4 x float> undef, float %tmp111, i32 0
151  %tmp148 = insertelement <4 x float> %tmp147, float %tmp112, i32 1
152  %tmp149 = insertelement <4 x float> %tmp148, float %tmp113, i32 2
153  %tmp150 = insertelement <4 x float> %tmp149, float 0.000000e+00, i32 3
154  %tmp151 = insertelement <4 x float> undef, float %tmp142, i32 0
155  %tmp152 = insertelement <4 x float> %tmp151, float %tmp144, i32 1
156  %tmp153 = insertelement <4 x float> %tmp152, float %tmp146, i32 2
157  %tmp154 = insertelement <4 x float> %tmp153, float 0.000000e+00, i32 3
158  %tmp155 = call float @llvm.r600.dot4(<4 x float> %tmp150, <4 x float> %tmp154)
159  %tmp156 = 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 8)
160  %tmp157 = extractelement <4 x float> %tmp156, i32 0
161  %tmp158 = fmul float %tmp157, %tmp20
162  %tmp159 = 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 8)
163  %tmp160 = extractelement <4 x float> %tmp159, i32 1
164  %tmp161 = fmul float %tmp160, %tmp21
165  %tmp162 = 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 8)
166  %tmp163 = extractelement <4 x float> %tmp162, i32 2
167  %tmp164 = fmul float %tmp163, %tmp22
168  %tmp165 = 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 9)
169  %tmp166 = extractelement <4 x float> %tmp165, i32 0
170  %tmp167 = fmul float %tmp166, %tmp24
171  %tmp168 = 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 9)
172  %tmp169 = extractelement <4 x float> %tmp168, i32 1
173  %tmp170 = fmul float %tmp169, %tmp25
174  %tmp171 = 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 9)
175  %tmp172 = extractelement <4 x float> %tmp171, i32 2
176  %tmp173 = fmul float %tmp172, %tmp26
177  %tmp174 = 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 10)
178  %tmp175 = extractelement <4 x float> %tmp174, i32 0
179  %tmp176 = fmul float %tmp175, %tmp28
180  %tmp177 = 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 10)
181  %tmp178 = extractelement <4 x float> %tmp177, i32 1
182  %tmp179 = fmul float %tmp178, %tmp29
183  %tmp180 = 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 10)
184  %tmp181 = extractelement <4 x float> %tmp180, i32 2
185  %tmp182 = fmul float %tmp181, %tmp30
186  %tmp183 = fcmp uge float %tmp140, 0.000000e+00
187  %tmp184 = select i1 %tmp183, float %tmp140, float 0.000000e+00
188  %tmp185 = fcmp uge float %tmp155, 0.000000e+00
189  %tmp186 = select i1 %tmp185, float %tmp155, float 0.000000e+00
190  %tmp187 = call float @llvm.pow.f32(float %tmp186, float %tmp36)
191  %tmp188 = fcmp ult float %tmp140, 0.000000e+00
192  %tmp189 = select i1 %tmp188, float 0.000000e+00, float %tmp187
193  %tmp190 = fadd float %tmp158, %tmp117
194  %tmp191 = fadd float %tmp161, %tmp121
195  %tmp192 = fadd float %tmp164, %tmp125
196  %tmp193 = fmul float %tmp184, %tmp167
197  %tmp194 = fadd float %tmp193, %tmp190
198  %tmp195 = fmul float %tmp184, %tmp170
199  %tmp196 = fadd float %tmp195, %tmp191
200  %tmp197 = fmul float %tmp184, %tmp173
201  %tmp198 = fadd float %tmp197, %tmp192
202  %tmp199 = fmul float %tmp189, %tmp176
203  %tmp200 = fadd float %tmp199, %tmp194
204  %tmp201 = fmul float %tmp189, %tmp179
205  %tmp202 = fadd float %tmp201, %tmp196
206  %tmp203 = fmul float %tmp189, %tmp182
207  %tmp204 = fadd float %tmp203, %tmp198
208  %max.0.i5 = call float @llvm.maxnum.f32(float %tmp200, float 0.000000e+00)
209  %clamp.i6 = call float @llvm.minnum.f32(float %max.0.i5, float 1.000000e+00)
210  %max.0.i3 = call float @llvm.maxnum.f32(float %tmp202, float 0.000000e+00)
211  %clamp.i4 = call float @llvm.minnum.f32(float %max.0.i3, float 1.000000e+00)
212  %max.0.i1 = call float @llvm.maxnum.f32(float %tmp204, float 0.000000e+00)
213  %clamp.i2 = call float @llvm.minnum.f32(float %max.0.i1, float 1.000000e+00)
214  %tmp205 = insertelement <4 x float> undef, float %tmp87, i32 0
215  %tmp206 = insertelement <4 x float> %tmp205, float %tmp91, i32 1
216  %tmp207 = insertelement <4 x float> %tmp206, float %tmp95, i32 2
217  %tmp208 = insertelement <4 x float> %tmp207, float %tmp99, i32 3
218  call void @llvm.r600.store.swizzle(<4 x float> %tmp208, i32 60, i32 1)
219  %tmp209 = insertelement <4 x float> undef, float %clamp.i6, i32 0
220  %tmp210 = insertelement <4 x float> %tmp209, float %clamp.i4, i32 1
221  %tmp211 = insertelement <4 x float> %tmp210, float %clamp.i2, i32 2
222  %tmp212 = insertelement <4 x float> %tmp211, float %clamp.i8, i32 3
223  call void @llvm.r600.store.swizzle(<4 x float> %tmp212, i32 0, i32 2)
224  ret void
225}
226
227declare float @llvm.minnum.f32(float, float) #0
228declare float @llvm.maxnum.f32(float, float) #0
229declare float @llvm.r600.dot4(<4 x float>, <4 x float>) #0
230declare float @llvm.fabs.f32(float) #0
231declare float @llvm.r600.recipsqrt.clamped.f32(float) #0
232declare float @llvm.pow.f32(float, float) #0
233declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32) #1
234
235attributes #0 = { nounwind readnone }
236attributes #1 = { nounwind }
237