[PATCH] Move ~X | X -> -1 folding
Marek Polacek
polacek@redhat.com
Tue Jun 30 11:06:00 GMT 2015
On Tue, Jun 30, 2015 at 12:22:57PM +0200, Bernhard Reutner-Fischer wrote:
> >+unsigned int
> >+fn3 (unsigned int x)
> >+{
> >+ return ~x | x;
> >+}
> >+
> >+unsigned int
> >+fn4 (unsigned int x)
> >+{
> >+ return ~x | x;
> >+}
>
> What's the difference between fn3 and fn4?
Oops, fixed.
2015-06-30 Marek Polacek <polacek@redhat.com>
* gcc.dg/fold-ior-2.c (fn4): Swap operands.
diff --git gcc/testsuite/gcc.dg/fold-ior-2.c gcc/testsuite/gcc.dg/fold-ior-2.c
index 6abac9e..41b372d 100644
--- gcc/testsuite/gcc.dg/fold-ior-2.c
+++ gcc/testsuite/gcc.dg/fold-ior-2.c
@@ -22,7 +22,7 @@ fn3 (unsigned int x)
unsigned int
fn4 (unsigned int x)
{
- return ~x | x;
+ return x | ~x;
}
int
Marek
More information about the Gcc-patches
mailing list