diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/OptimizeInstructions.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp index 1f65ae609..36d92e81f 100644 --- a/src/passes/OptimizeInstructions.cpp +++ b/src/passes/OptimizeInstructions.cpp @@ -330,6 +330,18 @@ struct OptimizeInstructions return un; } } + { + // i32.eqz(i32.wrap_i64(x)) => i64.eqz(x) + // where maxBits(x) <= 32 + Unary* inner; + Expression* x; + if (matches(curr, unary(EqZInt32, unary(&inner, WrapInt64, any(&x)))) && + Bits::getMaxBits(x, this) <= 32) { + inner->op = EqZInt64; + inner->value = x; + return inner; + } + } } if (auto* select = curr->dynCast<Select>()) { |