[llvm] [X86][ISel] Improve logic for optimizing `movmsk(bitcast(shuffle(x)))` (PR #68369)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 09:47:01 PDT 2023
================
@@ -45836,18 +45836,52 @@ static SDValue combineSetCCMOVMSK(SDValue EFLAGS, X86::CondCode &CC,
// MOVMSK(SHUFFLE(X,u)) -> MOVMSK(X) iff every element is referenced.
SmallVector<int, 32> ShuffleMask;
SmallVector<SDValue, 2> ShuffleInputs;
+ SDValue BaseVec = peekThroughBitcasts(Vec);
if (NumElts <= CmpBits &&
- getTargetShuffleInputs(peekThroughBitcasts(Vec), ShuffleInputs,
- ShuffleMask, DAG) &&
+ getTargetShuffleInputs(BaseVec, ShuffleInputs, ShuffleMask, DAG) &&
ShuffleInputs.size() == 1 && !isAnyZeroOrUndef(ShuffleMask) &&
ShuffleInputs[0].getValueSizeInBits() == VecVT.getSizeInBits()) {
----------------
goldsteinn wrote:
There are alot of ways to fix this. Posting V2 that I think is the most precise version. If you still have reservations can give this a try.
https://github.com/llvm/llvm-project/pull/68369
More information about the llvm-commits
mailing list