[PATCH] Fix PR target/36399
Jack Howarth
howarth@bromo.med.uc.edu
Fri Mar 12 09:44:00 GMT 2010
The attached patch implements Apple's definition of
x86 32-bit ABI for X86_32_SSE_REGPARM_MAX. Bootstrapped
and regression tested on i686-apple-darwin10. Okay for
gcc trunk?
Jack
ps With this patch, the original test code of...
#include <xmmintrin.h>
__m128i r(__m128 d1, __m128 d2, __m128 d3, __m128i r, int t, __m128i s) {return r+s;}
now shows the following diff in the generated assembly
without and with the patch applied...
--- test.s.prepatch 2010-03-11 20:05:14.000000000 -0500
+++ test.s 2010-03-11 20:06:04.000000000 -0500
@@ -3,12 +3,13 @@
_r:
pushl %ebp
movl %esp, %ebp
- subl $56, %esp
+ subl $72, %esp
movaps %xmm0, -24(%ebp)
movaps %xmm1, -40(%ebp)
movaps %xmm2, -56(%ebp)
- movdqa 40(%ebp), %xmm0
- movdqa 8(%ebp), %xmm1
+ movdqa %xmm3, -72(%ebp)
+ movdqa 24(%ebp), %xmm0
+ movdqa -72(%ebp), %xmm1
paddq %xmm1, %xmm0
leave
ret
which shows that we now produce the same code as Apple's
gcc compilers...
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36399#c3
This patch does produce one change in the gcc testsuite
results...
XPASS: gcc.target/i386/push-1.c scan-assembler-not movups
...hence the testsuite change modeled on libstdc++-v3/testsuite/22_locale/ctype/is/wchar_t/2.cc.
2010-03-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Jack Howarth <howarth@bromo.med.uc.edu>
PR target/36399
* gcc/config/i386/i386.h: Fix ABI on darwin x86-32.
* gcc/testsuite/gcc.target/i386/push-1.c: Don't xfail
scan-assembler-not "movups" on darwin.
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h (revision 157393)
+++ gcc/config/i386/i386.h (working copy)
@@ -1810,7 +1810,7 @@
#define X86_64_SSE_REGPARM_MAX 8
#define X86_64_MS_SSE_REGPARM_MAX 4
-#define X86_32_SSE_REGPARM_MAX (TARGET_SSE ? 3 : 0)
+#define X86_32_SSE_REGPARM_MAX (TARGET_SSE ? (TARGET_MACHO ? 4 : 3) : 0)
#define SSE_REGPARM_MAX \
(TARGET_64BIT ? (TARGET_64BIT_MS_ABI ? X86_64_MS_SSE_REGPARM_MAX \
Index: gcc/testsuite/gcc.target/i386/push-1.c
===================================================================
--- gcc/testsuite/gcc.target/i386/push-1.c (revision 157393)
+++ gcc/testsuite/gcc.target/i386/push-1.c (working copy)
@@ -12,4 +12,4 @@
foo (x, x, x, x, 5);
}
-/* { dg-final { scan-assembler-not "movups" { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-not "movups" { xfail *-*-![darwin]* } } } */
More information about the Gcc-patches
mailing list