[llvm] [AMDGPU] Add CodeGen support for GFX12 s_mul_u64 (PR #75825)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 04:19:04 PST 2024
================
@@ -419,6 +427,32 @@ void AMDGPUPostLegalizerCombinerImpl::applyCombineSignExtendInReg(
MI.eraseFromParent();
}
+bool AMDGPUPostLegalizerCombinerImpl::matchCombine_s_mul_u64(
+ MachineInstr &MI, unsigned &NewOpcode) const {
+ Register Src0 = MI.getOperand(1).getReg();
+ Register Src1 = MI.getOperand(2).getReg();
+ if (MRI.getType(Src0) != LLT::scalar(64))
+ return false;
+
+ if (KB->getKnownBits(Src0).countMinLeadingZeros() >= 32 &&
+ KB->getKnownBits(Src1).countMinLeadingZeros() >= 32) {
+ NewOpcode = AMDGPU::G_AMDGPU_S_MUL_U64_U32;
+ return true;
+ }
+
+ if (KB->computeNumSignBits(Src0) >= 33 &&
+ KB->computeNumSignBits(Src1) >= 33) {
----------------
arsenm wrote:
Try Src1 first
https://github.com/llvm/llvm-project/pull/75825
More information about the llvm-commits
mailing list