From: Carl Love Date: Thu, 28 Jun 2018 19:45:07 +0000 (+0000) Subject: p9-extract-1.c: Add test case. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02fa47a905c1e06a5490032cc4bd4f733f4a0453;p=gcc.git p9-extract-1.c: Add test case. gcc/testsuite/ChangeLog: 2018-06-28 Carl Love * gcc.target/p9-extract-1.c: Add test case. * gcc.target/builtins-3-p9-runnable.c: Add test case to match name in ABI. From-SVN: r262230 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 197a4683375..58860c7aebd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-06-28 Carl Love + + * gcc.target/p9-extract-1.c: Add test case. + * gcc.target/builtins-3-p9-runnable.c: Add test case to match + name in ABI. + 2018-06-28 Uros Bizjak PR target/86348 diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c index 3197a5076e0..35a81a7facb 100644 --- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c @@ -30,6 +30,48 @@ int main() { printf (" 0B011110100000000, 0B1011010000000000};\n\n"); #endif + /* The ABI lists the builtins as: + + vec_extract_fp32_from_shorth() + vec_extract_fp32_from_shortl() + + GCC will also accept and map the builtin names + + vec_extract_fp_from_shorth() + vec_extract_fp_from_shortl() + + to the same builtins internally. For completeness, + test both builtin function names. */ + + vfexpt = (vector float){1.0, -2.0, 0.0, 8.5}; + vfr = vec_extract_fp32_from_shorth(vusha); + +#ifdef DEBUG + printf ("vec_extract_fp32_from_shorth\n"); + for (i=0; i<4; i++) + printf("result[%d] = %f; expected[%d] = %f\n", + i, vfr[i], i, vfexpt[i]); +#endif + + for (i=0; i<4; i++) { + if (vfr[i] != vfexpt[i]) + abort(); + } + + vfexpt = (vector float){1.5, 0.5, 1.25, -0.25}; + vfr = vec_extract_fp32_from_shortl(vusha); + +#ifdef DEBUG + printf ("\nvec_extract_fp32_from_shortl\n"); + for (i=0; i<4; i++) + printf("result[%d] = %f; expected[%d] = %f\n", + i, vfr[i], i, vfexpt[i]); +#endif + + for (i=0; i<4; i++) { + if (vfr[i] != vfexpt[i]) + abort(); + } vfexpt = (vector float){1.0, -2.0, 0.0, 8.5}; vfr = vec_extract_fp_from_shorth(vusha); diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c index ab9e766385d..203f5bf5def 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c @@ -122,6 +122,14 @@ extract_bool_int_0 (vector bool int a) return b; } +unsigned short int +extract_bool_short_int_0 (vector bool short int a) +{ + int c = 0; + unsigned short int b = vec_extract (a, c); + return b; +} + /* { dg-final { scan-assembler "vextub\[lr\]x " } } */ /* { dg-final { scan-assembler "vextuh\[lr\]x " } } */ /* { dg-final { scan-assembler "vextuw\[lr\]x " } } */