public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "navidrahimi at microsoft dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103514] New: Missing XOR-EQ-AND Optimization Date: Wed, 01 Dec 2021 07:33:16 +0000 [thread overview] Message-ID: <bug-103514-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103514 Bug ID: 103514 Summary: Missing XOR-EQ-AND Optimization Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: navidrahimi at microsoft dot com Target Milestone: --- We are not optimizing &&-^-== combination, LLVM does it [1]: // Proof of correctness https://alive2.llvm.org/ce/z/a4tuWF bool src (bool a, bool b) { return (a && b) == (a ^ b); } bool tgt (bool a, bool b) { return !(a || b); } // Proof of correctness https://alive2.llvm.org/ce/z/w-iotd bool src (bool a, bool b) { return (a && b) ^ (a == b); } bool tgt (bool a, bool b) { return !(a || b); } I will be sending a patch for this. This will solve it, I have to run the testsuite and write a few tests: /* (a && b) first_op (a second_op b) -> !(a || b) */ (for first_op (bit_xor eq) (for second_op (bit_xor eq) (simplify (first_op:c (bit_and:c truth_valued_p@0 truth_valued_p@1) (second_op:c @0 @1)) (if (first_op != second_op) (bit_not (bit_ior @0 @1)))))) 1) https://compiler-explorer.com/z/WqTxYhG3s
next reply other threads:[~2021-12-01 7:33 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-01 7:33 navidrahimi at microsoft dot com [this message] 2021-12-01 7:38 ` [Bug tree-optimization/103514] " pinskia at gcc dot gnu.org 2021-12-01 7:44 ` navidrahimi at microsoft dot com 2021-12-01 10:13 ` rguenth at gcc dot gnu.org 2022-01-28 22:14 ` cvs-commit at gcc dot gnu.org 2022-01-28 22:16 ` navidr at gcc dot gnu.org 2022-01-31 9:32 ` cvs-commit at gcc dot gnu.org
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=bug-103514-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).