[llvm] [PowerPC] Enable custom lowering for bswap64 builtin on Power8 64 bits with improved parallelism (PR #187259)
Aditi Medhane via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 23:15:00 PDT 2026
================
@@ -11622,6 +11623,46 @@ SDValue PPCTargetLowering::LowerBSWAP(SDValue Op, SelectionDAG &DAG) const {
SDLoc dl(Op);
if (!Subtarget.isPPC64())
return Op;
+
+ // Apply the optimization to Power8 and 64-bits which allows parallelism for
+ // rotate instructions which should make the bswap64 builtin faster.
+ if (!Subtarget.hasP9Vector()) {
+ SDValue Input = Op.getOperand(0);
+
+ auto Swap32 = [&](SDValue Val32) -> SDValue {
+ SDValue Rot = DAG.getNode(ISD::ROTL, dl, MVT::i32, Val32,
+ DAG.getConstant(8, dl, MVT::i32));
+ SDValue Swap =
----------------
AditiRM wrote:
write lambda function for this specific utility
https://github.com/llvm/llvm-project/pull/187259
More information about the llvm-commits
mailing list