Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/external/gpl3/gcc/dist/gcc/config/i386 Pull up following ...



details:   https://anonhg.NetBSD.org/src/rev/1fe62350c8bb
branches:  netbsd-6
changeset: 775351:1fe62350c8bb
user:      riz <riz%NetBSD.org@localhost>
date:      Wed Oct 17 21:30:30 2012 +0000

description:
Pull up following revision(s) (requested by joerg in ticket #560):
        external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h: revision 1.3
        external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h: revision 1.2
        external/gpl3/gcc/dist/gcc/config/i386/i386.c: revision 1.2
        external/gpl3/gcc/dist/gcc/config/i386/i386.h: revision 1.2
Fix GCC to correctly implement the i386 psABI on NetBSD.
This consists of two parts:
- for NetBSD/i386 and NetBSD/AMD64 with -m32, use a default stack
  alignment of 23bit as specified by the ABI
- ensure that double and long long variables on the stack are by default
  only aligned to 32bit, if there is nothing else in the function
  needing a larger stack alignment
The combination ensures that SSE variables on the stack trigger the
realignment logic, but just using double or long long doesn't.
PR 46978: ICE on spilling MMX registers
GCC/i386 has code to lower the required alignment for long long to 32bit
as the CPU doesn't need more. It is also using the same mode for setting
up the MMX registers and in turn, the stack slots reserved for spilling
require 32bit alignment. The actual vector types used keep the original
64bit alignment, so when the compiler wants to spill a MMX register, it
hits an assertion. Fix this by using the vector type as raw type for MMX
registers.

diffstat:

 external/gpl3/gcc/dist/gcc/config/i386/i386.c       |  10 +++++++---
 external/gpl3/gcc/dist/gcc/config/i386/i386.h       |   1 +
 external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h |   4 ++++
 external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h   |   4 ++++
 4 files changed, 16 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r 9e1dc1540f54 -r 1fe62350c8bb external/gpl3/gcc/dist/gcc/config/i386/i386.c
--- a/external/gpl3/gcc/dist/gcc/config/i386/i386.c     Wed Oct 17 21:27:12 2012 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/i386/i386.c     Wed Oct 17 21:30:30 2012 +0000
@@ -20104,7 +20104,9 @@
   if (!TARGET_64BIT
       && align == 64
       && ix86_preferred_stack_boundary < 64
-      && (mode == DImode || (type && TYPE_MODE (type) == DImode))
+      && (mode == DImode || (type && TYPE_MODE (type) == DImode)
+          || mode == DFmode || (type && TYPE_MODE (type) == DFmode)
+          || mode == DCmode || (type && TYPE_MODE (type) == DCmode))
       && (!type || !TYPE_USER_ALIGN (type))
       && (!decl || !DECL_USER_ALIGN (decl)))
     align = 32;
@@ -20150,7 +20152,8 @@
            || TREE_CODE (type) == QUAL_UNION_TYPE)
           && TYPE_FIELDS (type))
     {
-      if (DECL_MODE (TYPE_FIELDS (type)) == DFmode && align < 64)
+      if (DECL_MODE (TYPE_FIELDS (type)) == DFmode && align < 64
+          && (TARGET_64BIT || ix86_preferred_stack_boundary >= 64))
        return 64;
       if (ALIGN_MODE_128 (DECL_MODE (TYPE_FIELDS (type))) && align < 128)
        return 128;
@@ -20159,7 +20162,8 @@
           || TREE_CODE (type) == INTEGER_TYPE)
     {
 
-      if (TYPE_MODE (type) == DFmode && align < 64)
+      if (TYPE_MODE (type) == DFmode && align < 64
+          && (TARGET_64BIT || ix86_preferred_stack_boundary >= 64))
        return 64;
       if (ALIGN_MODE_128 (TYPE_MODE (type)) && align < 128)
        return 128;
diff -r 9e1dc1540f54 -r 1fe62350c8bb external/gpl3/gcc/dist/gcc/config/i386/i386.h
--- a/external/gpl3/gcc/dist/gcc/config/i386/i386.h     Wed Oct 17 21:27:12 2012 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/i386/i386.h     Wed Oct 17 21:30:30 2012 +0000
@@ -1081,6 +1081,7 @@
 
 #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE)                        \
   (CC_REGNO_P (REGNO) ? VOIDmode                                       \
+   : MMX_REGNO_P (REGNO) ? V8QImode                                    \
    : (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode                     \
    : (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), false) \
    : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode            \
diff -r 9e1dc1540f54 -r 1fe62350c8bb external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h
--- a/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h       Wed Oct 17 21:27:12 2012 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/i386/netbsd-elf.h       Wed Oct 17 21:30:30 2012 +0000
@@ -126,3 +126,7 @@
 #undef X87_ENABLE_ARITH
 #define X87_ENABLE_ARITH(MODE) \
   (flag_excess_precision == EXCESS_PRECISION_FAST || (MODE) == DFmode)
+
+/* Preserve i386 psABI  */
+#undef PREFERRED_STACK_BOUNDARY_DEFAULT
+#define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY
diff -r 9e1dc1540f54 -r 1fe62350c8bb external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h
--- a/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h Wed Oct 17 21:27:12 2012 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/i386/netbsd64.h Wed Oct 17 21:30:30 2012 +0000
@@ -70,3 +70,7 @@
 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
 
 #define TARGET_VERSION fprintf (stderr, " (NetBSD/x86_64 ELF)");
+
+/* Preserve i386 psABI  */
+#undef PREFERRED_STACK_BOUNDARY_DEFAULT
+#define PREFERRED_STACK_BOUNDARY_DEFAULT MIN_STACK_BOUNDARY



Home | Main Index | Thread Index | Old Index