[PATCH] D112754: X86: Fold masked merge pattern when and-not is not available
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 8 09:12:02 PST 2021
spatel added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:46412
+ SDValue N0 = Node->getOperand(0);
+ if (N0->getOpcode() != ISD::AND)
+ return SDValue();
----------------
I suspect we want to avoid this transform if either operand has more than one use. Please add tests with something like this:
```
define i32 @masked_merge0_extra_use(i32 %a0, i32 %a1, i32 %a2, i32* %p1) {
%and0 = and i32 %a0, %a1
%not = xor i32 %a0, -1
%and1 = and i32 %not, %a2
store i32 %and1, i32* %p1 ; extra use of intermediate op
%or = or i32 %and0, %and1
ret i32 %or
}
```
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:46527
+ // We should fold "masked merge" patterns when `andn` is not avilable.
+ if (!Subtarget.hasBMI() && VT.isScalarInteger() && VT != MVT::i1) {
----------------
typo: available
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112754/new/
https://reviews.llvm.org/D112754
More information about the llvm-commits
mailing list