c++: normalizing ttp constraints [PR115656]
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / fold-vec-splat-int.c
blobdd3e1c806d9c2425b0d7620dd912894cb8a15a39
1 /* Verify that overloaded built-ins for vec_splat with int
2 inputs produce the right code. */
4 /* { dg-do compile } */
5 /* { dg-options "-maltivec -O2" } */
6 /* { dg-require-effective-target powerpc_altivec } */
8 #include <altivec.h>
10 vector bool int testb_0 (vector bool int x) { return vec_splat (x, 0b00000); }
11 vector bool int testb_1 (vector bool int x) { return vec_splat (x, 0b00001); }
12 vector bool int testb_2 (vector bool int x) { return vec_splat (x, 0b00010); }
14 vector signed int tests_0 (vector signed int x) { return vec_splat (x, 0b00000); }
15 vector signed int tests_1 (vector signed int x) { return vec_splat (x, 0b00001); }
16 vector signed int tests_2 (vector signed int x) { return vec_splat (x, 0b00010); }
18 vector unsigned int testu_0 (vector unsigned int x) { return vec_splat (x, 0b00000); }
19 vector unsigned int testu_1 (vector unsigned int x) { return vec_splat (x, 0b00001); }
20 vector unsigned int testu_2 (vector unsigned int x) { return vec_splat (x, 0b00010); }
22 /* Similar test as above, but the source vector is a known constant. */
23 vector bool int test_bic () { const vector bool int y = { 1,2,3,4}; return vec_splat (y, 0b00010); }
24 vector signed int test_sic () { const vector signed int y = { 1,2,3,4}; return vec_splat (y, 0b00010); }
25 vector unsigned int test_uic () { const vector unsigned int y = { 1,2,3,4}; return vec_splat (y, 0b00010); }
27 /* { dg-final { scan-assembler-times "vspltisw" 3 } } */
28 /* { dg-final { scan-assembler-times "vspltw|xxspltw" 9 } } */