diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c new file mode 100644 index 00000000000..790f64c7519 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c @@ -0,0 +1,26 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O2 -mcpu=power9" } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ + +#include + +void abort (void); + +int main() { + int i; + vector float vfa, vfb; + vector unsigned short vur, vuexpt; + + vfa = (vector float){3.4, 5.0, 20.0, 50.9 }; + vfb = (vector float){10.0, 40.0, 70.0, 100.0 }; + vuexpt = (vector unsigned short){ 3, 5, 20, 50, + 10, 40, 70, 100}; + + vur = vec_pack_to_short_fp32 (vfa, vfb); + + for(i = 0; i< 8; i++) { + if (vur[i] != vuexpt[i]) + abort(); + } +}