diff options
author | Bernd Schmidt <bernds@redhat.com> | 2016-04-15 13:35:12 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2016-04-15 13:35:12 +0000 |
commit | 10e547d6198f5eb70dba5c9e0d4b243704447d5b (patch) | |
tree | 478163cf1c70042b4249ec6e744a4e504dbaf05b | |
parent | 1e77281b13f7422dda5c2e9f2e72efc364a1d156 (diff) | |
download | gcc-10e547d6198f5eb70dba5c9e0d4b243704447d5b.zip gcc-10e547d6198f5eb70dba5c9e0d4b243704447d5b.tar.gz gcc-10e547d6198f5eb70dba5c9e0d4b243704447d5b.tar.bz2 |
i386: Don't convert stack operations to pushes if using a redzone.
* config/i386/i386-protos.h (ix86_using_red_zone): Declare.
* config/i386/i386.c (ix86_using_red_zone): No longer static.
* config/i386/i386.md (stack decrement to push peepholes): Guard
with !x86_using_red_zone ().
testsuite/
* gcc.target/i386/pr46470.c: Add -mno-red-zone to dg-options for
x86_64.
From-SVN: r235028
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/i386-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386.md | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr46470.c | 2 |
6 files changed, 24 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a63e32..92e2a83 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-04-15 Bernd Schmidt <bschmidt@redhat.com> + + * config/i386/i386-protos.h (ix86_using_red_zone): Declare. + * config/i386/i386.c (ix86_using_red_zone): No longer static. + * config/i386/i386.md (stack decrement to push peepholes): Guard + with !x86_using_red_zone (). + 2016-04-15 Jakub Jelinek <jakub@redhat.com> PR c++/70675 diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index e4652f3..ff47bc1 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -44,6 +44,8 @@ extern bool ix86_use_pseudo_pic_reg (void); extern void ix86_reset_previous_fndecl (void); +extern bool ix86_using_red_zone (void); + #ifdef RTX_CODE extern int standard_80387_constant_p (rtx); extern const char *standard_80387_constant_opcode (rtx); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1fa007e..3d044e8 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3709,7 +3709,7 @@ make_pass_stv (gcc::context *ctxt) /* Return true if a red-zone is in use. */ -static inline bool +bool ix86_using_red_zone (void) { return TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI; diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 56a3050..cf29e5d 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -18240,7 +18240,8 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode) + && !ix86_using_red_zone ()" [(clobber (match_dup 1)) (parallel [(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) (clobber (mem:BLK (scratch)))])]) @@ -18253,7 +18254,8 @@ (clobber (reg:CC FLAGS_REG)) (clobber (mem:BLK (scratch)))])] "(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode) + && !ix86_using_red_zone ()" [(clobber (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) (parallel [(set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) @@ -18267,7 +18269,8 @@ (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] "(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == -GET_MODE_SIZE (word_mode) + && !ix86_using_red_zone ()" [(clobber (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1))]) @@ -18278,7 +18281,8 @@ (match_operand:P 0 "const_int_operand"))) (clobber (reg:CC FLAGS_REG))])] "(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) - && INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode)" + && INTVAL (operands[0]) == -2*GET_MODE_SIZE (word_mode) + && !ix86_using_red_zone ()" [(clobber (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1)) (set (mem:W (pre_dec:P (reg:P SP_REG))) (match_dup 1))]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b395d9..61c8f12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-15 Bernd Schmidt <bschmidt@redhat.com> + + * gcc.target/i386/pr46470.c: Add -mno-red-zone to dg-options for + x86_64. + 2016-04-15 Marek Polacek <polacek@redhat.com> PR c/70651 diff --git a/gcc/testsuite/gcc.target/i386/pr46470.c b/gcc/testsuite/gcc.target/i386/pr46470.c index 11eb51a..8d6b5ca 100644 --- a/gcc/testsuite/gcc.target/i386/pr46470.c +++ b/gcc/testsuite/gcc.target/i386/pr46470.c @@ -4,7 +4,7 @@ /* These options are selected to ensure 1 word needs to be allocated on the stack to maintain alignment for the call. This should be transformed to push+pop. We also want to force unwind info updates. */ -/* { dg-options "-Os -fomit-frame-pointer -fasynchronous-unwind-tables" } */ +/* { dg-options "-Os -fomit-frame-pointer -fasynchronous-unwind-tables -mno-red-zone" } */ /* { dg-options "-Os -fomit-frame-pointer -mpreferred-stack-boundary=3 -fasynchronous-unwind-tables" { target ia32 } } */ /* ms_abi has reserved stack-region. */ /* { dg-skip-if "" { x86_64-*-mingw* } { "*" } { "" } } */ |