diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt index e08702b91f6..da218cd0524 100644 --- a/test/passes/optimize-instructions_all-features.txt +++ b/test/passes/optimize-instructions_all-features.txt @@ -12,6 +12,7 @@ (type $i32_i64_f32_f64_=>_none (func (param i32 i64 f32 f64))) (type $i32_i32_f64_f64_=>_none (func (param i32 i32 f64 f64))) (type $i32_i64_f64_i32_=>_none (func (param i32 i64 f64 i32))) + (type $f64_f32_=>_none (func (param f64 f32))) (type $none_=>_f64 (func (result f64))) (type $none_=>_externref (func (result externref))) (memory $0 0) @@ -3727,6 +3728,36 @@ ) ) ) + (func $optimize-float-mul-by-two (param $0 f64) (param $1 f32) + (drop + (f64.add + (local.get $0) + (local.get $0) + ) + ) + (drop + (f32.add + (local.get $1) + (local.get $1) + ) + ) + (drop + (f64.mul + (call $tee-with-unreachable-value) + (f64.const 2) + ) + ) + (drop + (f64.add + (f64.neg + (local.get $0) + ) + (f64.neg + (local.get $0) + ) + ) + ) + ) ) (module (type $none_=>_none (func)) diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast index 2790cc9eafd..48a9bfa3d5f 100644 --- a/test/passes/optimize-instructions_all-features.wast +++ b/test/passes/optimize-instructions_all-features.wast @@ -4233,6 +4233,25 @@ ) )) ) + (func $optimize-float-mul-by-two (param $0 f64) (param $1 f32) + (drop (f64.mul + (local.get $0) + (f64.const 2) + )) + (drop (f32.mul + (local.get $1) + (f32.const 2) + )) + + (drop (f64.mul + (call $tee-with-unreachable-value) ;; side effect + (f64.const 2) + )) + (drop (f64.mul + (f64.neg (local.get $0)) ;; complex expression + (f64.const 2) + )) + ) ) (module (import "env" "memory" (memory $0 (shared 256 256)))