[llvm] 7ab9478 - [RISCV] Make Zvfh depend on Zfhmin.

Jianjian GUAN via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 18:46:26 PDT 2023


Author: Jianjian GUAN
Date: 2023-05-10T09:46:19+08:00
New Revision: 7ab9478560abb0750bc1f4c1bc8ca0462b0a2fef

URL: https://github.com/llvm/llvm-project/commit/7ab9478560abb0750bc1f4c1bc8ca0462b0a2fef
DIFF: https://github.com/llvm/llvm-project/commit/7ab9478560abb0750bc1f4c1bc8ca0462b0a2fef.diff

LOG: [RISCV] Make Zvfh depend on Zfhmin.

According to the v spec, the Zvfh extension depends on the Zve32f and Zfhmin extensions.

Reviewed By: craig.topper

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

Added: 
    

Modified: 
    llvm/lib/Support/RISCVISAInfo.cpp
    llvm/lib/Target/RISCV/RISCVFeatures.td
    llvm/lib/Target/RISCV/RISCVSubtarget.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 63d84256b87e6..3fe19fe71809a 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -866,11 +866,6 @@ Error RISCVISAInfo::checkDependency() {
     return createStringError(errc::invalid_argument,
                              "'f' and 'zfinx' extensions are incompatible");
 
-  if (Exts.count("zvfh") && !Exts.count("zfh") && !Exts.count("zfhmin"))
-    return createStringError(
-        errc::invalid_argument,
-        "'zvfh' requires 'zfh' or 'zfhmin extension to also be specified");
-
   if (HasZvl && !HasVector)
     return createStringError(
         errc::invalid_argument,
@@ -941,7 +936,7 @@ static const char *ImpliedExtsZve32x[] = {"zvl32b", "zicsr"};
 static const char *ImpliedExtsZve64d[] = {"zve64f", "d"};
 static const char *ImpliedExtsZve64f[] = {"zve64x", "zve32f"};
 static const char *ImpliedExtsZve64x[] = {"zve32x", "zvl64b"};
-static const char *ImpliedExtsZvfh[] = {"zve32f"};
+static const char *ImpliedExtsZvfh[] = {"zve32f", "zfhmin"};
 static const char *ImpliedExtsZvkn[] = {"zvbb", "zvbc", "zvkned", "zvknhb",
                                         "zvkt"};
 static const char *ImpliedExtsZvkng[] = {"zvkg", "zvkn"};

diff  --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td
index 602ebeaf29b9b..f7ee09146d83a 100644
--- a/llvm/lib/Target/RISCV/RISCVFeatures.td
+++ b/llvm/lib/Target/RISCV/RISCVFeatures.td
@@ -449,7 +449,7 @@ def HasVInstructionsAnyF : Predicate<"Subtarget->hasVInstructionsAnyF()">,
 def FeatureStdExtZvfh
     : SubtargetFeature<"experimental-zvfh", "HasStdExtZvfh", "true",
                        "'Zvfh' (Vector Half-Precision Floating-Point)",
-                       [FeatureStdExtZve32f]>;
+                       [FeatureStdExtZve32f, FeatureStdExtZfhmin]>;
 
 def HasStdExtZfhOrZvfh
     : Predicate<"Subtarget->hasStdExtZfh() || Subtarget->hasStdExtZvfh()">,

diff  --git a/llvm/lib/Target/RISCV/RISCVSubtarget.h b/llvm/lib/Target/RISCV/RISCVSubtarget.h
index 576b185e74730..84ff17896671a 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -151,9 +151,7 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {
   // Vector codegen related methods.
   bool hasVInstructions() const { return HasStdExtZve32x; }
   bool hasVInstructionsI64() const { return HasStdExtZve64x; }
-  bool hasVInstructionsF16() const {
-    return HasStdExtZvfh && hasStdExtZfhOrZfhmin();
-  }
+  bool hasVInstructionsF16() const { return HasStdExtZvfh; }
   // FIXME: Consider Zfinx in the future
   bool hasVInstructionsF32() const { return HasStdExtZve32f && HasStdExtF; }
   // FIXME: Consider Zdinx in the future


        


More information about the llvm-commits mailing list