On Tue, 20 Oct 2015, Richard Biener wrote:
On Tue, Oct 20, 2015 at 8:46 AM, Hurugalawadi, Naveen
<naveen.hurugalaw...@caviumnetworks.com> wrote:
Hi,
+/* Fold X + (X / CST) * -CST to X % CST. */
This one is still wrong
Removed.
I don't understand the point of the FLOAT_TYPE_P check.
The check was there in fold-const. So, just had the same check.
Will we also simplify (A & B) - (A & ~B) into B - (A ^ B) ?
Done.
or maybe integer_all_onesp (const_binop (BIT_XOR_EXPR, type, @2, @1))
Done.
:c on bit_ior? It should also allow you to merge the 2 CST versions into one.
Had it. But due to the error on "logical_inverted_value"; confused it with
this pattern and had duplicated it.
I am not really in favor of the indentation change (or the comment).
Done.
This patch is ok when bootstrapped / tested and with a proper changelog entry.
Regression tested on X86_64 with no extra failures.
+(simplify
+ (minus (bit_and:s @0 INTEGER_CST@2) (bit_and:s @0 INTEGER_CST@1))
+ (if (integer_all_onesp (const_binop (BIT_XOR_EXPR, type, @2, @1)))
+ (minus (bit_xor @0 @1) @1)))
use if (wi::bit_and (@2, @1) == 0)
I believe the original transformation required @1 and @2 to be bit_not
of each other, so this might not work. He had a suitable test using wi,
it is my fault he changed it (sorry for not being clear enough that my
remark wasn't meant as a patch). The reason was so we could change
INTEGER_CST to CONSTANT_CLASS_P and handle vectors.
and instead of the 2nd group
+/* Fold (A & B) - (A & ~B) into B - (A ^ B). */
+(simplify
+ (minus (bit_and:s @0 @1) (bit_and:s @0 (bit_not @1)))
+ (minus @1 (bit_xor @0 @1)))
+(simplify
+ (minus (bit_and:s @0 INTEGER_CST@1) (bit_and:s @0 INTEGER_CST@2))
+ (if (integer_all_onesp (const_binop (BIT_XOR_EXPR, type, @2, @1)))
+ (minus @1 (bit_xor @0 @1))))
place a :c on the minus of the one not matching INTEGER_CSTs.
Will that really work?
--
Marc Glisse