summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2018-10-25 19:06:13 +0000
committerThomas Lively <tlively@google.com>2018-10-25 19:06:13 +0000
commit0aad98fd07ae8b554fd75e335a21ccb0b1615c9b (patch)
tree576e7f619f6545f6215dfe040d4d686a63a24eab /llvm/lib
parent19a8adc9bd2785698c1d5429503fd406d95b6c53 (diff)
downloadbcm5719-llvm-0aad98fd07ae8b554fd75e335a21ccb0b1615c9b.tar.gz
bcm5719-llvm-0aad98fd07ae8b554fd75e335a21ccb0b1615c9b.zip
[WebAssembly] Use target-independent saturating add
Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D53721 llvm-svn: 345299
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp6
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td4
2 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 0bd2ebdc4bb..c056e1af588 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -115,6 +115,12 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
setTruncStoreAction(T, MVT::f16, Expand);
}
+ // Support saturating add for i8x16 and i16x8
+ if (Subtarget->hasSIMD128())
+ for (auto T : {MVT::v16i8, MVT::v8i16})
+ for (auto Op : {ISD::SADDSAT, ISD::UADDSAT})
+ setOperationAction(Op, T, Legal);
+
for (auto T : {MVT::i32, MVT::i64}) {
// Expand unavailable integer operations.
for (auto Op :
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
index ff6bbab705c..caad638e9e3 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
@@ -469,9 +469,9 @@ multiclass SIMDBinarySat<SDNode node, string name, bits<32> baseInst> {
// Saturating integer addition: add_saturate_s / add_saturate_u
let isCommutable = 1 in {
defm ADD_SAT_S :
- SIMDBinarySat<int_wasm_add_saturate_signed, "add_saturate_s", 40>;
+ SIMDBinarySat<saddsat, "add_saturate_s", 40>;
defm ADD_SAT_U :
- SIMDBinarySat<int_wasm_add_saturate_unsigned, "add_saturate_u", 41>;
+ SIMDBinarySat<uaddsat, "add_saturate_u", 41>;
} // isCommutable = 1
// Saturating integer subtraction: sub_saturate_s / sub_saturate_u
OpenPOWER on IntegriCloud