https://gcc.gnu.org/g:ee09fcc4e37a80d1c5cc0b08144bb1c2c4424747

commit r15-4767-gee09fcc4e37a80d1c5cc0b08144bb1c2c4424747
Author: Uros Bizjak <ubiz...@gmail.com>
Date:   Wed Oct 30 08:17:15 2024 +0100

    i386: Use assign_stack_temp instead of assign_386_stack_local with SLOT_TEMP
    
    It is better to use assign_stack_temp instead of assign_386_stack_local
    with SLOT_TEMP because assign_stack_temp also shares sub-space of stack
    slots (e.g. HImode temp shares stack slot with SImode stack slot).
    
    Use assign_386_stack_local only for special stack slots (SLOT_STV_TEMP that
    can be nested inside other stack temp access, SLOT_FLOATxFDI_387 that has
    relaxed alignment constraint) or slots that can't be shared (SLOT_CW_*).
    
    The patch removes SLOT_TEMP. assign_stack_temp should be used instead.
    
            gcc/ChangeLog:
    
            * config/i386/i386.h (enum ix86_stack_slot): Remove SLOT_TEMP.
            * config/i386/i386-expand.cc (ix86_expand_builtin)
            <case IX86_BUILTIN_LDMXCSR>: Use assign_stack_temp instead of
            assign_386_stack_local with SLOT_TEMP.
            <case IX86_BUILTIN_LDMXCSR>: Ditto.
            (ix86_expand_divmod_libfunc): Ditto.
            * config/i386/i386.md (floatunssi<mode>2): Ditto.
            * config/i386/sync.md (atomic_load<mode>): Ditto.
            (atomic_store<mode>): Ditto.

Diff:
---
 gcc/config/i386/i386-expand.cc | 6 +++---
 gcc/config/i386/i386.h         | 3 +--
 gcc/config/i386/i386.md        | 2 +-
 gcc/config/i386/sync.md        | 4 ++--
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 36011cc6b355..0de0e8427314 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -13738,13 +13738,13 @@ ix86_expand_builtin (tree exp, rtx target, rtx 
subtarget,
 
     case IX86_BUILTIN_LDMXCSR:
       op0 = expand_normal (CALL_EXPR_ARG (exp, 0));
-      target = assign_386_stack_local (SImode, SLOT_TEMP);
+      target = assign_stack_temp (SImode, GET_MODE_SIZE (SImode));
       emit_move_insn (target, op0);
       emit_insn (gen_sse_ldmxcsr (target));
       return 0;
 
     case IX86_BUILTIN_STMXCSR:
-      target = assign_386_stack_local (SImode, SLOT_TEMP);
+      target = assign_stack_temp (SImode, GET_MODE_SIZE (SImode));
       emit_insn (gen_sse_stmxcsr (target));
       return copy_to_mode_reg (SImode, target);
 
@@ -25743,7 +25743,7 @@ ix86_expand_divmod_libfunc (rtx libfunc, machine_mode 
mode,
                            rtx op0, rtx op1,
                            rtx *quot_p, rtx *rem_p)
 {
-  rtx rem = assign_386_stack_local (mode, SLOT_TEMP);
+  rtx rem = assign_stack_temp (mode, GET_MODE_SIZE (mode));
 
   rtx quot = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
                                      mode, op0, mode, op1, mode,
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 2dcd8803a08e..51934400951f 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2539,8 +2539,7 @@ enum ix86_fpcmp_strategy {
 
 enum ix86_stack_slot
 {
-  SLOT_TEMP = 0,
-  SLOT_CW_STORED,
+  SLOT_CW_STORED = 0,
   SLOT_CW_ROUNDEVEN,
   SLOT_CW_TRUNC,
   SLOT_CW_FLOOR,
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index e4d1c56ea542..fb6aaa815056 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -6282,7 +6282,7 @@
     {
       emit_insn (gen_floatunssi<mode>2_i387_with_xmm
                  (operands[0], operands[1],
-                  assign_386_stack_local (DImode, SLOT_TEMP)));
+                  assign_stack_temp (DImode, GET_MODE_SIZE (DImode))));
       DONE;
     }
   if (!TARGET_AVX512F)
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md
index f2b3ba0aa7aa..f03d418c3692 100644
--- a/gcc/config/i386/sync.md
+++ b/gcc/config/i386/sync.md
@@ -170,7 +170,7 @@
   if (<MODE>mode == DImode && !TARGET_64BIT)
     emit_insn (gen_atomic_loaddi_fpu
               (operands[0], operands[1],
-               assign_386_stack_local (DImode, SLOT_TEMP)));
+               assign_stack_temp (DImode, GET_MODE_SIZE (DImode))));
   else
     {
       rtx dst = operands[0];
@@ -251,7 +251,7 @@
         out to be significantly larger than this plus a barrier.  */
       emit_insn (gen_atomic_storedi_fpu
                 (operands[0], operands[1],
-                 assign_386_stack_local (DImode, SLOT_TEMP)));
+                 assign_stack_temp (DImode, GET_MODE_SIZE (DImode))));
     }
   else
     {

Reply via email to