Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / fold-vec-splat-int.c
blob7697853f75abe42bc8e3ab5b1a7cc85ce1621395
1 /* Verify that overloaded built-ins for vec_splat with int
2 inputs produce the right code. */
4 /* { dg-do compile } */
5 /* { dg-require-effective-target powerpc_altivec_ok } */
6 /* { dg-options "-maltivec -O2" } */
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); }
13 vector bool int testb_4 (vector bool int x) { return vec_splat (x, 0b00100); }
14 vector bool int testb_8 (vector bool int x) { return vec_splat (x, 0b01000); }
15 vector bool int testb_10 (vector bool int x) { return vec_splat (x, 0b10000); }
16 vector bool int testb_1e (vector bool int x) { return vec_splat (x, 0b11110); }
17 vector bool int testb_1f (vector bool int x) { return vec_splat (x, 0b11111); }
19 vector signed int tests_0 (vector signed int x) { return vec_splat (x, 0b00000); }
20 vector signed int tests_1 (vector signed int x) { return vec_splat (x, 0b00001); }
21 vector signed int tests_2 (vector signed int x) { return vec_splat (x, 0b00010); }
22 vector signed int tests_4 (vector signed int x) { return vec_splat (x, 0b00100); }
23 vector signed int tests_8 (vector signed int x) { return vec_splat (x, 0b01000); }
24 vector signed int tests_10 (vector signed int x) { return vec_splat (x, 0b10000); }
25 vector signed int tests_1e (vector signed int x) { return vec_splat (x, 0b11110); }
26 vector signed int tests_1f (vector signed int x) { return vec_splat (x, 0b11111); }
28 vector unsigned int testu_0 (vector unsigned int x) { return vec_splat (x, 0b00000); }
29 vector unsigned int testu_1 (vector unsigned int x) { return vec_splat (x, 0b00001); }
30 vector unsigned int testu_2 (vector unsigned int x) { return vec_splat (x, 0b00010); }
31 vector unsigned int testu_4 (vector unsigned int x) { return vec_splat (x, 0b00100); }
32 vector unsigned int testu_8 (vector unsigned int x) { return vec_splat (x, 0b01000); }
33 vector unsigned int testu_10 (vector unsigned int x) { return vec_splat (x, 0b10000); }
34 vector unsigned int testu_1e (vector unsigned int x) { return vec_splat (x, 0b11110); }
35 vector unsigned int testu_1f (vector unsigned int x) { return vec_splat (x, 0b11111); }
37 /* Similar test as above, but the source vector is a known constant. */
38 vector bool int test_bic () { const vector bool int y = { 1,2,3,4}; return vec_splat (y, 0b00010); }
39 vector signed int test_sic () { const vector signed int y = { 1,2,3,4}; return vec_splat (y, 0b00010); }
40 vector unsigned int test_uic () { const vector unsigned int y = { 1,2,3,4}; return vec_splat (y, 0b00010); }
42 /* Similar tests as above, mask is greater than number of elements in the
43 source vector. */
44 vector bool int test_obic () { const vector bool int y = { 1,2,3,4}; return vec_splat (y, 0b10010); }
45 vector signed int test_osic () { const vector signed int y = { 1,2,3,4}; return vec_splat (y, 0b10010); }
46 vector unsigned int test_ouic () { const vector unsigned int y = { 1,2,3,4}; return vec_splat (y, 0b10010); }
48 /* { dg-final { scan-assembler-times "vspltisw" 6 } } */
49 /* { dg-final { scan-assembler-times "vspltw|xxspltw" 24 } } */