diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-28 14:38:13 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-28 14:38:13 +0000 |
commit | 4dc0452efcf87eb8c79c4ccf3ef0ebf3c1029ff9 (patch) | |
tree | 833315b998733752989fcd83cff0c747cb858a91 /gcc/testsuite | |
parent | 46ca9f38f4e35f1e6f31558e4d2e606ac19e26ae (diff) | |
download | gcc-4dc0452efcf87eb8c79c4ccf3ef0ebf3c1029ff9.tar.gz |
PR target/21149
* gcc.target/i386/sse-3.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102482 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/sse-3.c | 53 |
2 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46434bfa1ef..89f6ea26c83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-07-28 Jakub Jelinek <jakub@redhat.com> + + PR target/21149 + * gcc.target/i386/sse-3.c: New test. + 2005-07-28 Richard Sandiford <richard@codesourcery.com> * gcc.target/mips/mips32-dsp.c: Use -march=mips32 instead of -mips32. diff --git a/gcc/testsuite/gcc.target/i386/sse-3.c b/gcc/testsuite/gcc.target/i386/sse-3.c new file mode 100644 index 00000000000..b09adda8660 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse-3.c @@ -0,0 +1,53 @@ +/* PR target/21149 */ +/* { dg-do run } */ +/* { dg-options "-O2 -msse" } */ +#include <xmmintrin.h> +#include "../../gcc.dg/i386-cpuid.h" + +extern void abort (void); + +void +__attribute__((noinline)) +check (__m128 x, float a, float b, float c, float d) +{ + union { __m128 m; float f[4]; } u; + u.m = x; + if (u.f[0] != a || u.f[1] != b || u.f[2] != c || u.f[3] != d) + abort (); +} + +static inline +void +foo (__m128 *x) +{ + __m128 y = _mm_setzero_ps (); + __m128 v = _mm_movehl_ps (y, *x); + __m128 w = _mm_movehl_ps (*x, y); + check (*x, 9, 1, 2, -3); + check (v, 2, -3, 0, 0); + check (w, 0, 0, 2, -3); +} + +void +__attribute__((noinline)) +run_tests (void) +{ + __m128 y = _mm_set_ps (-3, 2, 1, 9); + foo (&y); +} + +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; + + run_tests (); + return 0; +} |