1 ; RUN: llc < %s -march=r600 | FileCheck %s
3 ;CHECK: DOT4 * T{{[0-9]\.W}} (MASKED)
4 ;CHECK: CNDGE T{{[0-9].[XYZW]}}, PV.X
6 define void @main() #0 {
8 %0 = call float @llvm.R600.load.input(i32 4)
9 %1 = call float @llvm.R600.load.input(i32 5)
10 %2 = call float @llvm.R600.load.input(i32 6)
11 %3 = call float @llvm.R600.load.input(i32 7)
12 %4 = call float @llvm.R600.load.input(i32 8)
13 %5 = call float @llvm.R600.load.input(i32 9)
14 %6 = call float @llvm.R600.load.input(i32 10)
15 %7 = call float @llvm.R600.load.input(i32 11)
16 %8 = call float @llvm.R600.load.input(i32 12)
17 %9 = call float @llvm.R600.load.input(i32 13)
18 %10 = call float @llvm.R600.load.input(i32 14)
19 %11 = call float @llvm.R600.load.input(i32 15)
20 %12 = call float @llvm.R600.load.input(i32 16)
21 %13 = call float @llvm.R600.load.input(i32 17)
22 %14 = call float @llvm.R600.load.input(i32 18)
23 %15 = call float @llvm.R600.load.input(i32 19)
24 %16 = call float @llvm.R600.load.input(i32 20)
25 %17 = call float @llvm.R600.load.input(i32 21)
26 %18 = call float @llvm.R600.load.input(i32 22)
27 %19 = call float @llvm.R600.load.input(i32 23)
28 %20 = call float @llvm.R600.load.input(i32 24)
29 %21 = call float @llvm.R600.load.input(i32 25)
30 %22 = call float @llvm.R600.load.input(i32 26)
31 %23 = call float @llvm.R600.load.input(i32 27)
32 %24 = call float @llvm.R600.load.input(i32 28)
33 %25 = call float @llvm.R600.load.input(i32 29)
34 %26 = call float @llvm.R600.load.input(i32 30)
35 %27 = call float @llvm.R600.load.input(i32 31)
36 %28 = load <4 x float> addrspace(8)* null
37 %29 = extractelement <4 x float> %28, i32 0
38 %30 = fmul float %0, %29
39 %31 = load <4 x float> addrspace(8)* null
40 %32 = extractelement <4 x float> %31, i32 1
41 %33 = fmul float %0, %32
42 %34 = load <4 x float> addrspace(8)* null
43 %35 = extractelement <4 x float> %34, i32 2
44 %36 = fmul float %0, %35
45 %37 = load <4 x float> addrspace(8)* null
46 %38 = extractelement <4 x float> %37, i32 3
47 %39 = fmul float %0, %38
48 %40 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
49 %41 = extractelement <4 x float> %40, i32 0
50 %42 = fmul float %1, %41
51 %43 = fadd float %42, %30
52 %44 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
53 %45 = extractelement <4 x float> %44, i32 1
54 %46 = fmul float %1, %45
55 %47 = fadd float %46, %33
56 %48 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
57 %49 = extractelement <4 x float> %48, i32 2
58 %50 = fmul float %1, %49
59 %51 = fadd float %50, %36
60 %52 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 1)
61 %53 = extractelement <4 x float> %52, i32 3
62 %54 = fmul float %1, %53
63 %55 = fadd float %54, %39
64 %56 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
65 %57 = extractelement <4 x float> %56, i32 0
66 %58 = fmul float %2, %57
67 %59 = fadd float %58, %43
68 %60 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
69 %61 = extractelement <4 x float> %60, i32 1
70 %62 = fmul float %2, %61
71 %63 = fadd float %62, %47
72 %64 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
73 %65 = extractelement <4 x float> %64, i32 2
74 %66 = fmul float %2, %65
75 %67 = fadd float %66, %51
76 %68 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 2)
77 %69 = extractelement <4 x float> %68, i32 3
78 %70 = fmul float %2, %69
79 %71 = fadd float %70, %55
80 %72 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 3)
81 %73 = extractelement <4 x float> %72, i32 0
82 %74 = fmul float %3, %73
83 %75 = fadd float %74, %59
84 %76 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 3)
85 %77 = extractelement <4 x float> %76, i32 1
86 %78 = fmul float %3, %77
87 %79 = fadd float %78, %63
88 %80 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 3)
89 %81 = extractelement <4 x float> %80, i32 2
90 %82 = fmul float %3, %81
91 %83 = fadd float %82, %67
92 %84 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 3)
93 %85 = extractelement <4 x float> %84, i32 3
94 %86 = fmul float %3, %85
95 %87 = fadd float %86, %71
96 %88 = insertelement <4 x float> undef, float %4, i32 0
97 %89 = insertelement <4 x float> %88, float %5, i32 1
98 %90 = insertelement <4 x float> %89, float %6, i32 2
99 %91 = insertelement <4 x float> %90, float 0.000000e+00, i32 3
100 %92 = insertelement <4 x float> undef, float %4, i32 0
101 %93 = insertelement <4 x float> %92, float %5, i32 1
102 %94 = insertelement <4 x float> %93, float %6, i32 2
103 %95 = insertelement <4 x float> %94, float 0.000000e+00, i32 3
104 %96 = call float @llvm.AMDGPU.dp4(<4 x float> %91, <4 x float> %95)
105 %97 = call float @fabs(float %96)
106 %98 = call float @llvm.AMDGPU.rsq(float %97)
107 %99 = fmul float %4, %98
108 %100 = fmul float %5, %98
109 %101 = fmul float %6, %98
110 %102 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 4)
111 %103 = extractelement <4 x float> %102, i32 0
112 %104 = fmul float %103, %8
113 %105 = fadd float %104, %20
114 %106 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 4)
115 %107 = extractelement <4 x float> %106, i32 1
116 %108 = fmul float %107, %9
117 %109 = fadd float %108, %21
118 %110 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 4)
119 %111 = extractelement <4 x float> %110, i32 2
120 %112 = fmul float %111, %10
121 %113 = fadd float %112, %22
122 %114 = call float @llvm.AMDIL.clamp.(float %105, float 0.000000e+00, float 1.000000e+00)
123 %115 = call float @llvm.AMDIL.clamp.(float %109, float 0.000000e+00, float 1.000000e+00)
124 %116 = call float @llvm.AMDIL.clamp.(float %113, float 0.000000e+00, float 1.000000e+00)
125 %117 = call float @llvm.AMDIL.clamp.(float %15, float 0.000000e+00, float 1.000000e+00)
126 %118 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 5)
127 %119 = extractelement <4 x float> %118, i32 0
128 %120 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 5)
129 %121 = extractelement <4 x float> %120, i32 1
130 %122 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 5)
131 %123 = extractelement <4 x float> %122, i32 2
132 %124 = insertelement <4 x float> undef, float %99, i32 0
133 %125 = insertelement <4 x float> %124, float %100, i32 1
134 %126 = insertelement <4 x float> %125, float %101, i32 2
135 %127 = insertelement <4 x float> %126, float 0.000000e+00, i32 3
136 %128 = insertelement <4 x float> undef, float %119, i32 0
137 %129 = insertelement <4 x float> %128, float %121, i32 1
138 %130 = insertelement <4 x float> %129, float %123, i32 2
139 %131 = insertelement <4 x float> %130, float 0.000000e+00, i32 3
140 %132 = call float @llvm.AMDGPU.dp4(<4 x float> %127, <4 x float> %131)
141 %133 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 7)
142 %134 = extractelement <4 x float> %133, i32 0
143 %135 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 7)
144 %136 = extractelement <4 x float> %135, i32 1
145 %137 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 7)
146 %138 = extractelement <4 x float> %137, i32 2
147 %139 = insertelement <4 x float> undef, float %99, i32 0
148 %140 = insertelement <4 x float> %139, float %100, i32 1
149 %141 = insertelement <4 x float> %140, float %101, i32 2
150 %142 = insertelement <4 x float> %141, float 0.000000e+00, i32 3
151 %143 = insertelement <4 x float> undef, float %134, i32 0
152 %144 = insertelement <4 x float> %143, float %136, i32 1
153 %145 = insertelement <4 x float> %144, float %138, i32 2
154 %146 = insertelement <4 x float> %145, float 0.000000e+00, i32 3
155 %147 = call float @llvm.AMDGPU.dp4(<4 x float> %142, <4 x float> %146)
156 %148 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 8)
157 %149 = extractelement <4 x float> %148, i32 0
158 %150 = fmul float %149, %8
159 %151 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 8)
160 %152 = extractelement <4 x float> %151, i32 1
161 %153 = fmul float %152, %9
162 %154 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 8)
163 %155 = extractelement <4 x float> %154, i32 2
164 %156 = fmul float %155, %10
165 %157 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
166 %158 = extractelement <4 x float> %157, i32 0
167 %159 = fmul float %158, %12
168 %160 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
169 %161 = extractelement <4 x float> %160, i32 1
170 %162 = fmul float %161, %13
171 %163 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
172 %164 = extractelement <4 x float> %163, i32 2
173 %165 = fmul float %164, %14
174 %166 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 10)
175 %167 = extractelement <4 x float> %166, i32 0
176 %168 = fmul float %167, %16
177 %169 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 10)
178 %170 = extractelement <4 x float> %169, i32 1
179 %171 = fmul float %170, %17
180 %172 = load <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>] addrspace(8)* null, i64 0, i32 10)
181 %173 = extractelement <4 x float> %172, i32 2
182 %174 = fmul float %173, %18
183 %175 = fcmp uge float %132, 0.000000e+00
184 %176 = select i1 %175, float %132, float 0.000000e+00
185 %177 = fcmp uge float %147, 0.000000e+00
186 %178 = select i1 %177, float %147, float 0.000000e+00
187 %179 = call float @llvm.pow.f32(float %178, float %24)
188 %180 = fcmp ult float %132, 0.000000e+00
189 %181 = select i1 %180, float 0.000000e+00, float %179
190 %182 = fadd float %150, %105
191 %183 = fadd float %153, %109
192 %184 = fadd float %156, %113
193 %185 = fmul float %176, %159
194 %186 = fadd float %185, %182
195 %187 = fmul float %176, %162
196 %188 = fadd float %187, %183
197 %189 = fmul float %176, %165
198 %190 = fadd float %189, %184
199 %191 = fmul float %181, %168
200 %192 = fadd float %191, %186
201 %193 = fmul float %181, %171
202 %194 = fadd float %193, %188
203 %195 = fmul float %181, %174
204 %196 = fadd float %195, %190
205 %197 = call float @llvm.AMDIL.clamp.(float %192, float 0.000000e+00, float 1.000000e+00)
206 %198 = call float @llvm.AMDIL.clamp.(float %194, float 0.000000e+00, float 1.000000e+00)
207 %199 = call float @llvm.AMDIL.clamp.(float %196, float 0.000000e+00, float 1.000000e+00)
208 %200 = insertelement <4 x float> undef, float %75, i32 0
209 %201 = insertelement <4 x float> %200, float %79, i32 1
210 %202 = insertelement <4 x float> %201, float %83, i32 2
211 %203 = insertelement <4 x float> %202, float %87, i32 3
212 call void @llvm.R600.store.swizzle(<4 x float> %203, i32 60, i32 1)
213 %204 = insertelement <4 x float> undef, float %197, i32 0
214 %205 = insertelement <4 x float> %204, float %198, i32 1
215 %206 = insertelement <4 x float> %205, float %199, i32 2
216 %207 = insertelement <4 x float> %206, float %117, i32 3
217 call void @llvm.R600.store.swizzle(<4 x float> %207, i32 0, i32 2)
221 ; Function Attrs: readnone
222 declare float @llvm.R600.load.input(i32) #1
224 ; Function Attrs: readnone
225 declare float @llvm.AMDGPU.dp4(<4 x float>, <4 x float>) #1
227 ; Function Attrs: readonly
228 declare float @fabs(float) #2
230 ; Function Attrs: readnone
231 declare float @llvm.AMDGPU.rsq(float) #1
233 ; Function Attrs: readnone
234 declare float @llvm.AMDIL.clamp.(float, float, float) #1
236 ; Function Attrs: nounwind readonly
237 declare float @llvm.pow.f32(float, float) #3
239 declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)
241 attributes #0 = { "ShaderType"="1" }
242 attributes #1 = { readnone }
243 attributes #2 = { readonly }
244 attributes #3 = { nounwind readonly }