From: Uros Bizjak Date: Sun, 17 Jun 2007 07:20:21 +0000 (+0200) Subject: sse-recip-vec.c: Add file, missing from my previous commit. X-Git-Tag: releases/gcc-4.3.0~4423 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b92d0c71266b06e5b95023bb36b18062429a48bd;p=thirdparty%2Fgcc.git sse-recip-vec.c: Add file, missing from my previous commit. * gcc.target/i386/sse-recip-vec.c: Add file, missing from my previous commit. From-SVN: r125767 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc98594c016f..83864348f78f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -6,6 +6,7 @@ * gcc.target/i386/recip-vec-divf.c: Ditto. * gcc.target/i386/recip-vec-sqrtf.c: Ditto. * gcc.target/i386/sse-recip.c: Ditto. + * gcc.target/i386/sse-recip-vec.c: Ditto. 2007-06-15 Andrew Pinski diff --git a/gcc/testsuite/gcc.target/i386/recip-divf.c b/gcc/testsuite/gcc.target/i386/recip-divf.c index 0a2e9c8bd81c..3b6f5757a6bc 100644 --- a/gcc/testsuite/gcc.target/i386/recip-divf.c +++ b/gcc/testsuite/gcc.target/i386/recip-divf.c @@ -1,5 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O2 -ffast-math -msse2 -mfpmath=sse -mrecip" } */ +/* { dg-options "-O2 -ffast-math -msse -mfpmath=sse -mrecip" } */ float t1(float a, float b) { diff --git a/gcc/testsuite/gcc.target/i386/recip-sqrtf.c b/gcc/testsuite/gcc.target/i386/recip-sqrtf.c index c387077aae26..b6c298feba70 100644 --- a/gcc/testsuite/gcc.target/i386/recip-sqrtf.c +++ b/gcc/testsuite/gcc.target/i386/recip-sqrtf.c @@ -1,5 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O2 -ffast-math -msse2 -mfpmath=sse -mrecip" } */ +/* { dg-options "-O2 -ffast-math -msse -mfpmath=sse -mrecip" } */ extern float sqrtf (float); @@ -8,7 +8,7 @@ float t1(float a, float b) return a/sqrtf(b); } -float t2(float x, float a, float b) +float t2(float a, float b) { return sqrtf(a/b); } diff --git a/gcc/testsuite/gcc.target/i386/recip-vec-divf.c b/gcc/testsuite/gcc.target/i386/recip-vec-divf.c index bf41e6c4fde6..e4af992d5bf2 100644 --- a/gcc/testsuite/gcc.target/i386/recip-vec-divf.c +++ b/gcc/testsuite/gcc.target/i386/recip-vec-divf.c @@ -1,5 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2 -mfpmath=sse -mrecip" } */ +/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip" } */ float a[16]; float b[16]; diff --git a/gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c b/gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c index 2eb3f861f425..af444cf55dd7 100644 --- a/gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c +++ b/gcc/testsuite/gcc.target/i386/recip-vec-sqrtf.c @@ -1,5 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse2 -mfpmath=sse -mrecip" } */ +/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip" } */ float a[16]; float b[16]; diff --git a/gcc/testsuite/gcc.target/i386/sse-recip-vec.c b/gcc/testsuite/gcc.target/i386/sse-recip-vec.c new file mode 100644 index 000000000000..d142aa07db34 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse-recip-vec.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ffast-math -ftree-vectorize -msse -mfpmath=sse -mrecip" } */ + +#include "../../gcc.dg/i386-cpuid.h" + +extern float sqrtf (float); +extern void abort (void); + +#define N 8 + +int __attribute__((noinline)) +main1 () +{ + float a[N] = { 0.f, 18.f, 108.f, 324.f, 720.f, 1944.f, 3087.f, 5832.f }; + float b[N] = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f }; + float r[N]; + + float rc[N] = { 0.f, 3.f, 6.f, 9.f, 12.f, 18.f, 21.f, 27.f }; + + int i; + + for (i = 0; i < N; i++) + { + r[i] = sqrtf (a[i] / b[i]); + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (r[i] != rc[i]) + abort(); + } + + return 0; +} + +int +main () +{ + unsigned long cpu_facilities; + + cpu_facilities = i386_cpuid (); + + if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV)) + != (bit_MMX | bit_SSE | bit_CMOV)) + /* If host has no vector support, pass. */ + return 0; + + main1 (); + return 0; +}