]> granicus.if.org Git - clang/commitdiff
[WebAssembly] Add target flags for sign-ext opcodes.
authorDan Gohman <dan433584@gmail.com>
Fri, 19 Jan 2018 17:16:32 +0000 (17:16 +0000)
committerDan Gohman <dan433584@gmail.com>
Fri, 19 Jan 2018 17:16:32 +0000 (17:16 +0000)
Add -msign-ext and -mno-sign-ext to control the new sign-ext target
feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322967 91177308-0d34-0410-b5e6-96231b3b80d8

docs/ClangCommandLineReference.rst
include/clang/Driver/Options.td
lib/Basic/Targets/WebAssembly.cpp
lib/Basic/Targets/WebAssembly.h

index 782d225dce12509e45232fea320a320dc4480f74..1cbb3b8dc695902f7dc67fb0eca28ebd0d32f780 100644 (file)
@@ -2320,6 +2320,8 @@ WebAssembly
 -----------
 .. option:: -mnontrapping-fptoint, -mno-nontrapping-fptoint
 
+.. option:: -msign-ext, -mno-sign-ext
+
 .. option:: -msimd128, -mno-simd128
 
 X86
index 821837d5e649744af4d94186e36a287e24ac84f1..128960382e8b2faea834e645413058df7b913fa4 100644 (file)
@@ -1870,6 +1870,8 @@ def msimd128 : Flag<["-"], "msimd128">, Group<m_wasm_Features_Group>;
 def mno_simd128 : Flag<["-"], "mno-simd128">, Group<m_wasm_Features_Group>;
 def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group<m_wasm_Features_Group>;
 def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group<m_wasm_Features_Group>;
+def msign_ext : Flag<["-"], "msign-ext">, Group<m_wasm_Features_Group>;
+def mno_sign_ext : Flag<["-"], "mno-sign-ext">, Group<m_wasm_Features_Group>;
 
 def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
   Flags<[HelpHidden]>,
index 915aad4b563b43a4b1968d94aaf3185f0bd17dd9..ecccb588659588496753de516cfa0c130c8ff11b 100644 (file)
@@ -33,6 +33,7 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
   return llvm::StringSwitch<bool>(Feature)
       .Case("simd128", SIMDLevel >= SIMD128)
       .Case("nontrapping-fptoint", HasNontrappingFPToInt)
+      .Case("sign-ext", HasSignExt)
       .Default(false);
 }
 
@@ -70,6 +71,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
       HasNontrappingFPToInt = false;
       continue;
     }
+    if (Feature == "+sign-ext") {
+      HasSignExt = true;
+      continue;
+    }
+    if (Feature == "-sign-ext") {
+      HasSignExt = false;
+      continue;
+    }
 
     Diags.Report(diag::err_opt_not_valid_with_opt)
         << Feature << "-target-feature";
index ee0073d081e0a9a09dd10054848c64bc8cc7a476..b07e849949ece20b23a330164fbcac330cb84759 100644 (file)
@@ -31,10 +31,12 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
   } SIMDLevel;
 
   bool HasNontrappingFPToInt;
+  bool HasSignExt;
 
 public:
   explicit WebAssemblyTargetInfo(const llvm::Triple &T, const TargetOptions &)
-      : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false) {
+      : TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false),
+        HasSignExt(false) {
     NoAsmVariants = true;
     SuitableAlign = 128;
     LargeArrayMinWidth = 128;
@@ -60,6 +62,7 @@ private:
     if (CPU == "bleeding-edge") {
       Features["simd128"] = true;
       Features["nontrapping-fptoint"] = true;
+      Features["sign-ext"] = true;
     }
     return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
   }