From: hubicka Date: Thu, 17 Oct 2002 17:13:41 +0000 (+0000) Subject: * gcc.dg/20021017-2.c: New test. X-Git-Tag: upstream/4.9.2~83855 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4083ccf3bf478d08b0353e96f128c7871703a33e;p=platform%2Fupstream%2Flinaro-gcc.git * gcc.dg/20021017-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58253 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7fd352..12b4694 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +Thu Oct 17 19:12:58 CEST 2002 Jan Hubicka + + * gcc.dg/20021017-2.c: New test. + 2002-10-17 Mark Mitchell * g++.dg/abi/mangle17.C: Adjust. diff --git a/gcc/testsuite/gcc.dg/20020523-2.c b/gcc/testsuite/gcc.dg/20020523-2.c new file mode 100644 index 0000000..5ae3da5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020523-2.c @@ -0,0 +1,65 @@ +/* PR target/6753 + This testcase was miscompiled because sse_mov?fcc_const0* + patterns were missing earlyclobber. */ +/* { dg-do run { target i386-*-* } } */ +/* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */ + +extern void abort (void); +extern void exit (int); + +float one = 1.f; + +void bar (float f) +{ + if (__builtin_memcmp (&one, &f, sizeof (float))) + abort (); +} + +float foo (void) +{ + return 1.f; +} + +typedef struct +{ + float t; +} T; + +void bail_if_no_sse (void) +{ + int fl1, fl2; + + /* See if we can use cpuid. */ + __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;" + "pushl %0; popfl; pushfl; popl %0; popfl" + : "=&r" (fl1), "=&r" (fl2) + : "i" (0x00200000)); + if (((fl1 ^ fl2) & 0x00200000) == 0) + exit (0); + + /* See if cpuid gives capabilities. */ + __asm__ ("cpuid" : "=a" (fl1) : "0" (0) : "ebx", "ecx", "edx", "cc"); + if (fl1 == 0) + exit (0); + + /* See if capabilities include SSE (25th bit; 26 for SSE2). */ + __asm__ ("cpuid" : "=a" (fl1), "=d" (fl2) : "0" (1) : "ebx", "ecx", "cc"); + if ((fl2 & (1 << 25)) == 0) + exit (0); +} + +int main (void) +{ + int i; + T x[1]; + + bail_if_no_sse (); + for (i = 0; i < 1; i++) + { + x[i].t = foo (); + x[i].t = 0.f > x[i].t ? 0.f : x[i].t; + bar (x[i].t); + } + + exit (0); +}