[llvm] 13015eb - [AMDGPU] Factor out predicate FmaakFmamkF32Insts

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 12:29:24 PDT 2021


Author: Stanislav Mekhanoshin
Date: 2021-04-15T12:29:16-07:00
New Revision: 13015ebd6f568f98e9b908564195f03f8f0d02a9

URL: https://github.com/llvm/llvm-project/commit/13015ebd6f568f98e9b908564195f03f8f0d02a9
DIFF: https://github.com/llvm/llvm-project/commit/13015ebd6f568f98e9b908564195f03f8f0d02a9.diff

LOG: [AMDGPU] Factor out predicate FmaakFmamkF32Insts

Differential Revision: https://reviews.llvm.org/D100409

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPU.td
    llvm/lib/Target/AMDGPU/GCNSubtarget.h
    llvm/lib/Target/AMDGPU/VOP2Instructions.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 11c1b22a2a72..d08efec787e9 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -1321,6 +1321,10 @@ def Has64BitDPP : Predicate<"Subtarget->has64BitDPP()">,
 def HasPackedFP32Ops : Predicate<"Subtarget->hasPackedFP32Ops()">,
   AssemblerPredicate<(all_of FeaturePackedFP32Ops)>;
 
+def HasFmaakFmamkF32Insts :
+  Predicate<"Subtarget->hasFmaakFmamkF32Insts()">,
+  AssemblerPredicate<(any_of FeatureGFX10Insts)>;
+
 def HasExtendedImageInsts : Predicate<"Subtarget->hasExtendedImageInsts()">,
   AssemblerPredicate<(all_of FeatureExtendedImageInsts)>;
 

diff  --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 415b1cb4854b..00ea653cb710 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -838,6 +838,10 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo,
     return HasPackedFP32Ops;
   }
 
+  bool hasFmaakFmamkF32Insts() const {
+    return getGeneration() >= GFX10;
+  }
+
   bool hasExtendedImageInsts() const {
     return HasExtendedImageInsts;
   }

diff  --git a/llvm/lib/Target/AMDGPU/VOP2Instructions.td b/llvm/lib/Target/AMDGPU/VOP2Instructions.td
index e24c2c2b0e98..76da6dc92f47 100644
--- a/llvm/lib/Target/AMDGPU/VOP2Instructions.td
+++ b/llvm/lib/Target/AMDGPU/VOP2Instructions.td
@@ -749,17 +749,21 @@ let AddedComplexity = 30 in {
   }
 } // End AddedComplexity = 30
 
+let SubtargetPredicate = HasFmaakFmamkF32Insts in {
+def V_FMAMK_F32 : VOP2_Pseudo<"v_fmamk_f32", VOP_MADMK_F32, [], "">;
+
+let isCommutable = 1 in
+def V_FMAAK_F32 : VOP2_Pseudo<"v_fmaak_f32", VOP_MADAK_F32, [], "">;
+}
+
 let SubtargetPredicate = isGFX10Plus in {
 
-def V_FMAMK_F32 : VOP2_Pseudo<"v_fmamk_f32", VOP_MADMK_F32, [], "">;
-let FPDPRounding = 1 in
+let FPDPRounding = 1 in {
 def V_FMAMK_F16 : VOP2_Pseudo <"v_fmamk_f16", VOP_MADMK_F16, [], "">;
 
-let isCommutable = 1 in {
-def V_FMAAK_F32 : VOP2_Pseudo<"v_fmaak_f32", VOP_MADAK_F32, [], "">;
-let FPDPRounding = 1 in
+let isCommutable = 1 in
 def V_FMAAK_F16 : VOP2_Pseudo <"v_fmaak_f16", VOP_MADAK_F16, [], "">;
-} // End isCommutable = 1
+} // End FPDPRounding  = 1
 
 let Constraints = "$vdst = $src2",
     DisableEncoding="$src2",


        


More information about the llvm-commits mailing list