[llvm] [AMDGPU][GlobalISel] Add RegBankLegalize support for G_AMDGPU_MAD_* (PR #176060)
Petar Avramovic via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 15 08:31:53 PST 2026
================
@@ -716,6 +717,131 @@ bool RegBankLegalizeHelper::lowerSplitTo16(MachineInstr &MI) {
return true;
}
+bool RegBankLegalizeHelper::lowerUniMAD64(MachineInstr &MI) {
+ Register Dst0 = MI.getOperand(0).getReg();
+ Register Dst1 = MI.getOperand(1).getReg();
+ Register Src0 = MI.getOperand(2).getReg();
+ Register Src1 = MI.getOperand(3).getReg();
+ Register Src2 = MI.getOperand(4).getReg();
+
+ bool IsUnsigned = MI.getOpcode() == AMDGPU::G_AMDGPU_MAD_U64_U32;
----------------
petar-avramovic wrote:
this one
```
define amdgpu_ps void @s_mul_u64_sext_with_sregs(ptr addrspace(1) %out, i32 %val) {
%ext = sext i32 %val to i64
%mul = mul i64 %ext, 80
store i64 %mul, ptr addrspace(1) %out, align 8
ret void
}
```
will result with signed v_mad_co_i64_i32 on gfx12+
for other missing cases it is probably best to deal with them after regbanklegalize and fold only for vgpr inputs
https://github.com/llvm/llvm-project/pull/176060
More information about the llvm-commits
mailing list