[PATCH] D36505: [InstCombine] Make (X|C1)^C2 -> X^(C1^C2) iff X&~C1 == 0 work for splat vectors

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 09:25:23 PDT 2017


craig.topper added inline comments.


================
Comment at: test/Transforms/InstCombine/select-with-bitwise-ops.ll:271
 
 define <2 x i32> @test65vec(<2 x i64> %x) {
 ; CHECK-LABEL: @test65vec(
----------------
spatel wrote:
> Are we just changing the mask constant in these 3 tests to prove that MaskedValueIsZero() is working as expected? Might be more interesting to use a shift or zext to clear some bits instead?
These are all tests for select combines.

Test65 tests an and of a larger type with a power of 2 constant that fits in the smaller type. Until ver recently we tried to truncate first then shift. So it only worked for the smaller constant.
Test66 tests an and of a larger type with a power of 2 constant that does not fit in the smaller type. Until recently we punted this transform because we wanted to truncate first. But that would have cut off the constant.
Test67 tests an and of a smaller type with a power of 2 constant.

I don't think these tests were intentionally trying to test the xor combine we have here. It just happens that they trigger it. But the fact that they trigger it and the vector versions didn't is why I even noticed in the first place.


https://reviews.llvm.org/D36505





More information about the llvm-commits mailing list