[PATCH] D145221: [X86] Prefer `vpternlog` instead of `blendv` for `vselect` on masks.
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 3 09:12:42 PST 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1044
+ if (Subtarget->hasVLX() && Subtarget->hasAVX512() &&
+ N->getOperand(0)->getOpcode() == X86ISD::PCMPGT) {
+ R = CurDAG->getNode(X86ISD::VPTERNLOG, SDLoc(N), N->getValueType(0),
----------------
RKSimon wrote:
> craig.topper wrote:
> > Why is the PCMPGT check needed?
> Wouldn't a numsignbits check be better than PCMPGT?
> Why is the PCMPGT check needed?
`blendv` only uses the sign-bit of the control. For `vpternlog` to be a replacement, the control needs to be in mask form (elements either -1/0). `pcmpgt` is just a check for "is the control in mask form". Maybe `(sext (setcc ...))` would also work but didn't see any codegen changes from it.
================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1044
+ if (Subtarget->hasVLX() && Subtarget->hasAVX512() &&
+ N->getOperand(0)->getOpcode() == X86ISD::PCMPGT) {
+ R = CurDAG->getNode(X86ISD::VPTERNLOG, SDLoc(N), N->getValueType(0),
----------------
goldstein.w.n wrote:
> RKSimon wrote:
> > craig.topper wrote:
> > > Why is the PCMPGT check needed?
> > Wouldn't a numsignbits check be better than PCMPGT?
> > Why is the PCMPGT check needed?
>
> `blendv` only uses the sign-bit of the control. For `vpternlog` to be a replacement, the control needs to be in mask form (elements either -1/0). `pcmpgt` is just a check for "is the control in mask form". Maybe `(sext (setcc ...))` would also work but didn't see any codegen changes from it.
What is numsignbits check?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145221/new/
https://reviews.llvm.org/D145221
More information about the llvm-commits
mailing list