[WebAssembly][ConstantFolding] Fold fp-to-int truncation intrinsics
authorThomas Lively <tlively@google.com>
Mon, 10 Aug 2020 19:40:05 +0000 (12:40 -0700)
committerThomas Lively <tlively@google.com>
Mon, 10 Aug 2020 19:40:05 +0000 (12:40 -0700)
commit514445e0353e82fa0bd59eeea437499500e232cd
treeddcc9522eacf9205a8f671ff6a937ca96468db27
parentc0b5000bd848303320c03f80fbf84d71e74518c9
[WebAssembly][ConstantFolding] Fold fp-to-int truncation intrinsics

Constant fold both the trapping and saturating versions of the
WebAssembly truncation intrinsics. The tests are adapted from the
WebAssembly spec tests for the corresponding instructions.

Requested in PR46982.

Differential Revision: https://reviews.llvm.org/D85392
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/Analysis/ConstantFolding/WebAssembly/trunc.ll [new file with mode: 0644]
llvm/test/Analysis/ConstantFolding/WebAssembly/trunc_saturate.ll [new file with mode: 0644]