summaryrefslogtreecommitdiff
path: root/test/passes/avoid-reinterprets.wast
blob: 068df437cd4dc1f5a87752fc77479a572af09fd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(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)))
  )
  (func $partial1 (result f32)
   (f32.reinterpret_i32
    (i32.load16_u
     (i32.const 3)
    )
   )
  )
  (func $partial2 (result f32)
   (f32.reinterpret_i32
    (i32.load8_u
     (i32.const 3)
    )
   )
  )
  (func $nofallthrough
    (local $x i32)
    (local.set $x
     (i32.load
      (i32.const 1024)
     )
    )
    (drop
     (f32.reinterpret_i32
      (block (result i32)
       (nop) ;; this would be removed by other opts, but in general, we can't
             ;; just look at the fallthrough, as we can't just remove code here
       (local.get $x)
      )
     )
    )
  )
)