1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s | \
2 ; RUN: FileCheck %s -check-prefix=CHECK-LE
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | \
4 ; RUN: FileCheck %s -check-prefix=CHECK-BE
6 ; Possible LE ShuffleVector masks (Case 1):
7 ; ShuffleVector((vector double)a, (vector double)b, 3, 1)
8 ; ShuffleVector((vector double)a, (vector double)b, 2, 1)
9 ; ShuffleVector((vector double)a, (vector double)b, 3, 0)
10 ; ShuffleVector((vector double)a, (vector double)b, 2, 0)
16 ; Possible LE Swap ShuffleVector masks (Case 2):
17 ; ShuffleVector((vector double)a, (vector double)b, 1, 3)
18 ; ShuffleVector((vector double)a, (vector double)b, 0, 3)
19 ; ShuffleVector((vector double)a, (vector double)b, 1, 2)
20 ; ShuffleVector((vector double)a, (vector double)b, 0, 2)
26 ; Possible LE ShuffleVector masks when a == b, b is undef (Case 3):
27 ; ShuffleVector((vector double)a, (vector double)a, 1, 1)
28 ; ShuffleVector((vector double)a, (vector double)a, 0, 1)
29 ; ShuffleVector((vector double)a, (vector double)a, 1, 0)
30 ; ShuffleVector((vector double)a, (vector double)a, 0, 0)
37 ; Possible BE ShuffleVector masks (Case 4):
38 ; ShuffleVector((vector double)a, (vector double)b, 0, 2)
39 ; ShuffleVector((vector double)a, (vector double)b, 0, 3)
40 ; ShuffleVector((vector double)a, (vector double)b, 1, 2)
41 ; ShuffleVector((vector double)a, (vector double)b, 1, 3)
47 ; Possible BE Swap ShuffleVector masks (Case 5):
48 ; ShuffleVector((vector double)a, (vector double)b, 2, 0)
49 ; ShuffleVector((vector double)a, (vector double)b, 3, 0)
50 ; ShuffleVector((vector double)a, (vector double)b, 2, 1)
51 ; ShuffleVector((vector double)a, (vector double)b, 3, 1)
57 ; Possible BE ShuffleVector masks when a == b, b is undef (Case 6):
58 ; ShuffleVector((vector double)a, (vector double)a, 0, 0)
59 ; ShuffleVector((vector double)a, (vector double)a, 0, 1)
60 ; ShuffleVector((vector double)a, (vector double)a, 1, 0)
61 ; ShuffleVector((vector double)a, (vector double)a, 1, 1)
68 define <2 x double> @test_le_vec_xxpermdi_v2f64_v2f64_0(<2 x double> %VA, <2 x double> %VB) {
70 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 3, i32 1>
72 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_v2f64_0
73 ; CHECK-LE: xxmrghd 34, 34, 35
77 define <2 x double> @test_le_vec_xxpermdi_v2f64_v2f64_1(<2 x double> %VA, <2 x double> %VB) {
79 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 2, i32 1>
81 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_v2f64_1
82 ; CHECK-LE: xxpermdi 34, 34, 35, 1
86 define <2 x double> @test_le_vec_xxpermdi_v2f64_v2f64_2(<2 x double> %VA, <2 x double> %VB) {
88 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 3, i32 0>
90 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_v2f64_2
91 ; CHECK-LE: xxpermdi 34, 34, 35, 2
95 define <2 x double> @test_le_vec_xxpermdi_v2f64_v2f64_3(<2 x double> %VA, <2 x double> %VB) {
97 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 2, i32 0>
99 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_v2f64_3
100 ; CHECK-LE: xxmrgld 34, 34, 35
104 define <2 x double> @test_le_swap_vec_xxpermdi_v2f64_v2f64_0(<2 x double> %VA, <2 x double> %VB) {
106 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 1, i32 3>
108 ; CHECK-LE-LABEL: @test_le_swap_vec_xxpermdi_v2f64_v2f64_0
109 ; CHECK-LE: xxmrghd 34, 35, 34
113 define <2 x double> @test_le_swap_vec_xxpermdi_v2f64_v2f64_1(<2 x double> %VA, <2 x double> %VB) {
115 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 0, i32 3>
117 ; CHECK-LE-LABEL: @test_le_swap_vec_xxpermdi_v2f64_v2f64_1
118 ; CHECK-LE: xxpermdi 34, 35, 34, 1
122 define <2 x double> @test_le_swap_vec_xxpermdi_v2f64_v2f64_2(<2 x double> %VA, <2 x double> %VB) {
124 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 1, i32 2>
126 ; CHECK-LE-LABEL: @test_le_swap_vec_xxpermdi_v2f64_v2f64_2
127 ; CHECK-LE: xxpermdi 34, 35, 34, 2
131 define <2 x double> @test_le_swap_vec_xxpermdi_v2f64_v2f64_3(<2 x double> %VA, <2 x double> %VB) {
133 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 0, i32 2>
135 ; CHECK-LE-LABEL: @test_le_swap_vec_xxpermdi_v2f64_v2f64_3
136 ; CHECK-LE: xxmrgld 34, 35, 34
140 define <2 x double> @test_le_vec_xxpermdi_v2f64_undef_0(<2 x double> %VA) {
142 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 1, i32 1>
144 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_undef_0
145 ; CHECK-LE: xxspltd 34, 34, 0
149 define <2 x double> @test_le_vec_xxpermdi_v2f64_undef_1(<2 x double> %VA) {
151 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 0, i32 1>
153 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_undef_1
157 define <2 x double> @test_le_vec_xxpermdi_v2f64_undef_2(<2 x double> %VA) {
159 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 1, i32 0>
161 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_undef_2
162 ; CHECK-LE: xxswapd 34, 34
165 define <2 x double> @test_le_vec_xxpermdi_v2f64_undef_3(<2 x double> %VA) {
167 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 0, i32 0>
169 ; CHECK-LE-LABEL: @test_le_vec_xxpermdi_v2f64_undef_3
170 ; CHECK-LE: xxspltd 34, 34, 1
175 define <2 x double> @test_be_vec_xxpermdi_v2f64_v2f64_0(<2 x double> %VA, <2 x double> %VB) {
177 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 0, i32 2>
179 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_v2f64_0
180 ; CHECK-BE: xxmrghd 34, 34, 35
184 define <2 x double> @test_be_vec_xxpermdi_v2f64_v2f64_1(<2 x double> %VA, <2 x double> %VB) {
186 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 0, i32 3>
188 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_v2f64_1
189 ; CHECK-BE: xxpermdi 34, 34, 35, 1
193 define <2 x double> @test_be_vec_xxpermdi_v2f64_v2f64_2(<2 x double> %VA, <2 x double> %VB) {
195 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 1, i32 2>
197 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_v2f64_2
198 ; CHECK-BE: xxpermdi 34, 34, 35, 2
202 define <2 x double> @test_be_vec_xxpermdi_v2f64_v2f64_3(<2 x double> %VA, <2 x double> %VB) {
204 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 1, i32 3>
206 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_v2f64_3
207 ; CHECK-BE: xxmrgld 34, 34, 35
211 define <2 x double> @test_be_swap_vec_xxpermdi_v2f64_v2f64_0(<2 x double> %VA, <2 x double> %VB) {
213 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 2, i32 0>
215 ; CHECK-BE-LABEL: @test_be_swap_vec_xxpermdi_v2f64_v2f64_0
216 ; CHECK-BE: xxmrghd 34, 35, 34
220 define <2 x double> @test_be_swap_vec_xxpermdi_v2f64_v2f64_1(<2 x double> %VA, <2 x double> %VB) {
222 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 2, i32 1>
224 ; CHECK-BE-LABEL: @test_be_swap_vec_xxpermdi_v2f64_v2f64_1
225 ; CHECK-BE: xxpermdi 34, 35, 34, 1
229 define <2 x double> @test_be_swap_vec_xxpermdi_v2f64_v2f64_2(<2 x double> %VA, <2 x double> %VB) {
231 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 3, i32 0>
233 ; CHECK-BE-LABEL: @test_be_swap_vec_xxpermdi_v2f64_v2f64_2
234 ; CHECK-BE: xxpermdi 34, 35, 34, 2
238 define <2 x double> @test_be_swap_vec_xxpermdi_v2f64_v2f64_3(<2 x double> %VA, <2 x double> %VB) {
240 %0 = shufflevector <2 x double> %VA, <2 x double> %VB,<2 x i32> <i32 3, i32 1>
242 ; CHECK-BE-LABEL: @test_be_swap_vec_xxpermdi_v2f64_v2f64_3
243 ; CHECK-BE: xxmrgld 34, 35, 34
247 define <2 x double> @test_be_vec_xxpermdi_v2f64_undef_0(<2 x double> %VA) {
249 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 0, i32 0>
251 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_undef_0
252 ; CHECK-BE: xxspltd 34, 34, 0
256 define <2 x double> @test_be_vec_xxpermdi_v2f64_undef_1(<2 x double> %VA) {
258 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 0, i32 1>
260 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_undef_1
264 define <2 x double> @test_be_vec_xxpermdi_v2f64_undef_2(<2 x double> %VA) {
266 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 1, i32 0>
268 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_undef_2
269 ; CHECK-LE: xxswapd 34, 34
272 define <2 x double> @test_be_vec_xxpermdi_v2f64_undef_3(<2 x double> %VA) {
274 %0 = shufflevector <2 x double> %VA, <2 x double> undef, <2 x i32> <i32 1, i32 1>
276 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v2f64_undef_3
277 ; CHECK-BE: xxspltd 34, 34, 1
281 ; More test cases to test different types of vector inputs
282 define <16 x i8> @test_be_vec_xxpermdi_v16i8_v16i8(<16 x i8> %VA, <16 x i8> %VB) {
284 %0 = shufflevector <16 x i8> %VA, <16 x i8> %VB,<16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19>
286 ; CHECK-BE-LABEL: @test_be_vec_xxpermdi_v16i8_v16i8
287 ; CHECK-BE: xxpermdi 34, 34, 35, 1
291 define <8 x i16> @test_le_swap_vec_xxpermdi_v8i16_v8i16(<8 x i16> %VA, <8 x i16> %VB) {
293 %0 = shufflevector <8 x i16> %VA, <8 x i16> %VB,<8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15>
295 ; CHECK-LE-LABEL: @test_le_swap_vec_xxpermdi_v8i16_v8i16
296 ; CHECK-LE: xxpermdi 34, 35, 34, 1
300 define <4 x i32> @test_le_swap_vec_xxpermdi_v4i32_v4i32(<4 x i32> %VA, <4 x i32> %VB) {
302 %0 = shufflevector <4 x i32> %VA, <4 x i32> %VB,<4 x i32> <i32 0, i32 1, i32 6, i32 7>
304 ; CHECK-LE-LABEL: @test_le_swap_vec_xxpermdi_v4i32_v4i32
305 ; CHECK-LE: xxpermdi 34, 35, 34, 1