[llvm] [AArch64][GlobalISel] Add lowering for constant BIT/BIF/BSP (PR #65897)
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 10 07:55:50 PDT 2023
================
@@ -338,6 +338,50 @@ void applySplitStoreZero128(MachineInstr &MI, MachineRegisterInfo &MRI,
Store.eraseFromParent();
}
+bool matchOrToBSP(MachineInstr &MI, MachineRegisterInfo &MRI,
+ std::tuple<Register, Register, Register> &MatchInfo) {
+ const LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
+ if (!DstTy.isVector())
+ return false;
+
+ MachineInstr *LHS =
+ getOpcodeDef(TargetOpcode::G_AND, MI.getOperand(1).getReg(), MRI);
+ MachineInstr *RHS =
+ getOpcodeDef(TargetOpcode::G_AND, MI.getOperand(2).getReg(), MRI);
+ if (!LHS || !RHS)
+ return false;
+
+ auto *BV1 = getOpcodeDef<GBuildVector>(LHS->getOperand(2).getReg(), MRI);
+ auto *BV2 = getOpcodeDef<GBuildVector>(RHS->getOperand(2).getReg(), MRI);
+ if (!BV1 || !BV2)
+ return false;
----------------
aemerson wrote:
At least some of this could be done with `mi_match()`? Not a big deal either way.
https://github.com/llvm/llvm-project/pull/65897
More information about the llvm-commits
mailing list