From 616abe47020c90278eaf8d14ae9815c31d2d14fb Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Wed, 5 Jun 2019 19:34:34 -0700 Subject: Use splatted zero vector in makeZero (#2164) This prevents the optimizer from producing v128.const instructions, which are not supported by V8 at this time. --- src/ir/literal-utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/ir/literal-utils.h b/src/ir/literal-utils.h index 543c34e9f..63a2b3b44 100644 --- a/src/ir/literal-utils.h +++ b/src/ir/literal-utils.h @@ -17,6 +17,7 @@ #ifndef wasm_ir_literal_utils_h #define wasm_ir_literal_utils_h +#include "wasm-builder.h" #include "wasm.h" namespace wasm { @@ -31,6 +32,13 @@ inline Expression* makeFromInt32(int32_t x, Type type, Module& wasm) { } inline Expression* makeZero(Type type, Module& wasm) { + // TODO: Switch to using v128.const once V8 supports it + // (https://bugs.chromium.org/p/v8/issues/detail?id=8460) + if (type == v128) { + Builder builder(wasm); + return builder.makeUnary(SplatVecI32x4, + builder.makeConst(Literal(int32_t(0)))); + } return makeFromInt32(0, type, wasm); } -- cgit v1.2.3