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(ptr, ...) #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,#1152):raw
38 ; CHECK-NEXT: v1 = vsplat(r1)
39 ; CHECK-NEXT: r17:16 = combine(#-1,#1)
40 ; CHECK-NEXT: r29 = and(r29,#-128)
41 ; CHECK-NEXT: memd(r30+#-8) = r17:16
42 ; CHECK-NEXT: } // 8-byte Folded Spill
44 ; CHECK-NEXT: v0 = vsplat(r16)
45 ; CHECK-NEXT: vmem(r29+#6) = v0.new
46 ; CHECK-NEXT: } // 128-byte Folded Spill
48 ; CHECK-NEXT: q0 = vand(v0,r0)
49 ; CHECK-NEXT: r18 = ##-2147483648
50 ; CHECK-NEXT: memd(r30+#-16) = r19:18
51 ; CHECK-NEXT: } // 8-byte Folded Spill
53 ; CHECK-NEXT: r0 = ##g1
54 ; CHECK-NEXT: memd(r30+#-24) = r21:20
55 ; CHECK-NEXT: } // 8-byte Folded Spill
57 ; CHECK-NEXT: v0 = vand(q0,r17)
58 ; CHECK-NEXT: r19 = ##g0+128
59 ; CHECK-NEXT: vmem(r29+#7) = v0.new
62 ; CHECK-NEXT: r20 = ##g0
63 ; CHECK-NEXT: vmem(r29+#3) = v1
64 ; CHECK-NEXT: } // 128-byte Folded Spill
66 ; CHECK-NEXT: v3:2.h = vadd(v0.ub,v1.ub)
67 ; CHECK-NEXT: vmem(r29+#4) = v2.new
68 ; CHECK-NEXT: } // 256-byte Folded Spill
70 ; CHECK-NEXT: v31:30.uw = vrmpy(v3:2.ub,r18.ub,#0)
71 ; CHECK-NEXT: vmem(r29+#5) = v3
72 ; CHECK-NEXT: } // 256-byte Folded Spill
74 ; CHECK-NEXT: vmem(r19+#0) = v31
78 ; CHECK-NEXT: vmem(r20+#0) = v30
81 ; CHECK-NEXT: v0 = vmem(r29+#6)
82 ; CHECK-NEXT: } // 128-byte Folded Reload
84 ; CHECK-NEXT: v1:0.h = vadd(v0.ub,v0.ub)
85 ; CHECK-NEXT: r0 = ##g2
86 ; CHECK-NEXT: vmem(r29+#1) = v0.new
87 ; CHECK-NEXT: } // 256-byte Folded Spill
89 ; CHECK-NEXT: vmem(r29+#2) = v1
90 ; CHECK-NEXT: } // 256-byte Folded Spill
92 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r17.ub,#0)
93 ; CHECK-NEXT: vmem(r19+#0) = v1.new
97 ; CHECK-NEXT: vmem(r20+#0) = v0
100 ; CHECK-NEXT: r0 = ##2147483647
101 ; CHECK-NEXT: v0 = vmem(r29+#1)
102 ; CHECK-NEXT: } // 256-byte Folded Reload
104 ; CHECK-NEXT: v1 = vmem(r29+#2)
105 ; CHECK-NEXT: } // 256-byte Folded Reload
107 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r0.ub,#1)
108 ; CHECK-NEXT: r0 = ##g3
109 ; CHECK-NEXT: vmem(r19+#0) = v1.new
112 ; CHECK-NEXT: call f1
113 ; CHECK-NEXT: vmem(r20+#0) = v0
116 ; CHECK-NEXT: v0 = vmem(r29+#4)
117 ; CHECK-NEXT: } // 256-byte Folded Reload
119 ; CHECK-NEXT: v1 = vmem(r29+#5)
120 ; CHECK-NEXT: } // 256-byte Folded Reload
122 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r18.ub,#1)
123 ; CHECK-NEXT: vmem(r19+#0) = v1.new
126 ; CHECK-NEXT: call f0
127 ; CHECK-NEXT: vmem(r20+#0) = v0
130 ; CHECK-NEXT: r0 = #0
131 ; CHECK-NEXT: v0 = vmem(r29+#4)
132 ; CHECK-NEXT: } // 256-byte Folded Reload
134 ; CHECK-NEXT: v1 = vmem(r29+#5)
135 ; CHECK-NEXT: } // 256-byte Folded Reload
137 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r0.ub,#1)
138 ; CHECK-NEXT: vmem(r19+#0) = v1.new
141 ; CHECK-NEXT: call f0
142 ; CHECK-NEXT: vmem(r20+#0) = v0
145 ; CHECK-NEXT: v0 = vmem(r29+#6)
146 ; CHECK-NEXT: } // 128-byte Folded Reload
148 ; CHECK-NEXT: v1 = vmem(r29+#3)
149 ; CHECK-NEXT: } // 128-byte Folded Reload
151 ; CHECK-NEXT: v1:0.h = vadd(v0.ub,v1.ub)
154 ; CHECK-NEXT: v1:0.uw = vrmpy(v1:0.ub,r16.ub,#1)
155 ; CHECK-NEXT: r17:16 = memd(r30+#-8)
156 ; CHECK-NEXT: vmem(r19+#0) = v1.new
157 ; CHECK-NEXT: } // 8-byte Folded Reload
159 ; CHECK-NEXT: r19:18 = memd(r30+#-16)
160 ; CHECK-NEXT: vmem(r20+#0) = v0
161 ; CHECK-NEXT: } // 8-byte Folded Reload
163 ; CHECK-NEXT: r21:20 = memd(r30+#-24)
164 ; CHECK-NEXT: r31:30 = dealloc_return(r30):raw
165 ; CHECK-NEXT: } // 8-byte Folded Reload
167 %v0 = alloca <32 x i32>, align 128
168 %v1 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
169 %v2 = call <128 x i1> @llvm.hexagon.V6.vandvrt.128B(<32 x i32> %v1, i32 16843009)
170 %v3 = call <32 x i32> @llvm.hexagon.V6.vandqrt.128B(<128 x i1> %v2, i32 -1)
171 store <32 x i32> %v3, ptr %v0, align 128
172 %v4 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
173 %v5 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> undef, <32 x i32> %v4)
174 %v6 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v5, i32 -2147483648, i32 0)
175 store <64 x i32> %v6, ptr @g0, align 128
176 call void (ptr, ...) @f1(ptr @g1) #2
177 %v7 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
178 %v8 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> %v7, <32 x i32> undef)
179 %v9 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v8, i32 -1, i32 0)
180 store <64 x i32> %v9, ptr @g0, align 128
181 call void (ptr, ...) @f1(ptr @g2) #2
182 %v10 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
183 %v11 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> %v10, <32 x i32> undef)
184 %v12 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v11, i32 2147483647, i32 1)
185 store <64 x i32> %v12, ptr @g0, align 128
186 call void (ptr, ...) @f1(ptr @g3) #2
187 %v13 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
188 %v14 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> undef, <32 x i32> %v13)
189 %v15 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v14, i32 -2147483648, i32 1)
190 store <64 x i32> %v15, ptr @g0, align 128
192 %v16 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
193 %v17 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> undef, <32 x i32> %v16)
194 %v18 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v17, i32 0, i32 1)
195 store <64 x i32> %v18, ptr @g0, align 128
197 %v19 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 1)
198 %v20 = call <32 x i32> @llvm.hexagon.V6.lvsplatw.128B(i32 2)
199 %v21 = call <64 x i32> @llvm.hexagon.V6.vaddubh.128B(<32 x i32> %v19, <32 x i32> %v20)
200 %v22 = call <64 x i32> @llvm.hexagon.V6.vrmpyubi.128B(<64 x i32> %v21, i32 1, i32 1)
201 store <64 x i32> %v22, ptr @g0, align 128
205 attributes #0 = { nounwind "use-soft-float"="false" "target-cpu"="hexagonv66" "target-features"="+hvxv66,+hvx-length128b" }
206 attributes #1 = { nounwind readnone }
207 attributes #2 = { nounwind optsize }