[PATCH] D118094: [InstCombine] Implementing (x & y) + ~(x | y) -> ~(x ^ y)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 26 05:19:09 PST 2022


RKSimon added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/pr53357.ll:61
+  ret i32 %7
+}
----------------
For examples (the undef version is an alternative you could use occasionally to show the NOT matching still works):
```
define <2 x i32> @src4_vec(<2 x i32> %0, <2 x i32> %1) {
  %3 = xor <2 x i32> %0, <i32 -1, i32 -1>
  %4 = xor <2 x i32> %1, <i32 -1, i32 -1>
  %5 = and <2 x i32> %3, %4
  %6 = and <2 x i32> %1, %0
  %7 = add <2 x i32> %5, %6
  ret <2 x i32> %7
}

define <2 x i32> @src4_vec_undef(<2 x i32> %0, <2 x i32> %1) {
  %3 = xor <2 x i32> %0, <i32 -1, i32 undef>
  %4 = xor <2 x i32> %1, <i32 -1, i32 -1>
  %5 = and <2 x i32> %3, %4
  %6 = and <2 x i32> %1, %0
  %7 = add <2 x i32> %5, %6
  ret <2 x i32> %7
}
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118094/new/

https://reviews.llvm.org/D118094



More information about the llvm-commits mailing list