1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
6 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
9 ; This test case aims to test the vector mask manipulation operations
12 declare i32 @llvm.ppc.altivec.vextractbm(<16 x i8>)
13 declare i32 @llvm.ppc.altivec.vextracthm(<8 x i16>)
14 declare i32 @llvm.ppc.altivec.vextractwm(<4 x i32>)
15 declare i32 @llvm.ppc.altivec.vextractdm(<2 x i64>)
16 declare i32 @llvm.ppc.altivec.vextractqm(<1 x i128>)
18 define i32 @test_vextractbm(<16 x i8> %a) {
19 ; CHECK-LABEL: test_vextractbm:
20 ; CHECK: # %bb.0: # %entry
21 ; CHECK-NEXT: vextractbm r3, v2
24 %ext = tail call i32 @llvm.ppc.altivec.vextractbm(<16 x i8> %a)
28 define i32 @test_vextracthm(<8 x i16> %a) {
29 ; CHECK-LABEL: test_vextracthm:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: vextracthm r3, v2
34 %ext = tail call i32 @llvm.ppc.altivec.vextracthm(<8 x i16> %a)
38 define i32 @test_vextractwm(<4 x i32> %a) {
39 ; CHECK-LABEL: test_vextractwm:
40 ; CHECK: # %bb.0: # %entry
41 ; CHECK-NEXT: vextractwm r3, v2
44 %ext = tail call i32 @llvm.ppc.altivec.vextractwm(<4 x i32> %a)
48 define i32 @test_vextractdm(<2 x i64> %a) {
49 ; CHECK-LABEL: test_vextractdm:
50 ; CHECK: # %bb.0: # %entry
51 ; CHECK-NEXT: vextractdm r3, v2
54 %ext = tail call i32 @llvm.ppc.altivec.vextractdm(<2 x i64> %a)
58 define i32 @test_vextractqm(<1 x i128> %a) {
59 ; CHECK-LABEL: test_vextractqm:
60 ; CHECK: # %bb.0: # %entry
61 ; CHECK-NEXT: vextractqm r3, v2
64 %ext = tail call i32 @llvm.ppc.altivec.vextractqm(<1 x i128> %a)
68 declare <16 x i8> @llvm.ppc.altivec.vexpandbm(<16 x i8>)
69 declare <8 x i16> @llvm.ppc.altivec.vexpandhm(<8 x i16>)
70 declare <4 x i32> @llvm.ppc.altivec.vexpandwm(<4 x i32>)
71 declare <2 x i64> @llvm.ppc.altivec.vexpanddm(<2 x i64>)
72 declare <1 x i128> @llvm.ppc.altivec.vexpandqm(<1 x i128>)
74 define <16 x i8> @test_vexpandbm(<16 x i8> %a) {
75 ; CHECK-LABEL: test_vexpandbm:
76 ; CHECK: # %bb.0: # %entry
77 ; CHECK-NEXT: vexpandbm v2, v2
80 %exp = tail call <16 x i8> @llvm.ppc.altivec.vexpandbm(<16 x i8> %a)
84 define <8 x i16> @test_vexpandhm(<8 x i16> %a) {
85 ; CHECK-LABEL: test_vexpandhm:
86 ; CHECK: # %bb.0: # %entry
87 ; CHECK-NEXT: vexpandhm v2, v2
90 %exp = tail call <8 x i16> @llvm.ppc.altivec.vexpandhm(<8 x i16> %a)
94 define <4 x i32> @test_vexpandwm(<4 x i32> %a) {
95 ; CHECK-LABEL: test_vexpandwm:
96 ; CHECK: # %bb.0: # %entry
97 ; CHECK-NEXT: vexpandwm v2, v2
100 %exp = tail call <4 x i32> @llvm.ppc.altivec.vexpandwm(<4 x i32> %a)
104 define <2 x i64> @test_vexpanddm(<2 x i64> %a) {
105 ; CHECK-LABEL: test_vexpanddm:
106 ; CHECK: # %bb.0: # %entry
107 ; CHECK-NEXT: vexpanddm v2, v2
110 %exp = tail call <2 x i64> @llvm.ppc.altivec.vexpanddm(<2 x i64> %a)
114 define <1 x i128> @test_vexpandqm(<1 x i128> %a) {
115 ; CHECK-LABEL: test_vexpandqm:
116 ; CHECK: # %bb.0: # %entry
117 ; CHECK-NEXT: vexpandqm v2, v2
120 %exp = tail call <1 x i128> @llvm.ppc.altivec.vexpandqm(<1 x i128> %a)
124 declare i64 @llvm.ppc.altivec.vcntmbb(<16 x i8>, i32)
125 declare i64 @llvm.ppc.altivec.vcntmbh(<8 x i16>, i32)
126 declare i64 @llvm.ppc.altivec.vcntmbw(<4 x i32>, i32)
127 declare i64 @llvm.ppc.altivec.vcntmbd(<2 x i64>, i32)
129 define i64 @test_vcntmbb(<16 x i8> %a) {
130 ; CHECK-LABEL: test_vcntmbb:
131 ; CHECK: # %bb.0: # %entry
132 ; CHECK-NEXT: vcntmbb r3, v2, 1
135 %cnt = tail call i64 @llvm.ppc.altivec.vcntmbb(<16 x i8> %a, i32 1)
139 define i64 @test_vcntmbh(<8 x i16> %a) {
140 ; CHECK-LABEL: test_vcntmbh:
141 ; CHECK: # %bb.0: # %entry
142 ; CHECK-NEXT: vcntmbh r3, v2, 0
145 %cnt = tail call i64 @llvm.ppc.altivec.vcntmbh(<8 x i16> %a, i32 0)
149 define i64 @test_vcntmbw(<4 x i32> %a) {
150 ; CHECK-LABEL: test_vcntmbw:
151 ; CHECK: # %bb.0: # %entry
152 ; CHECK-NEXT: vcntmbw r3, v2, 1
155 %cnt = tail call i64 @llvm.ppc.altivec.vcntmbw(<4 x i32> %a, i32 1)
159 define i64 @test_vcntmbd(<2 x i64> %a) {
160 ; CHECK-LABEL: test_vcntmbd:
161 ; CHECK: # %bb.0: # %entry
162 ; CHECK-NEXT: vcntmbd r3, v2, 0
165 %cnt = tail call i64 @llvm.ppc.altivec.vcntmbd(<2 x i64> %a, i32 0)
169 declare <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64)
170 declare <8 x i16> @llvm.ppc.altivec.mtvsrhm(i64)
171 declare <4 x i32> @llvm.ppc.altivec.mtvsrwm(i64)
172 declare <2 x i64> @llvm.ppc.altivec.mtvsrdm(i64)
173 declare <1 x i128> @llvm.ppc.altivec.mtvsrqm(i64)
175 define <16 x i8> @test_mtvsrbm(i64 %a) {
176 ; CHECK-LABEL: test_mtvsrbm:
177 ; CHECK: # %bb.0: # %entry
178 ; CHECK-NEXT: mtvsrbm v2, r3
181 %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 %a)
185 define <16 x i8> @test_mtvsrbmi() {
186 ; CHECK-LABEL: test_mtvsrbmi:
187 ; CHECK: # %bb.0: # %entry
188 ; CHECK-NEXT: mtvsrbmi v2, 1
191 %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 1)
195 define <16 x i8> @test_mtvsrbmi2() {
196 ; CHECK-LABEL: test_mtvsrbmi2:
197 ; CHECK: # %bb.0: # %entry
198 ; CHECK-NEXT: mtvsrbmi v2, 255
201 %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 255)
205 define <16 x i8> @test_mtvsrbmi3() {
206 ; CHECK-LABEL: test_mtvsrbmi3:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: mtvsrbmi v2, 65535
211 %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 65535)
215 define <16 x i8> @test_mtvsrbmi4() {
216 ; CHECK-LABEL: test_mtvsrbmi4:
217 ; CHECK: # %bb.0: # %entry
218 ; CHECK-NEXT: mtvsrbmi v2, 0
221 %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 65536)
225 define <16 x i8> @test_mtvsrbmi5() {
226 ; CHECK-LABEL: test_mtvsrbmi5:
227 ; CHECK: # %bb.0: # %entry
228 ; CHECK-NEXT: mtvsrbmi v2, 10
231 %mv = tail call <16 x i8> @llvm.ppc.altivec.mtvsrbm(i64 65546)
235 define <8 x i16> @test_mtvsrhm(i64 %a) {
236 ; CHECK-LABEL: test_mtvsrhm:
237 ; CHECK: # %bb.0: # %entry
238 ; CHECK-NEXT: mtvsrhm v2, r3
241 %mv = tail call <8 x i16> @llvm.ppc.altivec.mtvsrhm(i64 %a)
245 define <4 x i32> @test_mtvsrwm(i64 %a) {
246 ; CHECK-LABEL: test_mtvsrwm:
247 ; CHECK: # %bb.0: # %entry
248 ; CHECK-NEXT: mtvsrwm v2, r3
251 %mv = tail call <4 x i32> @llvm.ppc.altivec.mtvsrwm(i64 %a)
255 define <2 x i64> @test_mtvsrdm(i64 %a) {
256 ; CHECK-LABEL: test_mtvsrdm:
257 ; CHECK: # %bb.0: # %entry
258 ; CHECK-NEXT: mtvsrdm v2, r3
261 %mv = tail call <2 x i64> @llvm.ppc.altivec.mtvsrdm(i64 %a)
265 define <1 x i128> @test_mtvsrqm(i64 %a) {
266 ; CHECK-LABEL: test_mtvsrqm:
267 ; CHECK: # %bb.0: # %entry
268 ; CHECK-NEXT: mtvsrqm v2, r3
271 %mv = tail call <1 x i128> @llvm.ppc.altivec.mtvsrqm(i64 %a)