summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/feature-options.h15
-rw-r--r--src/tools/fuzzing.h6
-rw-r--r--src/tools/wasm-ctor-eval.cpp4
-rw-r--r--src/tools/wasm-reduce.cpp2
4 files changed, 20 insertions, 7 deletions
diff --git a/src/tools/feature-options.h b/src/tools/feature-options.h
index 3b35656fc..1bd78d9b9 100644
--- a/src/tools/feature-options.h
+++ b/src/tools/feature-options.h
@@ -70,7 +70,20 @@ struct FeatureOptions : public Options {
Options::Arguments::Zero,
[this](Options *o, const std::string& arguments) {
passOptions.features.setTruncSat(false);
- });
+ })
+ .add("--enable-simd", "",
+ "Enable nontrapping float-to-int operations",
+ Options::Arguments::Zero,
+ [this](Options *o, const std::string& arguments) {
+ passOptions.features.setSIMD();
+ })
+ .add("--disable-simd", "",
+ "Disable nontrapping float-to-int operations",
+ Options::Arguments::Zero,
+ [this](Options *o, const std::string& arguments) {
+ passOptions.features.setSIMD(false);
+ })
+ ;
}
FeatureSet getFeatures() const {
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index dcb47529f..999325baa 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -1268,10 +1268,10 @@ private:
}
// tweak around special values
if (oneIn(3)) { // +- 1
- value = value.add(LiteralUtils::makeLiteralFromInt32(upTo(3) - 1, type));
+ value = value.add(Literal::makeFromInt32(upTo(3) - 1, type));
}
if (oneIn(2)) { // flip sign
- value = value.mul(LiteralUtils::makeLiteralFromInt32(-1, type));
+ value = value.mul(Literal::makeFromInt32(-1, type));
}
break;
}
@@ -1288,7 +1288,7 @@ private:
}
// maybe negative
if (oneIn(2)) {
- value = value.mul(LiteralUtils::makeLiteralFromInt32(-1, type));
+ value = value.mul(Literal::makeFromInt32(-1, type));
}
}
}
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp
index b0e2e2ce7..4a7ca51b7 100644
--- a/src/tools/wasm-ctor-eval.cpp
+++ b/src/tools/wasm-ctor-eval.cpp
@@ -195,12 +195,12 @@ struct CtorEvalExternalInterface : EvallingModuleInstance::ExternalInterface {
// fill in fake values for everything else, which is dangerous to use
ModuleUtils::iterDefinedGlobals(wasm_, [&](Global* defined) {
if (globals.find(defined->name) == globals.end()) {
- globals[defined->name] = LiteralUtils::makeLiteralZero(defined->type);
+ globals[defined->name] = Literal::makeZero(defined->type);
}
});
ModuleUtils::iterImportedGlobals(wasm_, [&](Global* import) {
if (globals.find(import->name) == globals.end()) {
- globals[import->name] = LiteralUtils::makeLiteralZero(import->type);
+ globals[import->name] = Literal::makeZero(import->type);
}
});
}
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 8c5df7a1b..02174bb8a 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -839,7 +839,7 @@ struct Reducer : public WalkerPass<PostWalker<Reducer, UnifiedExpressionVisitor<
// try to replace with a trivial value
Const* c = builder->makeConst(Literal(int32_t(0)));
if (tryToReplaceCurrent(c)) return true;
- c->value = LiteralUtils::makeLiteralFromInt32(1, curr->type);
+ c->value = Literal::makeFromInt32(1, curr->type);
c->type = curr->type;
return tryToReplaceCurrent(c);
}