aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2019-10-26 18:38:59 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2019-10-26 18:38:59 +0200
commit26bd2dab50817184b73cea1034d7e60d55def70d (patch)
tree0285a6a3a25735d8c81fb0d31a0147d48a5d70d0
parent8bbf3dea78325c39d7750e815024eef960415592 (diff)
downloadgcc-26bd2dab50817184b73cea1034d7e60d55def70d.zip
gcc-26bd2dab50817184b73cea1034d7e60d55def70d.tar.gz
gcc-26bd2dab50817184b73cea1034d7e60d55def70d.tar.bz2
rs6000: Fix allocate_stack in a corner case (PR91289)
When we have -fstack-limit-symbol with sysv we can end up with a non- existing instruction (you cannot add an immediate to register 0). Fix this by using register 11 instead. It might be used for something else already though, so save and restore its value around this. In optimizing compiles these extra moves are usually removed again: the restore by cprop_hardreg, and then the save by rtl_dce. PR target/91289 * config/rs6000/rs6000-logue.c (rs6000_emit_allocate_stack): Don't add an immediate to r0; use r11 instead. Save and restore r11 to r0 around this. From-SVN: r277472
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/rs6000/rs6000-logue.c12
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3dc1b7c..de55e1a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2019-10-26 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/91289
+ * config/rs6000/rs6000-logue.c (rs6000_emit_allocate_stack): Don't add
+ an immediate to r0; use r11 instead. Save and restore r11 to r0 around
+ this.
+
2019-10-26 Hongtao Liu <hongtao.liu@intel.com>
* config/i386/sse.md
diff --git a/gcc/config/rs6000/rs6000-logue.c b/gcc/config/rs6000/rs6000-logue.c
index e98893a..04aae80 100644
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -1700,10 +1700,14 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, rtx copy_reg, int copy_off)
stack_limit_rtx,
GEN_INT (size)));
- emit_insn (gen_elf_high (tmp_reg, toload));
- emit_insn (gen_elf_low (tmp_reg, tmp_reg, toload));
- emit_insn (gen_cond_trap (LTU, stack_reg, tmp_reg,
- const0_rtx));
+ /* We cannot use r0 with elf_low. Lamely solve this problem by
+ moving registers around. */
+ rtx r11_reg = gen_rtx_REG (Pmode, 11);
+ emit_move_insn (tmp_reg, r11_reg);
+ emit_insn (gen_elf_high (r11_reg, toload));
+ emit_insn (gen_elf_low (r11_reg, r11_reg, toload));
+ emit_insn (gen_cond_trap (LTU, stack_reg, r11_reg, const0_rtx));
+ emit_move_insn (r11_reg, tmp_reg);
}
else
warning (0, "stack limit expression is not supported");