1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
4 target triple = "hexagon"
6 @g0 = external dso_local global <64 x i32>, align 128
7 @g1 = external hidden unnamed_addr constant [110 x i8], align 1
8 @g2 = external hidden unnamed_addr constant [102 x i8], align 1
9 @g3 = external hidden unnamed_addr constant [110 x i8], align 1
11 declare dso_local void @f0() #0
13 declare dso_local void @f1(i8*, ...) #0
15 ; Function Attrs: nounwind readnone
16 declare <32 x i32> @llvm.hexagon.V6.vandqrt.128B(<128 x i1>, i32) #1
18 ; Function Attrs: nounwind readnone
19 declare <128 x i1> @llvm.hexagon.V6.vandvrt.128B(<32 x i32>, i32) #1
21 ; Function Attrs: nounwind readnone
22 declare <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32) #1
24 ; Function Attrs: nounwind readnone
25 declare <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32>, i32, i32 immarg) #1
27 ; Function Attrs: nounwind readnone
28 declare <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32>, <32 x i32>) #1
30 define dso_local void @f2() #0 {
32 ; CHECK: // %bb.0: // %b0
34 ; CHECK-NEXT: r1:0 = combine(#2,##16843009)
35 ; CHECK-NEXT: allocframe(r29,#1536):raw
38 ; CHECK-NEXT: v1 = vsplat(r1)
39 ; CHECK-NEXT: r17:16 = combine(#-1,#1)
40 ; CHECK-NEXT: r29 = and(r29,#-256)
41 ; CHECK-NEXT: memd(r30+#-8) = r17:16
42 ; CHECK-NEXT: } // 8-byte Folded Spill
44 ; CHECK-NEXT: v0 = vsplat(r16)
45 ; CHECK-NEXT: r2 = add(r29,#2048)
46 ; CHECK-NEXT: memd(r30+#-16) = r19:18
47 ; CHECK-NEXT: } // 8-byte Folded Spill
49 ; CHECK-NEXT: q0 = vand(v0,r0)
50 ; CHECK-NEXT: r18 = ##-2147483648
51 ; CHECK-NEXT: vmem(r2+#-7) = v0
52 ; CHECK-NEXT: } // 128-byte Folded Spill
54 ; CHECK-NEXT: v0 = vand(q0,r17)
55 ; CHECK-NEXT: r0 = ##g1
56 ; CHECK-NEXT: memd(r30+#-24) = r21:20
57 ; CHECK-NEXT: } // 8-byte Folded Spill
59 ; CHECK-NEXT: r19 = ##g0+128
60 ; CHECK-NEXT: vmem(r2+#-6) = v0
63 ; CHECK-NEXT: v3:2.h = vadd(v0.ub,v1.ub)
64 ; CHECK-NEXT: r20 = ##g0
65 ; CHECK-NEXT: vmem(r29+#5) = v1
66 ; CHECK-NEXT: } // 128-byte Folded Spill
68 ; CHECK-NEXT: vmem(r29+#6) = v2
69 ; CHECK-NEXT: } // 256-byte Folded Spill
71 ; CHECK-NEXT: v31:30.uw = vrmpy(v3:2.ub,r18.ub,#0)
72 ; CHECK-NEXT: vmem(r29+#7) = v3
73 ; CHECK-NEXT: } // 256-byte Folded Spill
75 ; CHECK-NEXT: vmem(r19+#0) = v31
79 ; CHECK-NEXT: vmem(r20+#0) = v30
82 ; CHECK-NEXT: r0 = add(r29,#2048)
85 ; CHECK-NEXT: v0 = vmem(r0+#-7)
86 ; CHECK-NEXT: } // 128-byte Folded Reload
88 ; CHECK-NEXT: v1:0.h = vadd(v0.ub,v0.ub)
89 ; CHECK-NEXT: r0 = ##g2
90 ; CHECK-NEXT: vmem(r29+#2) = v0.new
91 ; CHECK-NEXT: } // 256-byte Folded Spill
93 ; CHECK-NEXT: vmem(r29+#3) = v1
94 ; CHECK-NEXT: } // 256-byte Folded Spill
96 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r17.ub,#0)
97 ; CHECK-NEXT: vmem(r19+#0) = v1.new
100 ; CHECK-NEXT: call f1
101 ; CHECK-NEXT: vmem(r20+#0) = v0
104 ; CHECK-NEXT: r0 = ##2147483647
105 ; CHECK-NEXT: v0 = vmem(r29+#2)
106 ; CHECK-NEXT: } // 256-byte Folded Reload
108 ; CHECK-NEXT: v1 = vmem(r29+#3)
109 ; CHECK-NEXT: } // 256-byte Folded Reload
111 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r0.ub,#1)
112 ; CHECK-NEXT: r0 = ##g3
113 ; CHECK-NEXT: vmem(r19+#0) = v1.new
116 ; CHECK-NEXT: call f1
117 ; CHECK-NEXT: vmem(r20+#0) = v0
120 ; CHECK-NEXT: v0 = vmem(r29+#6)
121 ; CHECK-NEXT: } // 256-byte Folded Reload
123 ; CHECK-NEXT: v1 = vmem(r29+#7)
124 ; CHECK-NEXT: } // 256-byte Folded Reload
126 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r18.ub,#1)
127 ; CHECK-NEXT: vmem(r19+#0) = v1.new
130 ; CHECK-NEXT: call f0
131 ; CHECK-NEXT: vmem(r20+#0) = v0
134 ; CHECK-NEXT: r0 = #0
135 ; CHECK-NEXT: v0 = vmem(r29+#6)
136 ; CHECK-NEXT: } // 256-byte Folded Reload
138 ; CHECK-NEXT: v1 = vmem(r29+#7)
139 ; CHECK-NEXT: } // 256-byte Folded Reload
141 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r0.ub,#1)
142 ; CHECK-NEXT: vmem(r19+#0) = v1.new
145 ; CHECK-NEXT: call f0
146 ; CHECK-NEXT: vmem(r20+#0) = v0
149 ; CHECK-NEXT: r0 = add(r29,#2048)
150 ; CHECK-NEXT: v1 = vmem(r29+#5)
151 ; CHECK-NEXT: } // 128-byte Folded Reload
153 ; CHECK-NEXT: v0 = vmem(r0+#-7)
154 ; CHECK-NEXT: } // 128-byte Folded Reload
156 ; CHECK-NEXT: v1:0.h = vadd(v0.ub,v1.ub)
159 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r16.ub,#1)
160 ; CHECK-NEXT: r17:16 = memd(r30+#-8)
161 ; CHECK-NEXT: vmem(r19+#0) = v1.new
162 ; CHECK-NEXT: } // 8-byte Folded Reload
164 ; CHECK-NEXT: r19:18 = memd(r30+#-16)
165 ; CHECK-NEXT: vmem(r20+#0) = v0
166 ; CHECK-NEXT: } // 8-byte Folded Reload
168 ; CHECK-NEXT: r21:20 = memd(r30+#-24)
169 ; CHECK-NEXT: r31:30 = dealloc_return(r30):raw
170 ; CHECK-NEXT: } // 8-byte Folded Reload
172 %v0 = alloca <32 x i32>, align 128
173 %v1 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
174 %v2 = call <128 x i1> @llvm.hexagon.V6.vandvrt.128B(<32 x i32> %v1, i32 16843009)
175 %v3 = call <32 x i32> @llvm.hexagon.V6.vandqrt.128B(<128 x i1> %v2, i32 -1)
176 store <32 x i32> %v3, <32 x i32>* %v0, align 128
177 %v4 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
178 %v5 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> undef, <32 x i32> %v4)
179 %v6 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v5, i32 -2147483648, i32 0)
180 store <64 x i32> %v6, <64 x i32>* @g0, align 128
181 call void (i8*, ...) @f1(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @g1, i32 0, i32 0)) #2
182 %v7 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
183 %v8 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> %v7, <32 x i32> undef)
184 %v9 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v8, i32 -1, i32 0)
185 store <64 x i32> %v9, <64 x i32>* @g0, align 128
186 call void (i8*, ...) @f1(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @g2, i32 0, i32 0)) #2
187 %v10 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
188 %v11 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> %v10, <32 x i32> undef)
189 %v12 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v11, i32 2147483647, i32 1)
190 store <64 x i32> %v12, <64 x i32>* @g0, align 128
191 call void (i8*, ...) @f1(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @g3, i32 0, i32 0)) #2
192 %v13 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
193 %v14 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> undef, <32 x i32> %v13)
194 %v15 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v14, i32 -2147483648, i32 1)
195 store <64 x i32> %v15, <64 x i32>* @g0, align 128
197 %v16 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
198 %v17 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> undef, <32 x i32> %v16)
199 %v18 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v17, i32 0, i32 1)
200 store <64 x i32> %v18, <64 x i32>* @g0, align 128
202 %v19 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
203 %v20 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
204 %v21 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> %v19, <32 x i32> %v20)
205 %v22 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v21, i32 1, i32 1)
206 store <64 x i32> %v22, <64 x i32>* @g0, align 128
210 attributes #0 = { nounwind "use-soft-float"="false" "target-cpu"="hexagonv66" "target-features"="+hvxv66,+hvx-length128b" }
211 attributes #1 = { nounwind readnone }
212 attributes #2 = { nounwind optsize }