github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/spectest/threads/testdata/atomic.wast (about) 1 ;; atomic operations 2 3 (module 4 (memory 1 1 shared) 5 6 (func (export "init") (param $value i64) (i64.store (i32.const 0) (local.get $value))) 7 8 (func (export "i32.atomic.load") (param $addr i32) (result i32) (i32.atomic.load (local.get $addr))) 9 (func (export "i64.atomic.load") (param $addr i32) (result i64) (i64.atomic.load (local.get $addr))) 10 (func (export "i32.atomic.load8_u") (param $addr i32) (result i32) (i32.atomic.load8_u (local.get $addr))) 11 (func (export "i32.atomic.load16_u") (param $addr i32) (result i32) (i32.atomic.load16_u (local.get $addr))) 12 (func (export "i64.atomic.load8_u") (param $addr i32) (result i64) (i64.atomic.load8_u (local.get $addr))) 13 (func (export "i64.atomic.load16_u") (param $addr i32) (result i64) (i64.atomic.load16_u (local.get $addr))) 14 (func (export "i64.atomic.load32_u") (param $addr i32) (result i64) (i64.atomic.load32_u (local.get $addr))) 15 16 (func (export "i32.atomic.store") (param $addr i32) (param $value i32) (i32.atomic.store (local.get $addr) (local.get $value))) 17 (func (export "i64.atomic.store") (param $addr i32) (param $value i64) (i64.atomic.store (local.get $addr) (local.get $value))) 18 (func (export "i32.atomic.store8") (param $addr i32) (param $value i32) (i32.atomic.store8 (local.get $addr) (local.get $value))) 19 (func (export "i32.atomic.store16") (param $addr i32) (param $value i32) (i32.atomic.store16 (local.get $addr) (local.get $value))) 20 (func (export "i64.atomic.store8") (param $addr i32) (param $value i64) (i64.atomic.store8 (local.get $addr) (local.get $value))) 21 (func (export "i64.atomic.store16") (param $addr i32) (param $value i64) (i64.atomic.store16 (local.get $addr) (local.get $value))) 22 (func (export "i64.atomic.store32") (param $addr i32) (param $value i64) (i64.atomic.store32 (local.get $addr) (local.get $value))) 23 24 (func (export "i32.atomic.rmw.add") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw.add (local.get $addr) (local.get $value))) 25 (func (export "i64.atomic.rmw.add") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw.add (local.get $addr) (local.get $value))) 26 (func (export "i32.atomic.rmw8.add_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw8.add_u (local.get $addr) (local.get $value))) 27 (func (export "i32.atomic.rmw16.add_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw16.add_u (local.get $addr) (local.get $value))) 28 (func (export "i64.atomic.rmw8.add_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw8.add_u (local.get $addr) (local.get $value))) 29 (func (export "i64.atomic.rmw16.add_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw16.add_u (local.get $addr) (local.get $value))) 30 (func (export "i64.atomic.rmw32.add_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw32.add_u (local.get $addr) (local.get $value))) 31 32 (func (export "i32.atomic.rmw.sub") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw.sub (local.get $addr) (local.get $value))) 33 (func (export "i64.atomic.rmw.sub") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw.sub (local.get $addr) (local.get $value))) 34 (func (export "i32.atomic.rmw8.sub_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw8.sub_u (local.get $addr) (local.get $value))) 35 (func (export "i32.atomic.rmw16.sub_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw16.sub_u (local.get $addr) (local.get $value))) 36 (func (export "i64.atomic.rmw8.sub_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw8.sub_u (local.get $addr) (local.get $value))) 37 (func (export "i64.atomic.rmw16.sub_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw16.sub_u (local.get $addr) (local.get $value))) 38 (func (export "i64.atomic.rmw32.sub_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw32.sub_u (local.get $addr) (local.get $value))) 39 40 (func (export "i32.atomic.rmw.and") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw.and (local.get $addr) (local.get $value))) 41 (func (export "i64.atomic.rmw.and") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw.and (local.get $addr) (local.get $value))) 42 (func (export "i32.atomic.rmw8.and_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw8.and_u (local.get $addr) (local.get $value))) 43 (func (export "i32.atomic.rmw16.and_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw16.and_u (local.get $addr) (local.get $value))) 44 (func (export "i64.atomic.rmw8.and_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw8.and_u (local.get $addr) (local.get $value))) 45 (func (export "i64.atomic.rmw16.and_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw16.and_u (local.get $addr) (local.get $value))) 46 (func (export "i64.atomic.rmw32.and_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw32.and_u (local.get $addr) (local.get $value))) 47 48 (func (export "i32.atomic.rmw.or") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw.or (local.get $addr) (local.get $value))) 49 (func (export "i64.atomic.rmw.or") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw.or (local.get $addr) (local.get $value))) 50 (func (export "i32.atomic.rmw8.or_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw8.or_u (local.get $addr) (local.get $value))) 51 (func (export "i32.atomic.rmw16.or_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw16.or_u (local.get $addr) (local.get $value))) 52 (func (export "i64.atomic.rmw8.or_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw8.or_u (local.get $addr) (local.get $value))) 53 (func (export "i64.atomic.rmw16.or_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw16.or_u (local.get $addr) (local.get $value))) 54 (func (export "i64.atomic.rmw32.or_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw32.or_u (local.get $addr) (local.get $value))) 55 56 (func (export "i32.atomic.rmw.xor") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw.xor (local.get $addr) (local.get $value))) 57 (func (export "i64.atomic.rmw.xor") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw.xor (local.get $addr) (local.get $value))) 58 (func (export "i32.atomic.rmw8.xor_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw8.xor_u (local.get $addr) (local.get $value))) 59 (func (export "i32.atomic.rmw16.xor_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw16.xor_u (local.get $addr) (local.get $value))) 60 (func (export "i64.atomic.rmw8.xor_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw8.xor_u (local.get $addr) (local.get $value))) 61 (func (export "i64.atomic.rmw16.xor_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw16.xor_u (local.get $addr) (local.get $value))) 62 (func (export "i64.atomic.rmw32.xor_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw32.xor_u (local.get $addr) (local.get $value))) 63 64 (func (export "i32.atomic.rmw.xchg") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw.xchg (local.get $addr) (local.get $value))) 65 (func (export "i64.atomic.rmw.xchg") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw.xchg (local.get $addr) (local.get $value))) 66 (func (export "i32.atomic.rmw8.xchg_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw8.xchg_u (local.get $addr) (local.get $value))) 67 (func (export "i32.atomic.rmw16.xchg_u") (param $addr i32) (param $value i32) (result i32) (i32.atomic.rmw16.xchg_u (local.get $addr) (local.get $value))) 68 (func (export "i64.atomic.rmw8.xchg_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw8.xchg_u (local.get $addr) (local.get $value))) 69 (func (export "i64.atomic.rmw16.xchg_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw16.xchg_u (local.get $addr) (local.get $value))) 70 (func (export "i64.atomic.rmw32.xchg_u") (param $addr i32) (param $value i64) (result i64) (i64.atomic.rmw32.xchg_u (local.get $addr) (local.get $value))) 71 72 (func (export "i32.atomic.rmw.cmpxchg") (param $addr i32) (param $expected i32) (param $value i32) (result i32) (i32.atomic.rmw.cmpxchg (local.get $addr) (local.get $expected) (local.get $value))) 73 (func (export "i64.atomic.rmw.cmpxchg") (param $addr i32) (param $expected i64) (param $value i64) (result i64) (i64.atomic.rmw.cmpxchg (local.get $addr) (local.get $expected) (local.get $value))) 74 (func (export "i32.atomic.rmw8.cmpxchg_u") (param $addr i32) (param $expected i32) (param $value i32) (result i32) (i32.atomic.rmw8.cmpxchg_u (local.get $addr) (local.get $expected) (local.get $value))) 75 (func (export "i32.atomic.rmw16.cmpxchg_u") (param $addr i32) (param $expected i32) (param $value i32) (result i32) (i32.atomic.rmw16.cmpxchg_u (local.get $addr) (local.get $expected) (local.get $value))) 76 (func (export "i64.atomic.rmw8.cmpxchg_u") (param $addr i32) (param $expected i64) (param $value i64) (result i64) (i64.atomic.rmw8.cmpxchg_u (local.get $addr) (local.get $expected) (local.get $value))) 77 (func (export "i64.atomic.rmw16.cmpxchg_u") (param $addr i32) (param $expected i64) (param $value i64) (result i64) (i64.atomic.rmw16.cmpxchg_u (local.get $addr) (local.get $expected) (local.get $value))) 78 (func (export "i64.atomic.rmw32.cmpxchg_u") (param $addr i32) (param $expected i64) (param $value i64) (result i64) (i64.atomic.rmw32.cmpxchg_u (local.get $addr) (local.get $expected) (local.get $value))) 79 80 ) 81 82 ;; *.atomic.load* 83 84 (invoke "init" (i64.const 0x0706050403020100)) 85 86 (assert_return (invoke "i32.atomic.load" (i32.const 0)) (i32.const 0x03020100)) 87 (assert_return (invoke "i32.atomic.load" (i32.const 4)) (i32.const 0x07060504)) 88 89 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0706050403020100)) 90 91 (assert_return (invoke "i32.atomic.load8_u" (i32.const 0)) (i32.const 0x00)) 92 (assert_return (invoke "i32.atomic.load8_u" (i32.const 5)) (i32.const 0x05)) 93 94 (assert_return (invoke "i32.atomic.load16_u" (i32.const 0)) (i32.const 0x0100)) 95 (assert_return (invoke "i32.atomic.load16_u" (i32.const 6)) (i32.const 0x0706)) 96 97 (assert_return (invoke "i64.atomic.load8_u" (i32.const 0)) (i64.const 0x00)) 98 (assert_return (invoke "i64.atomic.load8_u" (i32.const 5)) (i64.const 0x05)) 99 100 (assert_return (invoke "i64.atomic.load16_u" (i32.const 0)) (i64.const 0x0100)) 101 (assert_return (invoke "i64.atomic.load16_u" (i32.const 6)) (i64.const 0x0706)) 102 103 (assert_return (invoke "i64.atomic.load32_u" (i32.const 0)) (i64.const 0x03020100)) 104 (assert_return (invoke "i64.atomic.load32_u" (i32.const 4)) (i64.const 0x07060504)) 105 106 ;; *.atomic.store* 107 108 (invoke "init" (i64.const 0x0000000000000000)) 109 110 (assert_return (invoke "i32.atomic.store" (i32.const 0) (i32.const 0xffeeddcc))) 111 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x00000000ffeeddcc)) 112 113 (assert_return (invoke "i64.atomic.store" (i32.const 0) (i64.const 0x0123456789abcdef))) 114 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0123456789abcdef)) 115 116 (assert_return (invoke "i32.atomic.store8" (i32.const 1) (i32.const 0x42))) 117 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0123456789ab42ef)) 118 119 (assert_return (invoke "i32.atomic.store16" (i32.const 4) (i32.const 0x8844))) 120 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0123884489ab42ef)) 121 122 (assert_return (invoke "i64.atomic.store8" (i32.const 1) (i64.const 0x99))) 123 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0123884489ab99ef)) 124 125 (assert_return (invoke "i64.atomic.store16" (i32.const 4) (i64.const 0xcafe))) 126 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0123cafe89ab99ef)) 127 128 (assert_return (invoke "i64.atomic.store32" (i32.const 4) (i64.const 0xdeadbeef))) 129 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0xdeadbeef89ab99ef)) 130 131 ;; *.atomic.rmw*.add 132 133 (invoke "init" (i64.const 0x1111111111111111)) 134 (assert_return (invoke "i32.atomic.rmw.add" (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 135 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111123456789)) 136 137 (invoke "init" (i64.const 0x1111111111111111)) 138 (assert_return (invoke "i64.atomic.rmw.add" (i32.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 139 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1212121213131313)) 140 141 (invoke "init" (i64.const 0x1111111111111111)) 142 (assert_return (invoke "i32.atomic.rmw8.add_u" (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 143 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111de)) 144 145 (invoke "init" (i64.const 0x1111111111111111)) 146 (assert_return (invoke "i32.atomic.rmw16.add_u" (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 147 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111dc0f)) 148 149 (invoke "init" (i64.const 0x1111111111111111)) 150 (assert_return (invoke "i64.atomic.rmw8.add_u" (i32.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 151 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111153)) 152 153 (invoke "init" (i64.const 0x1111111111111111)) 154 (assert_return (invoke "i64.atomic.rmw16.add_u" (i32.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 155 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111d000)) 156 157 (invoke "init" (i64.const 0x1111111111111111)) 158 (assert_return (invoke "i64.atomic.rmw32.add_u" (i32.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 159 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111dbccb7f6)) 160 161 ;; *.atomic.rmw*.sub 162 163 (invoke "init" (i64.const 0x1111111111111111)) 164 (assert_return (invoke "i32.atomic.rmw.sub" (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 165 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111fedcba99)) 166 167 (invoke "init" (i64.const 0x1111111111111111)) 168 (assert_return (invoke "i64.atomic.rmw.sub" (i32.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 169 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x101010100f0f0f0f)) 170 171 (invoke "init" (i64.const 0x1111111111111111)) 172 (assert_return (invoke "i32.atomic.rmw8.sub_u" (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 173 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111144)) 174 175 (invoke "init" (i64.const 0x1111111111111111)) 176 (assert_return (invoke "i32.atomic.rmw16.sub_u" (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 177 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111114613)) 178 179 (invoke "init" (i64.const 0x1111111111111111)) 180 (assert_return (invoke "i64.atomic.rmw8.sub_u" (i32.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 181 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111cf)) 182 183 (invoke "init" (i64.const 0x1111111111111111)) 184 (assert_return (invoke "i64.atomic.rmw16.sub_u" (i32.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 185 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111115222)) 186 187 (invoke "init" (i64.const 0x1111111111111111)) 188 (assert_return (invoke "i64.atomic.rmw32.sub_u" (i32.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 189 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111146556a2c)) 190 191 ;; *.atomic.rmw*.and 192 193 (invoke "init" (i64.const 0x1111111111111111)) 194 (assert_return (invoke "i32.atomic.rmw.and" (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 195 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111110101010)) 196 197 (invoke "init" (i64.const 0x1111111111111111)) 198 (assert_return (invoke "i64.atomic.rmw.and" (i32.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 199 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0101010100000000)) 200 201 (invoke "init" (i64.const 0x1111111111111111)) 202 (assert_return (invoke "i32.atomic.rmw8.and_u" (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 203 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111101)) 204 205 (invoke "init" (i64.const 0x1111111111111111)) 206 (assert_return (invoke "i32.atomic.rmw16.and_u" (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 207 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111110010)) 208 209 (invoke "init" (i64.const 0x1111111111111111)) 210 (assert_return (invoke "i64.atomic.rmw8.and_u" (i32.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 211 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111100)) 212 213 (invoke "init" (i64.const 0x1111111111111111)) 214 (assert_return (invoke "i64.atomic.rmw16.and_u" (i32.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 215 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111001)) 216 217 (invoke "init" (i64.const 0x1111111111111111)) 218 (assert_return (invoke "i64.atomic.rmw32.and_u" (i32.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 219 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111100110001)) 220 221 ;; *.atomic.rmw*.or 222 223 (invoke "init" (i64.const 0x1111111111111111)) 224 (assert_return (invoke "i32.atomic.rmw.or" (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 225 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111113355779)) 226 227 (invoke "init" (i64.const 0x1111111111111111)) 228 (assert_return (invoke "i64.atomic.rmw.or" (i32.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 229 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111113131313)) 230 231 (invoke "init" (i64.const 0x1111111111111111)) 232 (assert_return (invoke "i32.atomic.rmw8.or_u" (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 233 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111dd)) 234 235 (invoke "init" (i64.const 0x1111111111111111)) 236 (assert_return (invoke "i32.atomic.rmw16.or_u" (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 237 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111dbff)) 238 239 (invoke "init" (i64.const 0x1111111111111111)) 240 (assert_return (invoke "i64.atomic.rmw8.or_u" (i32.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 241 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111153)) 242 243 (invoke "init" (i64.const 0x1111111111111111)) 244 (assert_return (invoke "i64.atomic.rmw16.or_u" (i32.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 245 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111bfff)) 246 247 (invoke "init" (i64.const 0x1111111111111111)) 248 (assert_return (invoke "i64.atomic.rmw32.or_u" (i32.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 249 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111dbbbb7f5)) 250 251 ;; *.atomic.rmw*.xor 252 253 (invoke "init" (i64.const 0x1111111111111111)) 254 (assert_return (invoke "i32.atomic.rmw.xor" (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 255 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111103254769)) 256 257 (invoke "init" (i64.const 0x1111111111111111)) 258 (assert_return (invoke "i64.atomic.rmw.xor" (i32.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 259 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1010101013131313)) 260 261 (invoke "init" (i64.const 0x1111111111111111)) 262 (assert_return (invoke "i32.atomic.rmw8.xor_u" (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 263 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111dc)) 264 265 (invoke "init" (i64.const 0x1111111111111111)) 266 (assert_return (invoke "i32.atomic.rmw16.xor_u" (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 267 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111dbef)) 268 269 (invoke "init" (i64.const 0x1111111111111111)) 270 (assert_return (invoke "i64.atomic.rmw8.xor_u" (i32.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 271 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111153)) 272 273 (invoke "init" (i64.const 0x1111111111111111)) 274 (assert_return (invoke "i64.atomic.rmw16.xor_u" (i32.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 275 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111affe)) 276 277 (invoke "init" (i64.const 0x1111111111111111)) 278 (assert_return (invoke "i64.atomic.rmw32.xor_u" (i32.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 279 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111dbaab7f4)) 280 281 ;; *.atomic.rmw*.xchg 282 283 (invoke "init" (i64.const 0x1111111111111111)) 284 (assert_return (invoke "i32.atomic.rmw.xchg" (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 285 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111112345678)) 286 287 (invoke "init" (i64.const 0x1111111111111111)) 288 (assert_return (invoke "i64.atomic.rmw.xchg" (i32.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 289 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0101010102020202)) 290 291 (invoke "init" (i64.const 0x1111111111111111)) 292 (assert_return (invoke "i32.atomic.rmw8.xchg_u" (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 293 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111cd)) 294 295 (invoke "init" (i64.const 0x1111111111111111)) 296 (assert_return (invoke "i32.atomic.rmw16.xchg_u" (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 297 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111cafe)) 298 299 (invoke "init" (i64.const 0x1111111111111111)) 300 (assert_return (invoke "i64.atomic.rmw8.xchg_u" (i32.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 301 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111142)) 302 303 (invoke "init" (i64.const 0x1111111111111111)) 304 (assert_return (invoke "i64.atomic.rmw16.xchg_u" (i32.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 305 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111beef)) 306 307 (invoke "init" (i64.const 0x1111111111111111)) 308 (assert_return (invoke "i64.atomic.rmw32.xchg_u" (i32.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 309 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111cabba6e5)) 310 311 ;; *.atomic.rmw*.cmpxchg (compare false) 312 313 (invoke "init" (i64.const 0x1111111111111111)) 314 (assert_return (invoke "i32.atomic.rmw.cmpxchg" (i32.const 0) (i32.const 0) (i32.const 0x12345678)) (i32.const 0x11111111)) 315 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 316 317 (invoke "init" (i64.const 0x1111111111111111)) 318 (assert_return (invoke "i64.atomic.rmw.cmpxchg" (i32.const 0) (i64.const 0) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 319 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 320 321 (invoke "init" (i64.const 0x1111111111111111)) 322 (assert_return (invoke "i32.atomic.rmw8.cmpxchg_u" (i32.const 0) (i32.const 0) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 323 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 324 325 (invoke "init" (i64.const 0x1111111111111111)) 326 (assert_return (invoke "i32.atomic.rmw8.cmpxchg_u" (i32.const 0) (i32.const 0x11111111) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 327 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111cd)) 328 329 (invoke "init" (i64.const 0x1111111111111111)) 330 (assert_return (invoke "i32.atomic.rmw16.cmpxchg_u" (i32.const 0) (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) 331 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 332 333 (invoke "init" (i64.const 0x1111111111111111)) 334 (assert_return (invoke "i32.atomic.rmw16.cmpxchg_u" (i32.const 0) (i32.const 0x11111111) (i32.const 0xcafecafe)) (i32.const 0x1111)) 335 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111cafe)) 336 337 (invoke "init" (i64.const 0x1111111111111111)) 338 (assert_return (invoke "i64.atomic.rmw8.cmpxchg_u" (i32.const 0) (i64.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) 339 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 340 341 (invoke "init" (i64.const 0x1111111111111111)) 342 (assert_return (invoke "i64.atomic.rmw8.cmpxchg_u" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0x4242424242424242)) (i64.const 0x11)) 343 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111142)) 344 345 (invoke "init" (i64.const 0x1111111111111111)) 346 (assert_return (invoke "i64.atomic.rmw16.cmpxchg_u" (i32.const 0) (i64.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 347 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 348 349 (invoke "init" (i64.const 0x1111111111111111)) 350 (assert_return (invoke "i64.atomic.rmw16.cmpxchg_u" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 351 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111beef)) 352 353 (invoke "init" (i64.const 0x1111111111111111)) 354 (assert_return (invoke "i64.atomic.rmw32.cmpxchg_u" (i32.const 0) (i64.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 355 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) 356 357 (invoke "init" (i64.const 0x1111111111111111)) 358 (assert_return (invoke "i64.atomic.rmw32.cmpxchg_u" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 359 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111cabba6e5)) 360 361 ;; *.atomic.rmw*.cmpxchg (compare true) 362 363 (invoke "init" (i64.const 0x1111111111111111)) 364 (assert_return (invoke "i32.atomic.rmw.cmpxchg" (i32.const 0) (i32.const 0x11111111) (i32.const 0x12345678)) (i32.const 0x11111111)) 365 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111112345678)) 366 367 (invoke "init" (i64.const 0x1111111111111111)) 368 (assert_return (invoke "i64.atomic.rmw.cmpxchg" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0x0101010102020202)) (i64.const 0x1111111111111111)) 369 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x0101010102020202)) 370 371 (invoke "init" (i64.const 0x1111111111111111)) 372 (assert_return (invoke "i32.atomic.rmw8.cmpxchg_u" (i32.const 0) (i32.const 0x11) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) 373 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111cd)) 374 375 (invoke "init" (i64.const 0x1111111111111111)) 376 (assert_return (invoke "i32.atomic.rmw16.cmpxchg_u" (i32.const 0) (i32.const 0x1111) (i32.const 0xcafecafe)) (i32.const 0x1111)) 377 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111cafe)) 378 379 (invoke "init" (i64.const 0x1111111111111111)) 380 (assert_return (invoke "i64.atomic.rmw8.cmpxchg_u" (i32.const 0) (i64.const 0x11) (i64.const 0x4242424242424242)) (i64.const 0x11)) 381 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111142)) 382 383 (invoke "init" (i64.const 0x1111111111111111)) 384 (assert_return (invoke "i64.atomic.rmw16.cmpxchg_u" (i32.const 0) (i64.const 0x1111) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) 385 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111beef)) 386 387 (invoke "init" (i64.const 0x1111111111111111)) 388 (assert_return (invoke "i64.atomic.rmw32.cmpxchg_u" (i32.const 0) (i64.const 0x11111111) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) 389 (assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111cabba6e5)) 390 391 392 ;; unaligned accesses 393 394 (assert_trap (invoke "i32.atomic.load" (i32.const 1)) "unaligned atomic") 395 (assert_trap (invoke "i64.atomic.load" (i32.const 1)) "unaligned atomic") 396 (assert_trap (invoke "i32.atomic.load16_u" (i32.const 1)) "unaligned atomic") 397 (assert_trap (invoke "i64.atomic.load16_u" (i32.const 1)) "unaligned atomic") 398 (assert_trap (invoke "i64.atomic.load32_u" (i32.const 1)) "unaligned atomic") 399 (assert_trap (invoke "i32.atomic.store" (i32.const 1) (i32.const 0)) "unaligned atomic") 400 (assert_trap (invoke "i64.atomic.store" (i32.const 1) (i64.const 0)) "unaligned atomic") 401 (assert_trap (invoke "i32.atomic.store16" (i32.const 1) (i32.const 0)) "unaligned atomic") 402 (assert_trap (invoke "i64.atomic.store16" (i32.const 1) (i64.const 0)) "unaligned atomic") 403 (assert_trap (invoke "i64.atomic.store32" (i32.const 1) (i64.const 0)) "unaligned atomic") 404 (assert_trap (invoke "i32.atomic.rmw.add" (i32.const 1) (i32.const 0)) "unaligned atomic") 405 (assert_trap (invoke "i64.atomic.rmw.add" (i32.const 1) (i64.const 0)) "unaligned atomic") 406 (assert_trap (invoke "i32.atomic.rmw16.add_u" (i32.const 1) (i32.const 0)) "unaligned atomic") 407 (assert_trap (invoke "i64.atomic.rmw16.add_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 408 (assert_trap (invoke "i64.atomic.rmw32.add_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 409 (assert_trap (invoke "i32.atomic.rmw.sub" (i32.const 1) (i32.const 0)) "unaligned atomic") 410 (assert_trap (invoke "i64.atomic.rmw.sub" (i32.const 1) (i64.const 0)) "unaligned atomic") 411 (assert_trap (invoke "i32.atomic.rmw16.sub_u" (i32.const 1) (i32.const 0)) "unaligned atomic") 412 (assert_trap (invoke "i64.atomic.rmw16.sub_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 413 (assert_trap (invoke "i64.atomic.rmw32.sub_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 414 (assert_trap (invoke "i32.atomic.rmw.and" (i32.const 1) (i32.const 0)) "unaligned atomic") 415 (assert_trap (invoke "i64.atomic.rmw.and" (i32.const 1) (i64.const 0)) "unaligned atomic") 416 (assert_trap (invoke "i32.atomic.rmw16.and_u" (i32.const 1) (i32.const 0)) "unaligned atomic") 417 (assert_trap (invoke "i64.atomic.rmw16.and_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 418 (assert_trap (invoke "i64.atomic.rmw32.and_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 419 (assert_trap (invoke "i32.atomic.rmw.or" (i32.const 1) (i32.const 0)) "unaligned atomic") 420 (assert_trap (invoke "i64.atomic.rmw.or" (i32.const 1) (i64.const 0)) "unaligned atomic") 421 (assert_trap (invoke "i32.atomic.rmw16.or_u" (i32.const 1) (i32.const 0)) "unaligned atomic") 422 (assert_trap (invoke "i64.atomic.rmw16.or_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 423 (assert_trap (invoke "i64.atomic.rmw32.or_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 424 (assert_trap (invoke "i32.atomic.rmw.xor" (i32.const 1) (i32.const 0)) "unaligned atomic") 425 (assert_trap (invoke "i64.atomic.rmw.xor" (i32.const 1) (i64.const 0)) "unaligned atomic") 426 (assert_trap (invoke "i32.atomic.rmw16.xor_u" (i32.const 1) (i32.const 0)) "unaligned atomic") 427 (assert_trap (invoke "i64.atomic.rmw16.xor_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 428 (assert_trap (invoke "i64.atomic.rmw32.xor_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 429 (assert_trap (invoke "i32.atomic.rmw.xchg" (i32.const 1) (i32.const 0)) "unaligned atomic") 430 (assert_trap (invoke "i64.atomic.rmw.xchg" (i32.const 1) (i64.const 0)) "unaligned atomic") 431 (assert_trap (invoke "i32.atomic.rmw16.xchg_u" (i32.const 1) (i32.const 0)) "unaligned atomic") 432 (assert_trap (invoke "i64.atomic.rmw16.xchg_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 433 (assert_trap (invoke "i64.atomic.rmw32.xchg_u" (i32.const 1) (i64.const 0)) "unaligned atomic") 434 (assert_trap (invoke "i32.atomic.rmw.cmpxchg" (i32.const 1) (i32.const 0) (i32.const 0)) "unaligned atomic") 435 (assert_trap (invoke "i64.atomic.rmw.cmpxchg" (i32.const 1) (i64.const 0) (i64.const 0)) "unaligned atomic") 436 (assert_trap (invoke "i32.atomic.rmw16.cmpxchg_u" (i32.const 1) (i32.const 0) (i32.const 0)) "unaligned atomic") 437 (assert_trap (invoke "i64.atomic.rmw16.cmpxchg_u" (i32.const 1) (i64.const 0) (i64.const 0)) "unaligned atomic") 438 (assert_trap (invoke "i64.atomic.rmw32.cmpxchg_u" (i32.const 1) (i64.const 0) (i64.const 0)) "unaligned atomic") 439 440 ;; wait/notify 441 (module 442 (memory 1 1 shared) 443 444 (func (export "init") (param $value i64) (i64.store (i32.const 0) (local.get $value))) 445 446 (func (export "memory.atomic.notify") (param $addr i32) (param $count i32) (result i32) 447 (memory.atomic.notify (local.get 0) (local.get 1))) 448 (func (export "memory.atomic.wait32") (param $addr i32) (param $expected i32) (param $timeout i64) (result i32) 449 (memory.atomic.wait32 (local.get 0) (local.get 1) (local.get 2))) 450 (func (export "memory.atomic.wait64") (param $addr i32) (param $expected i64) (param $timeout i64) (result i32) 451 (memory.atomic.wait64 (local.get 0) (local.get 1) (local.get 2))) 452 ) 453 454 (invoke "init" (i64.const 0xffffffffffff)) 455 456 ;; wait returns immediately if values do not match 457 (assert_return (invoke "memory.atomic.wait32" (i32.const 0) (i32.const 0) (i64.const 0)) (i32.const 1)) 458 (assert_return (invoke "memory.atomic.wait64" (i32.const 0) (i64.const 0) (i64.const 0)) (i32.const 1)) 459 460 ;; notify always returns 461 (assert_return (invoke "memory.atomic.notify" (i32.const 0) (i32.const 0)) (i32.const 0)) 462 463 ;; OOB wait and notify always trap 464 (assert_trap (invoke "memory.atomic.wait32" (i32.const 65536) (i32.const 0) (i64.const 0)) "out of bounds memory access") 465 (assert_trap (invoke "memory.atomic.wait64" (i32.const 65536) (i64.const 0) (i64.const 0)) "out of bounds memory access") 466 467 ;; in particular, notify always traps even if waking 0 threads 468 (assert_trap (invoke "memory.atomic.notify" (i32.const 65536) (i32.const 0)) "out of bounds memory access") 469 470 ;; similarly, unaligned wait and notify always trap 471 (assert_trap (invoke "memory.atomic.wait32" (i32.const 65531) (i32.const 0) (i64.const 0)) "unaligned atomic") 472 (assert_trap (invoke "memory.atomic.wait64" (i32.const 65524) (i64.const 0) (i64.const 0)) "unaligned atomic") 473 474 (assert_trap (invoke "memory.atomic.notify" (i32.const 65531) (i32.const 0)) "unaligned atomic") 475 476 ;; atomic.wait traps on unshared memory even if it wouldn't block 477 (module 478 (memory 1 1) 479 480 (func (export "init") (param $value i64) (i64.store (i32.const 0) (local.get $value))) 481 482 (func (export "memory.atomic.notify") (param $addr i32) (param $count i32) (result i32) 483 (memory.atomic.notify (local.get 0) (local.get 1))) 484 (func (export "memory.atomic.wait32") (param $addr i32) (param $expected i32) (param $timeout i64) (result i32) 485 (memory.atomic.wait32 (local.get 0) (local.get 1) (local.get 2))) 486 (func (export "memory.atomic.wait64") (param $addr i32) (param $expected i64) (param $timeout i64) (result i32) 487 (memory.atomic.wait64 (local.get 0) (local.get 1) (local.get 2))) 488 ) 489 490 (invoke "init" (i64.const 0xffffffffffff)) 491 492 (assert_trap (invoke "memory.atomic.wait32" (i32.const 0) (i32.const 0) (i64.const 0)) "expected shared memory") 493 (assert_trap (invoke "memory.atomic.wait64" (i32.const 0) (i64.const 0) (i64.const 0)) "expected shared memory") 494 495 ;; notify still works 496 (assert_return (invoke "memory.atomic.notify" (i32.const 0) (i32.const 0)) (i32.const 0)) 497 498 ;; OOB and unaligned notify still trap 499 (assert_trap (invoke "memory.atomic.notify" (i32.const 65536) (i32.const 0)) "out of bounds memory access") 500 (assert_trap (invoke "memory.atomic.notify" (i32.const 65531) (i32.const 0)) "unaligned atomic") 501 502 ;; unshared memory is OK 503 (module 504 (memory 1 1) 505 (func (drop (memory.atomic.notify (i32.const 0) (i32.const 0)))) 506 (func (drop (memory.atomic.wait32 (i32.const 0) (i32.const 0) (i64.const 0)))) 507 (func (drop (memory.atomic.wait64 (i32.const 0) (i64.const 0) (i64.const 0)))) 508 (func (drop (i32.atomic.load (i32.const 0)))) 509 (func (drop (i64.atomic.load (i32.const 0)))) 510 (func (drop (i32.atomic.load16_u (i32.const 0)))) 511 (func (drop (i64.atomic.load16_u (i32.const 0)))) 512 (func (drop (i64.atomic.load32_u (i32.const 0)))) 513 (func (i32.atomic.store (i32.const 0) (i32.const 0))) 514 (func (i64.atomic.store (i32.const 0) (i64.const 0))) 515 (func (i32.atomic.store16 (i32.const 0) (i32.const 0))) 516 (func (i64.atomic.store16 (i32.const 0) (i64.const 0))) 517 (func (i64.atomic.store32 (i32.const 0) (i64.const 0))) 518 (func (drop (i32.atomic.rmw.add (i32.const 0) (i32.const 0)))) 519 (func (drop (i64.atomic.rmw.add (i32.const 0) (i64.const 0)))) 520 (func (drop (i32.atomic.rmw16.add_u (i32.const 0) (i32.const 0)))) 521 (func (drop (i64.atomic.rmw16.add_u (i32.const 0) (i64.const 0)))) 522 (func (drop (i64.atomic.rmw32.add_u (i32.const 0) (i64.const 0)))) 523 (func (drop (i32.atomic.rmw.sub (i32.const 0) (i32.const 0)))) 524 (func (drop (i64.atomic.rmw.sub (i32.const 0) (i64.const 0)))) 525 (func (drop (i32.atomic.rmw16.sub_u (i32.const 0) (i32.const 0)))) 526 (func (drop (i64.atomic.rmw16.sub_u (i32.const 0) (i64.const 0)))) 527 (func (drop (i64.atomic.rmw32.sub_u (i32.const 0) (i64.const 0)))) 528 (func (drop (i32.atomic.rmw.and (i32.const 0) (i32.const 0)))) 529 (func (drop (i64.atomic.rmw.and (i32.const 0) (i64.const 0)))) 530 (func (drop (i32.atomic.rmw16.and_u (i32.const 0) (i32.const 0)))) 531 (func (drop (i64.atomic.rmw16.and_u (i32.const 0) (i64.const 0)))) 532 (func (drop (i64.atomic.rmw32.and_u (i32.const 0) (i64.const 0)))) 533 (func (drop (i32.atomic.rmw.or (i32.const 0) (i32.const 0)))) 534 (func (drop (i64.atomic.rmw.or (i32.const 0) (i64.const 0)))) 535 (func (drop (i32.atomic.rmw16.or_u (i32.const 0) (i32.const 0)))) 536 (func (drop (i64.atomic.rmw16.or_u (i32.const 0) (i64.const 0)))) 537 (func (drop (i64.atomic.rmw32.or_u (i32.const 0) (i64.const 0)))) 538 (func (drop (i32.atomic.rmw.xor (i32.const 0) (i32.const 0)))) 539 (func (drop (i64.atomic.rmw.xor (i32.const 0) (i64.const 0)))) 540 (func (drop (i32.atomic.rmw16.xor_u (i32.const 0) (i32.const 0)))) 541 (func (drop (i64.atomic.rmw16.xor_u (i32.const 0) (i64.const 0)))) 542 (func (drop (i64.atomic.rmw32.xor_u (i32.const 0) (i64.const 0)))) 543 (func (drop (i32.atomic.rmw.xchg (i32.const 0) (i32.const 0)))) 544 (func (drop (i64.atomic.rmw.xchg (i32.const 0) (i64.const 0)))) 545 (func (drop (i32.atomic.rmw16.xchg_u (i32.const 0) (i32.const 0)))) 546 (func (drop (i64.atomic.rmw16.xchg_u (i32.const 0) (i64.const 0)))) 547 (func (drop (i64.atomic.rmw32.xchg_u (i32.const 0) (i64.const 0)))) 548 (func (drop (i32.atomic.rmw.cmpxchg (i32.const 0) (i32.const 0) (i32.const 0)))) 549 (func (drop (i64.atomic.rmw.cmpxchg (i32.const 0) (i64.const 0) (i64.const 0)))) 550 (func (drop (i32.atomic.rmw16.cmpxchg_u (i32.const 0) (i32.const 0) (i32.const 0)))) 551 (func (drop (i64.atomic.rmw16.cmpxchg_u (i32.const 0) (i64.const 0) (i64.const 0)))) 552 (func (drop (i64.atomic.rmw32.cmpxchg_u (i32.const 0) (i64.const 0) (i64.const 0)))) 553 ) 554 555 ;; atomic.fence: no memory is ok 556 (module 557 (func (export "fence") (atomic.fence)) 558 ) 559 560 (assert_return (invoke "fence")) 561 562 ;; Fails with no memory 563 (assert_invalid (module (func (drop (memory.atomic.notify (i32.const 0) (i32.const 0))))) "unknown memory") 564 (assert_invalid (module (func (drop (memory.atomic.wait32 (i32.const 0) (i32.const 0) (i64.const 0))))) "unknown memory") 565 (assert_invalid (module (func (drop (memory.atomic.wait64 (i32.const 0) (i64.const 0) (i64.const 0))))) "unknown memory") 566 (assert_invalid (module (func (drop (i32.atomic.load (i32.const 0))))) "unknown memory") 567 (assert_invalid (module (func (drop (i64.atomic.load (i32.const 0))))) "unknown memory") 568 (assert_invalid (module (func (drop (i32.atomic.load16_u (i32.const 0))))) "unknown memory") 569 (assert_invalid (module (func (drop (i64.atomic.load16_u (i32.const 0))))) "unknown memory") 570 (assert_invalid (module (func (drop (i64.atomic.load32_u (i32.const 0))))) "unknown memory") 571 (assert_invalid (module (func (i32.atomic.store (i32.const 0) (i32.const 0)))) "unknown memory") 572 (assert_invalid (module (func (i64.atomic.store (i32.const 0) (i64.const 0)))) "unknown memory") 573 (assert_invalid (module (func (i32.atomic.store16 (i32.const 0) (i32.const 0)))) "unknown memory") 574 (assert_invalid (module (func (i64.atomic.store16 (i32.const 0) (i64.const 0)))) "unknown memory") 575 (assert_invalid (module (func (i64.atomic.store32 (i32.const 0) (i64.const 0)))) "unknown memory") 576 (assert_invalid (module (func (drop (i32.atomic.rmw.add (i32.const 0) (i32.const 0))))) "unknown memory") 577 (assert_invalid (module (func (drop (i64.atomic.rmw.add (i32.const 0) (i64.const 0))))) "unknown memory") 578 (assert_invalid (module (func (drop (i32.atomic.rmw16.add_u (i32.const 0) (i32.const 0))))) "unknown memory") 579 (assert_invalid (module (func (drop (i64.atomic.rmw16.add_u (i32.const 0) (i64.const 0))))) "unknown memory") 580 (assert_invalid (module (func (drop (i64.atomic.rmw32.add_u (i32.const 0) (i64.const 0))))) "unknown memory") 581 (assert_invalid (module (func (drop (i32.atomic.rmw.sub (i32.const 0) (i32.const 0))))) "unknown memory") 582 (assert_invalid (module (func (drop (i64.atomic.rmw.sub (i32.const 0) (i64.const 0))))) "unknown memory") 583 (assert_invalid (module (func (drop (i32.atomic.rmw16.sub_u (i32.const 0) (i32.const 0))))) "unknown memory") 584 (assert_invalid (module (func (drop (i64.atomic.rmw16.sub_u (i32.const 0) (i64.const 0))))) "unknown memory") 585 (assert_invalid (module (func (drop (i64.atomic.rmw32.sub_u (i32.const 0) (i64.const 0))))) "unknown memory") 586 (assert_invalid (module (func (drop (i32.atomic.rmw.and (i32.const 0) (i32.const 0))))) "unknown memory") 587 (assert_invalid (module (func (drop (i64.atomic.rmw.and (i32.const 0) (i64.const 0))))) "unknown memory") 588 (assert_invalid (module (func (drop (i32.atomic.rmw16.and_u (i32.const 0) (i32.const 0))))) "unknown memory") 589 (assert_invalid (module (func (drop (i64.atomic.rmw16.and_u (i32.const 0) (i64.const 0))))) "unknown memory") 590 (assert_invalid (module (func (drop (i64.atomic.rmw32.and_u (i32.const 0) (i64.const 0))))) "unknown memory") 591 (assert_invalid (module (func (drop (i32.atomic.rmw.or (i32.const 0) (i32.const 0))))) "unknown memory") 592 (assert_invalid (module (func (drop (i64.atomic.rmw.or (i32.const 0) (i64.const 0))))) "unknown memory") 593 (assert_invalid (module (func (drop (i32.atomic.rmw16.or_u (i32.const 0) (i32.const 0))))) "unknown memory") 594 (assert_invalid (module (func (drop (i64.atomic.rmw16.or_u (i32.const 0) (i64.const 0))))) "unknown memory") 595 (assert_invalid (module (func (drop (i64.atomic.rmw32.or_u (i32.const 0) (i64.const 0))))) "unknown memory") 596 (assert_invalid (module (func (drop (i32.atomic.rmw.xor (i32.const 0) (i32.const 0))))) "unknown memory") 597 (assert_invalid (module (func (drop (i64.atomic.rmw.xor (i32.const 0) (i64.const 0))))) "unknown memory") 598 (assert_invalid (module (func (drop (i32.atomic.rmw16.xor_u (i32.const 0) (i32.const 0))))) "unknown memory") 599 (assert_invalid (module (func (drop (i64.atomic.rmw16.xor_u (i32.const 0) (i64.const 0))))) "unknown memory") 600 (assert_invalid (module (func (drop (i64.atomic.rmw32.xor_u (i32.const 0) (i64.const 0))))) "unknown memory") 601 (assert_invalid (module (func (drop (i32.atomic.rmw.xchg (i32.const 0) (i32.const 0))))) "unknown memory") 602 (assert_invalid (module (func (drop (i64.atomic.rmw.xchg (i32.const 0) (i64.const 0))))) "unknown memory") 603 (assert_invalid (module (func (drop (i32.atomic.rmw16.xchg_u (i32.const 0) (i32.const 0))))) "unknown memory") 604 (assert_invalid (module (func (drop (i64.atomic.rmw16.xchg_u (i32.const 0) (i64.const 0))))) "unknown memory") 605 (assert_invalid (module (func (drop (i64.atomic.rmw32.xchg_u (i32.const 0) (i64.const 0))))) "unknown memory") 606 (assert_invalid (module (func (drop (i32.atomic.rmw.cmpxchg (i32.const 0) (i32.const 0) (i32.const 0))))) "unknown memory") 607 (assert_invalid (module (func (drop (i64.atomic.rmw.cmpxchg (i32.const 0) (i64.const 0) (i64.const 0))))) "unknown memory") 608 (assert_invalid (module (func (drop (i32.atomic.rmw16.cmpxchg_u (i32.const 0) (i32.const 0) (i32.const 0))))) "unknown memory") 609 (assert_invalid (module (func (drop (i64.atomic.rmw16.cmpxchg_u (i32.const 0) (i64.const 0) (i64.const 0))))) "unknown memory") 610 (assert_invalid (module (func (drop (i64.atomic.rmw32.cmpxchg_u (i32.const 0) (i64.const 0) (i64.const 0))))) "unknown memory")