[llvm] [AArch64][SVE] Combine UXT[BHW] intrinsics to AND. (PR #137956)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 05:32:26 PDT 2025
================
@@ -2640,6 +2640,28 @@ static std::optional<Instruction *> instCombinePTrue(InstCombiner &IC,
return std::nullopt;
}
+static std::optional<Instruction *> instCombineSVEUxt(InstCombiner &IC,
+ IntrinsicInst &II,
+ unsigned NumBits) {
+ Value *Passthru = II.getOperand(0);
+ Value *Pg = II.getOperand(1);
+ Value *Op = II.getOperand(2);
+
+ // Convert UXT[BHW] to AND.
+ if (isa<UndefValue>(Passthru) || isAllActivePredicate(Pg)) {
+ auto *Ty = cast<VectorType>(II.getType());
+ auto MaskValue = APInt::getLowBitsSet(Ty->getScalarSizeInBits(), NumBits);
+ auto *Mask = ConstantVector::getSplat(
+ Ty->getElementCount(),
+ ConstantInt::get(Ty->getElementType(), MaskValue));
----------------
paulwalker-arm wrote:
```suggestion
auto *Mask = ConstantInt::get(Ty, MaskValue);
```
https://github.com/llvm/llvm-project/pull/137956
More information about the llvm-commits
mailing list