Commit 2ecf9ac7 by H.J. Lu Committed by H.J. Lu

i386: Check red zone size in push peephole2

Check red zone size, instead of if red zone is available, in push
peephole2s.

gcc/

	PR target/82499
	* config/i386/i386.h (ix86_red_zone_size): New.
	* config/i386/i386.md (push peephole2s): Replace
	"!ix86_using_red_zone ()" with "ix86_red_zone_size == 0".

gcc/testsuite/

	PR target/82499
	* gcc.target/i386/pr82499-1.c: New file.
	* gcc.target/i386/pr82499-2.c: Likewise.
	* gcc.target/i386/pr82499-3.c: Likewise.

From-SVN: r253718
parent 8649149a
2017-10-13 H.J. Lu <hongjiu.lu@intel.com>
PR target/82499
* config/i386/i386.h (ix86_red_zone_size): New.
* config/i386/i386.md (push peephole2s): Replace
"!ix86_using_red_zone ()" with "ix86_red_zone_size == 0".
2017-10-13 Richard Sandiford <richard.sandiford@linaro.org> 2017-10-13 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
...@@ -2603,6 +2603,7 @@ struct GTY(()) machine_function { ...@@ -2603,6 +2603,7 @@ struct GTY(()) machine_function {
#define ix86_current_function_calls_tls_descriptor \ #define ix86_current_function_calls_tls_descriptor \
(ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG)) (ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG))
#define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack) #define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack)
#define ix86_red_zone_size (cfun->machine->frame.red_zone_size)
/* Control behavior of x86_file_start. */ /* Control behavior of x86_file_start. */
#define X86_FILE_START_VERSION_DIRECTIVE false #define X86_FILE_START_VERSION_DIRECTIVE false
......
...@@ -18814,7 +18814,7 @@ ...@@ -18814,7 +18814,7 @@
(clobber (mem:BLK (scratch)))])] (clobber (mem:BLK (scratch)))])]
"(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) "(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 ()" && ix86_red_zone_size == 0"
[(clobber (match_dup 1)) [(clobber (match_dup 1))
(parallel [(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))
(clobber (mem:BLK (scratch)))])]) (clobber (mem:BLK (scratch)))])])
...@@ -18828,7 +18828,7 @@ ...@@ -18828,7 +18828,7 @@
(clobber (mem:BLK (scratch)))])] (clobber (mem:BLK (scratch)))])]
"(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) "(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 ()" && ix86_red_zone_size == 0"
[(clobber (match_dup 1)) [(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))
(parallel [(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))
...@@ -18843,7 +18843,7 @@ ...@@ -18843,7 +18843,7 @@
(clobber (reg:CC FLAGS_REG))])] (clobber (reg:CC FLAGS_REG))])]
"(TARGET_SINGLE_PUSH || optimize_insn_for_size_p ()) "(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 ()" && ix86_red_zone_size == 0"
[(clobber (match_dup 1)) [(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))])
...@@ -18855,7 +18855,7 @@ ...@@ -18855,7 +18855,7 @@
(clobber (reg:CC FLAGS_REG))])] (clobber (reg:CC FLAGS_REG))])]
"(TARGET_DOUBLE_PUSH || optimize_insn_for_size_p ()) "(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 ()" && ix86_red_zone_size == 0"
[(clobber (match_dup 1)) [(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))
(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))])
......
2017-10-13 H.J. Lu <hongjiu.lu@intel.com>
PR target/82499
* gcc.target/i386/pr82499-1.c: New file.
* gcc.target/i386/pr82499-2.c: Likewise.
* gcc.target/i386/pr82499-3.c: Likewise.
2017-10-13 Jakub Jelinek <jakub@redhat.com> 2017-10-13 Jakub Jelinek <jakub@redhat.com>
PR target/82524 PR target/82524
......
/* { dg-do compile } */
/* The pic register save adds unavoidable stack pointer references. */
/* { dg-skip-if "" { ia32 && { ! nonpic } } } */
/* 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-additional-options "-mpreferred-stack-boundary=3" { target ia32 } } */
/* { dg-additional-options "-mpreferred-stack-boundary=4" { target { ! ia32 } } } */
/* ms_abi has reserved stack-region. */
/* { dg-skip-if "" { x86_64-*-mingw* } } */
extern void g (void);
int
f (void)
{
g ();
return 42;
}
/* { dg-final { scan-assembler-not "(sub|add)(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */
/* { dg-do compile } */
/* The pic register save adds unavoidable stack pointer references. */
/* { dg-skip-if "" { ia32 && { ! nonpic } } } */
/* 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-additional-options "-mpreferred-stack-boundary=3" { target ia32 } } */
/* { dg-additional-options "-mpreferred-stack-boundary=4 -mno-red-zone" { target { ! ia32 } } } */
/* ms_abi has reserved stack-region. */
/* { dg-skip-if "" { x86_64-*-mingw* } } */
extern void g (void);
int
f (void)
{
g ();
return 42;
}
/* { dg-final { scan-assembler-not "(sub|add)(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */
/* { dg-do compile } */
/* The pic register save adds unavoidable stack pointer references. */
/* { dg-skip-if "" { ia32 && { ! nonpic } } } */
/* 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 "-O2 -mtune-ctrl=single_push,single_pop -fomit-frame-pointer -fasynchronous-unwind-tables" } */
/* { dg-additional-options "-mpreferred-stack-boundary=3" { target ia32 } } */
/* { dg-additional-options "-mpreferred-stack-boundary=4" { target { ! ia32 } } } */
/* ms_abi has reserved stack-region. */
/* { dg-skip-if "" { x86_64-*-mingw* } } */
extern void g (void);
int
f (void)
{
g ();
return 42;
}
/* { dg-final { scan-assembler-not "(sub|add)(l|q)\[\\t \]*\\$\[0-9\]*,\[\\t \]*%\[re\]?sp" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment