Navigation Menu

Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGraey committed Aug 2, 2020
1 parent 0951ba2 commit d5404b3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/passes/optimize-instructions_all-features.txt
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
19 changes: 19 additions & 0 deletions test/passes/optimize-instructions_all-features.wast
Expand Up @@ -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)))
Expand Down

0 comments on commit d5404b3

Please sign in to comment.