diff options
Diffstat (limited to 'test/passes')
-rw-r--r-- | test/passes/avoid-reinterprets.txt | 151 | ||||
-rw-r--r-- | test/passes/avoid-reinterprets.wast | 38 |
2 files changed, 189 insertions, 0 deletions
diff --git a/test/passes/avoid-reinterprets.txt b/test/passes/avoid-reinterprets.txt new file mode 100644 index 000000000..f78c6443b --- /dev/null +++ b/test/passes/avoid-reinterprets.txt @@ -0,0 +1,151 @@ +(module + (type $0 (func)) + (memory $0 1) + (func $simple (; 0 ;) (type $0) + (drop + (f32.load + (i32.const 1024) + ) + ) + (drop + (i32.load + (i32.const 1024) + ) + ) + (drop + (f64.load + (i32.const 1024) + ) + ) + (drop + (i64.load + (i32.const 1024) + ) + ) + ) + (func $one (; 1 ;) (type $0) + (local $x i32) + (local $1 i32) + (local $2 f32) + (local.set $x + (block (result i32) + (local.set $1 + (i32.const 1024) + ) + (local.set $2 + (f32.load + (local.get $1) + ) + ) + (i32.load + (local.get $1) + ) + ) + ) + (drop + (local.get $2) + ) + ) + (func $one-b (; 2 ;) (type $0) + (local $x f32) + (local $1 i32) + (local $2 i32) + (local.set $x + (block (result f32) + (local.set $1 + (i32.const 1024) + ) + (local.set $2 + (i32.load + (local.get $1) + ) + ) + (f32.load + (local.get $1) + ) + ) + ) + (drop + (local.get $2) + ) + ) + (func $both (; 3 ;) (type $0) + (local $x i32) + (local $1 i32) + (local $2 f32) + (local.set $x + (block (result i32) + (local.set $1 + (i32.const 1024) + ) + (local.set $2 + (f32.load + (local.get $1) + ) + ) + (i32.load + (local.get $1) + ) + ) + ) + (drop + (local.get $2) + ) + (drop + (local.get $2) + ) + ) + (func $half (; 4 ;) (type $0) + (local $x i32) + (local $1 i32) + (local $2 f32) + (local.set $x + (block (result i32) + (local.set $1 + (i32.const 1024) + ) + (local.set $2 + (f32.load + (local.get $1) + ) + ) + (i32.load + (local.get $1) + ) + ) + ) + (drop + (local.get $x) + ) + (drop + (local.get $2) + ) + ) + (func $copy (; 5 ;) (type $0) + (local $x i32) + (local $y i32) + (local $2 i32) + (local $3 f32) + (local.set $x + (block (result i32) + (local.set $2 + (i32.const 1024) + ) + (local.set $3 + (f32.load + (local.get $2) + ) + ) + (i32.load + (local.get $2) + ) + ) + ) + (local.set $y + (local.get $x) + ) + (drop + (local.get $3) + ) + ) +) diff --git a/test/passes/avoid-reinterprets.wast b/test/passes/avoid-reinterprets.wast new file mode 100644 index 000000000..1499f8356 --- /dev/null +++ b/test/passes/avoid-reinterprets.wast @@ -0,0 +1,38 @@ +(module + (memory 1) + (func $simple + (drop (f32.reinterpret_i32 (i32.load (i32.const 1024)))) + (drop (i32.reinterpret_f32 (f32.load (i32.const 1024)))) + (drop (f64.reinterpret_i64 (i64.load (i32.const 1024)))) + (drop (i64.reinterpret_f64 (f64.load (i32.const 1024)))) + ) + (func $one + (local $x i32) + (local.set $x (i32.load (i32.const 1024))) + (drop (f32.reinterpret_i32 (local.get $x))) + ) + (func $one-b + (local $x f32) + (local.set $x (f32.load (i32.const 1024))) + (drop (i32.reinterpret_f32 (local.get $x))) + ) + (func $both + (local $x i32) + (local.set $x (i32.load (i32.const 1024))) + (drop (f32.reinterpret_i32 (local.get $x))) + (drop (f32.reinterpret_i32 (local.get $x))) + ) + (func $half + (local $x i32) + (local.set $x (i32.load (i32.const 1024))) + (drop (local.get $x)) + (drop (f32.reinterpret_i32 (local.get $x))) + ) + (func $copy + (local $x i32) + (local $y i32) + (local.set $x (i32.load (i32.const 1024))) + (local.set $y (local.get $x)) + (drop (f32.reinterpret_i32 (local.get $y))) + ) +) |