This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] i386 cmpxchg8b and x86_64 cmpxchg16b support
- From: Andi Kleen <ak at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: 11 Oct 2005 01:34:34 +0200
- Subject: Re: [gomp] i386 cmpxchg8b and x86_64 cmpxchg16b support
- References: <20051010141153.GQ22818@devserv.devel.redhat.com.suse.lists.egcs-patches><20051010164730.GB4725@redhat.com.suse.lists.egcs-patches><20051010204615.GU22818@devserv.devel.redhat.com.suse.lists.egcs-patches><20051010210047.GA5367@redhat.com.suse.lists.egcs-patches><20051010214708.GW22818@devserv.devel.redhat.com.suse.lists.egcs-patches>
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