[llvm] [AMDGPU][True16][MC] true16 for v_fma_f16 (PR #119477)

Brox Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 12:48:32 PST 2024


================
@@ -4033,14 +4033,15 @@ MachineInstr *SIInstrInfo::convertToThreeAddress(MachineInstr &MI,
   if (Src0Literal && !ST.hasVOP3Literal())
     return nullptr;
 
-  unsigned NewOpc = IsFMA ? IsF16 ? AMDGPU::V_FMA_F16_gfx9_e64
-                                  : IsF64 ? AMDGPU::V_FMA_F64_e64
-                                          : IsLegacy
-                                                ? AMDGPU::V_FMA_LEGACY_F32_e64
-                                                : AMDGPU::V_FMA_F32_e64
-                          : IsF16 ? AMDGPU::V_MAD_F16_e64
-                                  : IsLegacy ? AMDGPU::V_MAD_LEGACY_F32_e64
-                                             : AMDGPU::V_MAD_F32_e64;
+  unsigned NewOpc = IsFMA      ? IsF16      ? ST.hasTrue16BitInsts()
+                                                  ? AMDGPU::V_FMA_F16_gfx9_fake16_e64
+                                                  : AMDGPU::V_FMA_F16_gfx9_e64
+                                 : IsF64    ? AMDGPU::V_FMA_F64_e64
+                                 : IsLegacy ? AMDGPU::V_FMA_LEGACY_F32_e64
+                                            : AMDGPU::V_FMA_F32_e64
+                    : IsF16    ? AMDGPU::V_MAD_F16_e64
+                    : IsLegacy ? AMDGPU::V_MAD_LEGACY_F32_e64
+                               : AMDGPU::V_MAD_F32_e64;
----------------
broxigarchen wrote:

Updated to a lambda. What do you think?

https://github.com/llvm/llvm-project/pull/119477


More information about the llvm-commits mailing list