[llvm] [NVPTX] Add support for clamped funnel shift intrinsics (PR #113228)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 22:31:43 PDT 2024
================
@@ -384,6 +393,22 @@ static Instruction *simplifyNvvmIntrinsic(IntrinsicInst *II, InstCombiner &IC) {
return BinaryOperator::Create(
Instruction::FDiv, ConstantFP::get(II->getArgOperand(0)->getType(), 1),
II->getArgOperand(0), II->getName());
+
+ case SCP_FunnelShiftClamp: {
+ // Canoncialize a clamping funnel shift to the generic llvm funnel shift
+ // when possible, as this is easier for llvm to optimize further.
+ if (const auto *ShiftConst = dyn_cast<ConstantInt>(II->getArgOperand(2))) {
+ if (ShiftConst->getZExtValue() >= II->getType()->getIntegerBitWidth())
+ return IC.replaceInstUsesWith(*II, II->getArgOperand(1));
----------------
AlexMaclean wrote:
Fixed
https://github.com/llvm/llvm-project/pull/113228
More information about the llvm-commits
mailing list