r322967 - [WebAssembly] Add target flags for sign-ext opcodes.
Dan Gohman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 19 09:16:32 PST 2018
Author: djg
Date: Fri Jan 19 09:16:32 2018
New Revision: 322967
URL: http://llvm.org/viewvc/llvm-project?rev=322967&view=rev
Log:
[WebAssembly] Add target flags for sign-ext opcodes.
Add -msign-ext and -mno-sign-ext to control the new sign-ext target
feature.
Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
cfe/trunk/lib/Basic/Targets/WebAssembly.h
Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=322967&r1=322966&r2=322967&view=diff
==============================================================================
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Fri Jan 19 09:16:32 2018
@@ -2320,6 +2320,8 @@ WebAssembly
-----------
.. option:: -mnontrapping-fptoint, -mno-nontrapping-fptoint
+.. option:: -msign-ext, -mno-sign-ext
+
.. option:: -msimd128, -mno-simd128
X86
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=322967&r1=322966&r2=322967&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Jan 19 09:16:32 2018
@@ -1870,6 +1870,8 @@ def msimd128 : Flag<["-"], "msimd128">,
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]>,
Modified: cfe/trunk/lib/Basic/Targets/WebAssembly.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/WebAssembly.cpp?rev=322967&r1=322966&r2=322967&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/WebAssembly.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.cpp Fri Jan 19 09:16:32 2018
@@ -33,6 +33,7 @@ bool WebAssemblyTargetInfo::hasFeature(S
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::handleTarget
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";
Modified: cfe/trunk/lib/Basic/Targets/WebAssembly.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/WebAssembly.h?rev=322967&r1=322966&r2=322967&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/WebAssembly.h (original)
+++ cfe/trunk/lib/Basic/Targets/WebAssembly.h Fri Jan 19 09:16:32 2018
@@ -31,10 +31,12 @@ class LLVM_LIBRARY_VISIBILITY WebAssembl
} 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);
}
More information about the cfe-commits
mailing list