[llvm] [InstCombine] foldVecExtTruncToExtElt - extend to handle trunc(lshr(extractelement(x,c1),c2)) -> extractelement(bitcast(x),c3) patterns. (PR #109689)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 28 03:37:58 PDT 2024
================
@@ -469,10 +473,23 @@ static Instruction *foldVecExtTruncToExtElt(TruncInst &Trunc,
uint64_t BitCastNumElts = VecElts.getKnownMinValue() * TruncRatio;
uint64_t VecOpIdx = Cst->getZExtValue();
uint64_t NewIdx = IC.getDataLayout().isBigEndian()
- ? (VecOpIdx + 1) * TruncRatio - 1
+ ? (VecOpIdx * TruncRatio) + (TruncRatio - 1)
----------------
RKSimon wrote:
Yes, in an earlier draft I was trying to get the DAG/InstCombine implementations to match - I've undone the change
https://github.com/llvm/llvm-project/pull/109689
More information about the llvm-commits
mailing list