diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/powerpc/recip-5.c | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/powerpc/recip-5.c')
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/recip-5.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-5.c b/gcc/testsuite/gcc.target/powerpc/recip-5.c new file mode 100644 index 000000000..4a9c49620 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/recip-5.c @@ -0,0 +1,94 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */ +/* { dg-final { scan-assembler-times "xvredp" 4 } } */ +/* { dg-final { scan-assembler-times "xvresp" 5 } } */ +/* { dg-final { scan-assembler-times "xsredp" 2 } } */ +/* { dg-final { scan-assembler-times "fres" 2 } } */ + +#include <altivec.h> + +float f_recip (float a, float b) { return __builtin_recipdivf (a, b); } +double d_recip (double a, double b) { return __builtin_recipdiv (a, b); } + +float f_div (float a, float b) { return a / b; } +double d_div (double a, double b) { return a / b; } + +#define SIZE 1024 + +double d_a[SIZE] __attribute__((__aligned__(32))); +double d_b[SIZE] __attribute__((__aligned__(32))); +double d_c[SIZE] __attribute__((__aligned__(32))); + +float f_a[SIZE] __attribute__((__aligned__(32))); +float f_b[SIZE] __attribute__((__aligned__(32))); +float f_c[SIZE] __attribute__((__aligned__(32))); + +void vec_f_recip (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + f_a[i] = __builtin_recipdivf (f_b[i], f_c[i]); +} + +void vec_d_recip (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + d_a[i] = __builtin_recipdiv (d_b[i], d_c[i]); +} + +void vec_f_div (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + f_a[i] = f_b[i] / f_c[i]; +} + +void vec_f_div2 (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + f_a[i] = f_b[i] / 2.0f; +} + +void vec_f_div53 (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + f_a[i] = f_b[i] / 53.0f; +} + +void vec_d_div (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + d_a[i] = d_b[i] / d_c[i]; +} + +void vec_d_div2 (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + d_a[i] = d_b[i] / 2.0; +} + +void vec_d_div53 (void) +{ + int i; + + for (i = 0; i < SIZE; i++) + d_a[i] = d_b[i] / 53.0; +} + +vector float v4sf_recip1 (vector float a, vector float b) { return vec_recipdiv (a, b); } +vector float v4sf_recip2 (vector float a, vector float b) { return __builtin_altivec_vrecipdivfp (a, b); } +vector double v2df_recip1 (vector double a, vector double b) { return vec_recipdiv (a, b); } +vector float v4sf_recip3 (vector float a, vector float b) { return __builtin_vsx_xvrecipdivsp (a, b); } +vector double v2df_recip2 (vector double a, vector double b) { return __builtin_vsx_xvrecipdivdp (a, b); } |