summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2017-11-28 01:13:40 +0000
committerDan Gohman <dan433584@gmail.com>2017-11-28 01:13:40 +0000
commitcdd48b8a6b08a1feb6acbc407b5735ed7e7dfead (patch)
tree97d0addeb2e51638441aca7ff7b3d4045d31ea68 /llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h
parent9e3381e8dc447c936834cf291162a52cace2a517 (diff)
downloadbcm5719-llvm-cdd48b8a6b08a1feb6acbc407b5735ed7e7dfead.tar.gz
bcm5719-llvm-cdd48b8a6b08a1feb6acbc407b5735ed7e7dfead.zip
[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
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h2
1 files changed, 2 insertions, 0 deletions
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.
OpenPOWER on IntegriCloud