From: Jakub Jelinek Date: Tue, 19 Nov 2019 09:31:59 +0000 (+0100) Subject: re PR target/92549 (Use x86 xchg instruction more) X-Git-Tag: upstream/12.2.0~20208 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63b887119024128efaeb122193c935397c2572e9;p=platform%2Fupstream%2Fgcc.git re PR target/92549 (Use x86 xchg instruction more) PR target/92549 * config/i386/i386.md (peephole2 for *swap): New peephole2. * gcc.target/i386/pr92549.c: New test. From-SVN: r278439 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6560a39..df949f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2019-11-19 Jakub Jelinek + PR target/92549 + * config/i386/i386.md (peephole2 for *swap): New peephole2. + PR middle-end/91450 * internal-fn.c (expand_mul_overflow): For s1 * s2 -> ur, if one operand is negative and one non-negative, compare the non-negative diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index fb2235a..7ff5872 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2787,6 +2787,17 @@ (set_attr "amdfam10_decode" "double") (set_attr "bdver1_decode" "double")]) +(define_peephole2 + [(set (match_operand:SWI 0 "register_operand") + (match_operand:SWI 1 "register_operand")) + (set (match_dup 1) + (match_operand:SWI 2 "register_operand")) + (set (match_dup 2) (match_dup 0))] + "peep2_reg_dead_p (3, operands[0]) + && optimize_insn_for_size_p ()" + [(parallel [(set (match_dup 1) (match_dup 2)) + (set (match_dup 2) (match_dup 1))])]) + (define_expand "movstrict" [(set (strict_low_part (match_operand:SWI12 0 "register_operand")) (match_operand:SWI12 1 "general_operand"))] diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16a4106..51e8e1f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-11-19 Jakub Jelinek + PR target/92549 + * gcc.target/i386/pr92549.c: New test. + PR middle-end/91450 * gcc.c-torture/execute/pr91450-1.c: New test. * gcc.c-torture/execute/pr91450-2.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr92549.c b/gcc/testsuite/gcc.target/i386/pr92549.c new file mode 100644 index 0000000..c6c6bb8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr92549.c @@ -0,0 +1,17 @@ +/* PR target/92549 */ +/* { dg-do compile } */ +/* { dg-options "-Os -masm=att" } */ +/* { dg-additional-options "-mregparm=2" { target ia32 } } */ +/* { dg-final { scan-assembler "xchgl" } } */ + +__attribute__((noipa)) int +bar (int a, int b) +{ + return b - a + 5; +} + +int +foo (int a, int b) +{ + return 1 + bar (b, a); +}