This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp] i386 cmpxchg8b and x86_64 cmpxchg16b support


Jakub Jelinek <jakub@redhat.com> writes:
> 
> --- libgomp/testsuite/libgomp.dg/atomic-2.c.jj	2005-10-10 23:23:40.000000000 +0200
> +++ libgomp/testsuite/libgomp.dg/atomic-2.c	2005-10-10 23:28:51.000000000 +0200
> @@ -0,0 +1,35 @@
> +/* { dg-do run } */
> +/* { dg-options "-O2 -fopenmp" } */
> +/* { dg-options "-O2 -fopenmp -march=nocona" { target i?86-*-* x86_64-*-* } } */
> +main (void)
> +{
> +#ifdef __x86_64__

This needs to be #if defined(__i386__) || defined(__x86_64__) 
otherwise you will crash on most i386 boxes.

> +# define bit_SSE3 (1 << 0)
> +# define bit_CX16 (1 << 13)
> +  unsigned int ax, bx, cx, dx;
> +  __asm__ ("cpuid" : "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx)
> +           : "0" (1) : "cc");
> +  if ((cx & (bit_SSE3 | bit_CX16)) != (bit_SSE3 | bit_CX16))
> +    return 0;
> +#endif

Also as a nitpick CX16 is in theory legal without SSE3.

-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]