summaryrefslogtreecommitdiff
path: root/test/passes/ssa-nomerge_enable-simd.wast
blob: da44b57aee69d77bc92206c72da0d36daae0b501 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
(module
  (memory 1 1)
  (global $global$0 (mut i32) (i32.const 1))
  (func $basics (param $x i32)
    (local $y i32)
    (local $z f32)
    (local $w i64)
    (local $t f64)
    (drop (local.get $x)) ;; keep as param get
    (drop (local.get $y)) ;; turn into get of 0-init
    (drop (local.get $z))
    (drop (local.get $w))
    (drop (local.get $t))
    (local.set $x (i32.const 100)) ;; overwrite param
    (drop (local.get $x)) ;; no longer a param!
    (local.set $t (f64.const 2)) ;; overwrite local
    (drop (local.get $t))
    (local.set $t (f64.const 33)) ;; overwrite local AGAIN
    (drop (local.get $t))
    (drop (local.get $t)) ;; use twice
  )
  (func $if (param $p i32)
    (local $x i32)
    (local $y i32)
    (drop
      (if (result i32)
        (i32.const 1)
        (then
          (local.get $x)
        )
        (else
          (local.get $y)
        )
      )
    )
    (if
      (i32.const 1)
      (then
        (local.set $x (i32.const 1))
      )
    )
    (drop (local.get $x))
    ;; same but with param
    (if
      (i32.const 1)
      (then
        (local.set $p (i32.const 1))
      )
    )
    (drop (local.get $p))
    ;; if-else
    (if
      (i32.const 1)
      (then
        (local.set $x (i32.const 2))
      )
      (else
        (nop)
      )
    )
    (drop (local.get $x))
    (if
      (i32.const 1)
      (then
        (nop)
      )
      (else
        (local.set $x (i32.const 3))
      )
    )
    (drop (local.get $x))
    (if
      (i32.const 1)
      (then
        (local.set $x (i32.const 4))
      )
      (else
        (local.set $x (i32.const 5))
      )
    )
    (drop (local.get $x))
    (if
      (i32.const 1)
      (then
        (local.set $x (i32.const 6))
      )
      (else
        (block
          (local.set $x (i32.const 7))
          (local.set $x (i32.const 8))
        )
      )
    )
    (drop (local.get $x))
  )
  (func $if2 (param $x i32)
    (if
      (i32.const 1)
      (then
        (block
          (local.set $x (i32.const 1))
          (drop (local.get $x)) ;; use between phi set and use
        )
      )
    )
    (drop (local.get $x))
  )
  (func $nomerge (param $p i32) (param $q i32)
    (local $x i32)
    (local.set $x (i32.const 1)) ;; untangle this
    (call $nomerge (local.get $x) (local.get $x))
    (local.set $x (i32.const 2)) ;; and this
    (call $nomerge (local.get $x) (local.get $x))
    (local.set $x (i32.const 3)) ;; but this reaches a merge later
    (call $nomerge (local.get $x) (local.get $x))
    (if (i32.const 1)
      (then
        (local.set $x (i32.const 4))
      )
    )
    (call $nomerge (local.get $x) (local.get $x))
    (local.set $x (i32.const 5)) ;; this is good again
    (call $nomerge (local.get $x) (local.get $x))
    (if (i32.const 1)
      (then
        (local.set $x (i32.const 6)) ;; these merge,
      )
      (else
        (local.set $x (i32.const 7)) ;; so no
      )
    )
    (call $nomerge (local.get $x) (local.get $x))
  )
  (func $simd-zero
   (local $0 v128)
   (v128.store align=4
    (i32.const 0)
    (local.get $0)
   )
   (unreachable)
  )
)