diff options
author | LiqinWeng <liqin.weng@spacemit.com> | 2023-10-09 19:59:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 19:59:52 +0800 |
commit | 111c7c1d072ccfe0799787436f4fb72cbd2bc61c (patch) | |
tree | d098ec79c9cd3e6bd62f738f893a594c0d0f1e7b /llvm/lib/CodeGen/ExpandVectorPredication.cpp | |
parent | 60f7aa1a6ccb4214aec8838096abbdc1b37169a5 (diff) | |
download | llvm-111c7c1d072ccfe0799787436f4fb72cbd2bc61c.zip llvm-111c7c1d072ccfe0799787436f4fb72cbd2bc61c.tar.gz llvm-111c7c1d072ccfe0799787436f4fb72cbd2bc61c.tar.bz2 |
[VP] IR expansion for bitreverse/bswap (#68504)
Diffstat (limited to 'llvm/lib/CodeGen/ExpandVectorPredication.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ExpandVectorPredication.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ExpandVectorPredication.cpp b/llvm/lib/CodeGen/ExpandVectorPredication.cpp index 53f4b39..2d4da33 100644 --- a/llvm/lib/CodeGen/ExpandVectorPredication.cpp +++ b/llvm/lib/CodeGen/ExpandVectorPredication.cpp @@ -299,6 +299,15 @@ Value *CachingVPExpander::expandPredicationToIntCall( replaceOperation(*NewOp, VPI); return NewOp; } + case Intrinsic::bswap: + case Intrinsic::bitreverse: { + Value *Op = VPI.getOperand(0); + Function *Fn = Intrinsic::getDeclaration( + VPI.getModule(), UnpredicatedIntrinsicID, {VPI.getType()}); + Value *NewOp = Builder.CreateCall(Fn, {Op}, VPI.getName()); + replaceOperation(*NewOp, VPI); + return NewOp; + } } return nullptr; } @@ -702,13 +711,15 @@ 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_abs: case Intrinsic::vp_smax: case Intrinsic::vp_smin: case Intrinsic::vp_umax: case Intrinsic::vp_umin: + case Intrinsic::vp_bswap: + case Intrinsic::vp_bitreverse: return expandPredicationToIntCall(Builder, VPI, VPI.getFunctionalIntrinsicID().value()); case Intrinsic::vp_fabs: |