Subject: [PATCH] rs6000: Fix crash with big stack clash interval (PR82674)
authorSegher Boessenkool <segher@gcc.gnu.org>
Tue, 31 Oct 2017 09:49:40 +0000 (10:49 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Tue, 31 Oct 2017 09:49:40 +0000 (10:49 +0100)
If the user asks for a stack clash probe interval of 64kB, we currently
generate a "stdu rX,-65536(r1)" instruction.  That instruction does not
exist (the offset is a 16-bit signed number).  If the offset is too big
we should force it into a register and generate a "stdux rX,rY,r1"
instruction, instead.

PR target/82674
* config/rs6000/rs6000.md (allocate_stack): Force update interval
into a register if it does not fit into an immediate offset field.

From-SVN: r254252

gcc/ChangeLog
gcc/config/rs6000/rs6000.md

index 363922b..4216b94 100644 (file)
@@ -1,8 +1,14 @@
+2017-10-31  Segher Boessenkool  <segher@kernel.crsahing.org>
+
+       PR target/82674
+       * config/rs6000/rs6000.md (allocate_stack): Force update interval
+       into a register if it does not fit into an immediate offset field.
+
 2017-10-31  Olivier Hainque  <hainque@adacore.com>
 
         * gcc/Makefile.in (FLAGS_TO_PASS): Pass libsubdir as well.
 
-2017-11-01  Julia Koval  <julia.koval@intel.com>
+2017-10-31  Julia Koval  <julia.koval@intel.com>
 
        * config.gcc: Add gfniintrin.h.
        * config/i386/gfniintrin.h: New.
index 62bd19b..18ebe8f 100644 (file)
        {
          rtx loop_lab, end_loop;
          bool rotated = CONST_INT_P (rounded_size);
+         rtx update = GEN_INT (-probe_interval);
+         if (probe_interval > 32768)
+           update = force_reg (Pmode, update);
 
          emit_stack_clash_protection_probe_loop_start (&loop_lab, &end_loop,
                                                        last_addr, rotated);
          if (Pmode == SImode)
            emit_insn (gen_movsi_update_stack (stack_pointer_rtx,
                                               stack_pointer_rtx,
-                                              GEN_INT (-probe_interval),
-                                              chain));
+                                              update, chain));
          else
            emit_insn (gen_movdi_di_update_stack (stack_pointer_rtx,
                                                  stack_pointer_rtx,
-                                                 GEN_INT (-probe_interval),
-                                                 chain));
+                                                 update, chain));
          emit_stack_clash_protection_probe_loop_end (loop_lab, end_loop,
                                                      last_addr, rotated);
        }