[llvm] [VP] IR expansion for bitreverse/bswap (PR #68504)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 8 02:09:27 PDT 2023
================
@@ -702,7 +702,17 @@ Value *CachingVPExpander::expandPredication(VPIntrinsic &VPI) {
case Intrinsic::vp_fneg: {
Value *NewNegOp = Builder.CreateFNeg(VPI.getOperand(0), VPI.getName());
replaceOperation(*NewNegOp, VPI);
- return NewNegOp;
+ return NewNegOp;
+ }
+ case Intrinsic::vp_bswap:
+ case Intrinsic::vp_bitreverse: {
+ Value *Op = VPI.getOperand(0);
+ Function *Fn = Intrinsic::getDeclaration(
+ VPI.getModule(), VPI.getFunctionalIntrinsicID().value(),
+ {VPI.getType()});
+ Value *NewOp = Builder.CreateCall(Fn, {Op}, VPI.getName());
+ replaceOperation(*NewOp, VPI);
+ return NewOp;
----------------
RKSimon wrote:
Maybe worth moving this to expandPredicationToIntCall and adding unary handling?
https://github.com/llvm/llvm-project/pull/68504
More information about the llvm-commits
mailing list