aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2018-04-10 23:37:34 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2018-04-10 23:37:34 +0200
commit7321063d6150b5d31bff38347dc8ec9f3dcd9c0b (patch)
tree3fcdfb0d30170016776f29fe2331eed98e2dff2c
parent0359465c703ad3c214c52c772557ef1b3fe52183 (diff)
downloadgcc-7321063d6150b5d31bff38347dc8ec9f3dcd9c0b.zip
gcc-7321063d6150b5d31bff38347dc8ec9f3dcd9c0b.tar.gz
gcc-7321063d6150b5d31bff38347dc8ec9f3dcd9c0b.tar.bz2
rs6000: Fix stack clash for big residuals (PR85287)
The stack clash protection code had a logic error in how it decided whether to put the final update size in a register, or to emit it directly in an insn. This fixes it. It also tidies some surrounding code. PR target/85287 * gcc/config/rs6000/rs6000.md (allocate_stack): Put the residual size for stack clash protection in a register whenever we need it to be in a register. From-SVN: r259299
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rs6000/rs6000.md10
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2031dc7..480af2a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2018-04-10 Segher Boessenkool <segher@kernel.crashing.org>
+ * gcc/config/rs6000/rs6000.md (allocate_stack): Put the residual size
+ for stack clash protection in a register whenever we need it to be in
+ a register.
+
+2018-04-10 Segher Boessenkool <segher@kernel.crashing.org>
+
* common/config/rs6000/rs6000-common.c (rs6000_option_init_struct):
Enable -fasynchronous-unwind-tables by default if OBJECT_FORMAT_ELF.
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index d08e232..b07e5bd2 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -9783,14 +9783,12 @@
/* Now handle residuals. We just have to set operands[1] correctly
and let the rest of the expander run. */
operands[1] = residual;
- if (!CONST_INT_P (residual))
- operands[1] = force_reg (Pmode, operands[1]);
}
- if (GET_CODE (operands[1]) != CONST_INT
- || INTVAL (operands[1]) < -32767
- || INTVAL (operands[1]) > 32768)
+ if (!(CONST_INT_P (operands[1])
+ && IN_RANGE (INTVAL (operands[1]), -32767, 32768)))
{
+ operands[1] = force_reg (Pmode, operands[1]);
neg_op0 = gen_reg_rtx (Pmode);
if (TARGET_32BIT)
emit_insn (gen_negsi2 (neg_op0, operands[1]));
@@ -9798,7 +9796,7 @@
emit_insn (gen_negdi2 (neg_op0, operands[1]));
}
else
- neg_op0 = GEN_INT (- INTVAL (operands[1]));
+ neg_op0 = GEN_INT (-INTVAL (operands[1]));
insn = emit_insn ((* ((TARGET_32BIT) ? gen_movsi_update_stack
: gen_movdi_di_update_stack))