public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Uros Bizjak <uros@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2787] i386: Fix conditional move reg-to-reg move elimination peepholes [PR101797] Date: Fri, 6 Aug 2021 12:22:32 +0000 (GMT) [thread overview] Message-ID: <20210806122232.B8E05396BC04@sourceware.org> (raw) https://gcc.gnu.org/g:cd04e829c3ae244abd711e2597f8b72d6c58c713 commit r12-2787-gcd04e829c3ae244abd711e2597f8b72d6c58c713 Author: Uros Bizjak <ubizjak@gmail.com> Date: Fri Aug 6 14:21:27 2021 +0200 i386: Fix conditional move reg-to-reg move elimination peepholes [PR101797] Add missing operand predicate, otherwise any RTX will match. 2021-08-06 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/101797 * config/i386/i386.md (cmove reg-to-reg move elimination peephole2s): Add general_gr_operand predicate to operand 3. gcc/testsuite/ PR target/101797 * gcc.target/i386/pr101797.c: New test. Diff: --- gcc/config/i386/i386.md | 4 ++-- gcc/testsuite/gcc.target/i386/pr101797.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 51e8b475bca..bc1c30b77f4 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -19428,7 +19428,7 @@ (parallel [(set (reg FLAGS_REG) (match_operand 5)) (set (match_dup 0) (match_operand:SWI248 6))]) (set (match_operand:SWI248 2 "general_reg_operand") - (match_operand:SWI248 3)) + (match_operand:SWI248 3 "general_gr_operand")) (set (match_dup 0) (if_then_else:SWI248 (match_operator 4 "ix86_comparison_operator" [(reg FLAGS_REG) (const_int 0)]) @@ -19456,7 +19456,7 @@ ;; mov r2,r3; mov r0,r1; dec r0; cmov r0,r2 -> dec r1; mov r0,r3; cmov r0, r1 (define_peephole2 [(set (match_operand:SWI248 2 "general_reg_operand") - (match_operand:SWI248 3)) + (match_operand:SWI248 3 "general_gr_operand")) (set (match_operand:SWI248 0 "general_reg_operand") (match_operand:SWI248 1 "general_reg_operand")) (parallel [(set (reg FLAGS_REG) (match_operand 5)) diff --git a/gcc/testsuite/gcc.target/i386/pr101797.c b/gcc/testsuite/gcc.target/i386/pr101797.c new file mode 100644 index 00000000000..d5cc34e54a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr101797.c @@ -0,0 +1,15 @@ +/* PR target/101797 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int a; +int main() { + int b, c, d, e = 0; + if (a) { + c += a; + e = ~(a % c); + e || c || (b & d); + } + a = e; + return 0; +}
reply other threads:[~2021-08-06 12:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210806122232.B8E05396BC04@sourceware.org \ --to=uros@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).