diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-16 13:48:07 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-16 13:48:07 +0000 |
commit | 60a132a95ad5c01ef79b1233f4058d44cd058e87 (patch) | |
tree | e5f094d6ded3ba769f2acf1025a682d282eae0b7 /gcc/testsuite/g++.dg | |
parent | 2245c260271ae89faaeea4977c2360536d39d7f4 (diff) | |
download | gcc-60a132a95ad5c01ef79b1233f4058d44cd058e87.tar.gz |
PR middle-end/40446
* expr.c (expand_expr_real_1) <case VIEW_CONVERT_EXPR>: Don't
use gen_lowpart if op0 has complex mode.
* g++.dg/other/pr40446.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148533 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/other/pr40446.C | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/other/pr40446.C b/gcc/testsuite/g++.dg/other/pr40446.C new file mode 100644 index 00000000000..33dbcec7159 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr40446.C @@ -0,0 +1,46 @@ +// PR middle-end/40446 +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-options "-O1 -msse2" } + +#include <emmintrin.h> +#include "cpuid.h" + +extern "C" void abort (); + +struct S +{ + S (double r, double i) { __real__ s = r; __imag__ s = i; } + __complex__ double s; +}; + +__m128d +foo () +{ + S c (0, 1); + return _mm_load_pd ((double *) &c); +} + +static void +__attribute__((noinline)) +sse2_test () +{ + union { __m128d vec; double val[2]; } u; + u.vec = foo (); + if (u.val[0] != 0 || u.val[1] != 1) + abort (); +} + +int +main () +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run SSE2 test only if host has SSE2 support. */ + if (edx & bit_SSE2) + sse2_test (); + + return 0; +} |