* [committed] testsuite: Add testcase coverage for already fixed [PR96671]
@ 2021-01-15 18:29 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-01-15 18:29 UTC (permalink / raw)
To: gcc-patches
Hi!
The fix for this PR didn't come with any test coverage, I've added
tests that make sure we optimize it no matter what order of the x ^ y ^ z
operands is used.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/96671
* gcc.dg/tree-ssa/pr96671-1.c: New test.
* gcc.dg/tree-ssa/pr96671-2.c: New test.
--- gcc/testsuite/gcc.dg/tree-ssa/pr96671-1.c.jj 2021-01-15 14:44:54.694936995 +0100
+++ gcc/testsuite/gcc.dg/tree-ssa/pr96671-1.c 2021-01-15 14:45:40.248419337 +0100
@@ -0,0 +1,51 @@
+/* PR tree-optimization/96671 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times " \\^ " 6 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " ~" 6 "optimized" } } */
+/* { dg-final { scan-tree-dump-times " & " 6 "optimized" } } */
+
+int
+foo (int a, int b, int c)
+{
+ return (a ^ b) & ((b ^ c) ^ a);
+}
+
+int
+bar (int a, int b, int c)
+{
+ return (a ^ b) & ((b ^ a) ^ c);
+}
+
+int
+baz (int a, int b, int c)
+{
+ return (a ^ b) & ((a ^ c) ^ b);
+}
+
+int
+qux (int a, int b, int c)
+{
+ int d = a ^ b;
+ int e = b ^ c;
+ int f = e ^ a;
+ return d & f;
+}
+
+int
+corge (int a, int b, int c)
+{
+ int d = a ^ b;
+ int e = b ^ a;
+ int f = c ^ e;
+ return d & f;
+}
+
+int
+garply (int a, int b, int c)
+{
+ int d = a ^ b;
+ int e = a ^ c;
+ int f = b ^ e;
+ return d & f;
+}
--- gcc/testsuite/gcc.dg/tree-ssa/pr96671-2.c.jj 2021-01-15 14:44:57.665903235 +0100
+++ gcc/testsuite/gcc.dg/tree-ssa/pr96671-2.c 2021-01-15 14:45:49.565313469 +0100
@@ -0,0 +1,51 @@
+/* PR tree-optimization/96671 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times " \\^ " 6 "optimized" } } */
+/* { dg-final { scan-tree-dump-not " ~" "optimized" } } */
+/* { dg-final { scan-tree-dump-times " \\| " 6 "optimized" } } */
+
+int
+foo (int a, int b, int c)
+{
+ return (a ^ b) | ((b ^ c) ^ a);
+}
+
+int
+bar (int a, int b, int c)
+{
+ return (a ^ b) | ((b ^ a) ^ c);
+}
+
+int
+baz (int a, int b, int c)
+{
+ return (a ^ b) | ((a ^ c) ^ b);
+}
+
+int
+qux (int a, int b, int c)
+{
+ int d = a ^ b;
+ int e = b ^ c;
+ int f = e ^ a;
+ return d | f;
+}
+
+int
+corge (int a, int b, int c)
+{
+ int d = a ^ b;
+ int e = b ^ a;
+ int f = c ^ e;
+ return d | f;
+}
+
+int
+garply (int a, int b, int c)
+{
+ int d = a ^ b;
+ int e = a ^ c;
+ int f = b ^ e;
+ return d | f;
+}
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-15 18:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 18:29 [committed] testsuite: Add testcase coverage for already fixed [PR96671] Jakub Jelinek
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).