From cdd48b8a6b08a1feb6acbc407b5735ed7e7dfead Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 28 Nov 2017 01:13:40 +0000 Subject: [WebAssembly] Fix trapping behavior in fptosi/fptoui. This adds code to protect WebAssembly's `trunc_s` family of opcodes from values outside their domain. Even though such conversions have full undefined behavior in C/C++, LLVM IR's `fptosi` and `fptoui` do not, and only return undef. This also implements the proposed non-trapping float-to-int conversion feature and uses that instead when available. llvm-svn: 319128 --- llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h') diff --git a/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h b/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h index 8ca04543d5e..a6bf0b6d54f 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h @@ -31,6 +31,7 @@ namespace llvm { class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo { bool HasSIMD128; bool HasAtomics; + bool HasNontrappingFPToInt; /// String name of used CPU. std::string CPUString; @@ -76,6 +77,7 @@ public: bool hasAddr64() const { return TargetTriple.isArch64Bit(); } bool hasSIMD128() const { return HasSIMD128; } bool hasAtomics() const { return HasAtomics; } + bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; } /// Parses features string setting specified subtarget options. Definition of /// function is auto generated by tblgen. -- cgit v1.2.3