From c705e5a3f446c1885f402514a2944cbd5e2e2ea6 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Tue, 31 Oct 2017 10:49:40 +0100 Subject: [PATCH] Subject: [PATCH] rs6000: Fix crash with big stack clash interval (PR82674) 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 | 8 +++++++- gcc/config/rs6000/rs6000.md | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 363922b..4216b94 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,8 +1,14 @@ +2017-10-31 Segher Boessenkool + + 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 * gcc/Makefile.in (FLAGS_TO_PASS): Pass libsubdir as well. -2017-11-01 Julia Koval +2017-10-31 Julia Koval * config.gcc: Add gfniintrin.h. * config/i386/gfniintrin.h: New. diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 62bd19b..18ebe8f 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10333,6 +10333,9 @@ { 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); @@ -10340,13 +10343,11 @@ 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); } -- 2.7.4