diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c')
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c new file mode 100644 index 0000000..1dabd6c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c @@ -0,0 +1,37 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector unsigned long long int +get_exponents (__vector double *p) +{ + __vector double source = *p; + + return vec_extract_exp (source); +} + +unsigned long long int +bias_double_exp (long long int unbiased_exp) +{ + return (unsigned long long int) (unbiased_exp + 1023); +} + +int +main () +{ + __vector double argument; + __vector unsigned long long int result; + + argument[0] = (double) (0x1 << 22); + argument[1] = (double) (0x1 << 23); + + result = get_exponents (&argument); + if ((result[0] != bias_double_exp (22)) || + (result[1] != bias_double_exp (23))) + abort(); + return 0; +} |