| 1 |
/* Verify that overloaded built-ins for vec_splat with int |
| 2 |
inputs produce the right code. */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-maltivec -O2" } */ |
| 6 |
/* { dg-require-effective-target powerpc_altivec } */ |
| 7 |
|
| 8 |
#include <altivec.h> |
| 9 |
|
| 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 |
|
| 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); } |
| 17 |
|
| 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); } |
| 21 |
|
| 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); } |
| 26 |
|
| 27 |
/* { dg-final { scan-assembler-times "vspltisw" 3 } } */ |
| 28 |
/* { dg-final { scan-assembler-times "vspltw|xxspltw" 9 } } */ |
| 29 |
|