[llvm] [X86] Invert (and X, ~(and ~Y, Z)) back into (and X, (or Y, ~Z)) (PR #109215)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 06:42:46 PDT 2024
================
@@ -50034,6 +50034,32 @@ static bool hasBZHI(const X86Subtarget &Subtarget, MVT VT) {
(VT == MVT::i32 || (VT == MVT::i64 && Subtarget.is64Bit()));
}
+/// InstCombine converts:
+/// `(and X, ~(and ~Y, Z))`
+/// to
+/// `(and X, (or Y, ~Z))`
+///
+/// But we should undo this transformation if the `andn` instruction is
+/// available to us.
----------------
RKSimon wrote:
Better to rephrase this in explicit terms of what this fold does:
```
Folds (and X, (or Y, ~Z)) --> (and X, ~(and ~Y, Z))
This undoes the inverse fold performed in InstCombine
```
https://github.com/llvm/llvm-project/pull/109215
More information about the llvm-commits
mailing list