github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/spectest/v2/testdata/select.wast (about) 1 (module 2 ;; Auxiliary 3 (func $dummy) 4 (table $tab funcref (elem $dummy)) 5 (memory 1) 6 7 (func (export "select-i32") (param i32 i32 i32) (result i32) 8 (select (local.get 0) (local.get 1) (local.get 2)) 9 ) 10 (func (export "select-i64") (param i64 i64 i32) (result i64) 11 (select (local.get 0) (local.get 1) (local.get 2)) 12 ) 13 (func (export "select-f32") (param f32 f32 i32) (result f32) 14 (select (local.get 0) (local.get 1) (local.get 2)) 15 ) 16 (func (export "select-f64") (param f64 f64 i32) (result f64) 17 (select (local.get 0) (local.get 1) (local.get 2)) 18 ) 19 20 (func (export "select-i32-t") (param i32 i32 i32) (result i32) 21 (select (result i32) (local.get 0) (local.get 1) (local.get 2)) 22 ) 23 (func (export "select-i64-t") (param i64 i64 i32) (result i64) 24 (select (result i64) (local.get 0) (local.get 1) (local.get 2)) 25 ) 26 (func (export "select-f32-t") (param f32 f32 i32) (result f32) 27 (select (result f32) (local.get 0) (local.get 1) (local.get 2)) 28 ) 29 (func (export "select-f64-t") (param f64 f64 i32) (result f64) 30 (select (result f64) (local.get 0) (local.get 1) (local.get 2)) 31 ) 32 (func (export "select-funcref") (param funcref funcref i32) (result funcref) 33 (select (result funcref) (local.get 0) (local.get 1) (local.get 2)) 34 ) 35 (func (export "select-externref") (param externref externref i32) (result externref) 36 (select (result externref) (local.get 0) (local.get 1) (local.get 2)) 37 ) 38 39 ;; As the argument of control constructs and instructions 40 41 (func (export "as-select-first") (param i32) (result i32) 42 (select (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 2) (i32.const 3)) 43 ) 44 (func (export "as-select-mid") (param i32) (result i32) 45 (select (i32.const 2) (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 3)) 46 ) 47 (func (export "as-select-last") (param i32) (result i32) 48 (select (i32.const 2) (i32.const 3) (select (i32.const 0) (i32.const 1) (local.get 0))) 49 ) 50 51 (func (export "as-loop-first") (param i32) (result i32) 52 (loop (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy) (call $dummy)) 53 ) 54 (func (export "as-loop-mid") (param i32) (result i32) 55 (loop (result i32) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy)) 56 ) 57 (func (export "as-loop-last") (param i32) (result i32) 58 (loop (result i32) (call $dummy) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0))) 59 ) 60 61 (func (export "as-if-condition") (param i32) 62 (select (i32.const 2) (i32.const 3) (local.get 0)) (if (then (call $dummy))) 63 ) 64 (func (export "as-if-then") (param i32) (result i32) 65 (if (result i32) (i32.const 1) (then (select (i32.const 2) (i32.const 3) (local.get 0))) (else (i32.const 4))) 66 ) 67 (func (export "as-if-else") (param i32) (result i32) 68 (if (result i32) (i32.const 0) (then (i32.const 2)) (else (select (i32.const 2) (i32.const 3) (local.get 0)))) 69 ) 70 71 (func (export "as-br_if-first") (param i32) (result i32) 72 (block (result i32) (br_if 0 (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 4))) 73 ) 74 (func (export "as-br_if-last") (param i32) (result i32) 75 (block (result i32) (br_if 0 (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)))) 76 ) 77 78 (func (export "as-br_table-first") (param i32) (result i32) 79 (block (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 2) (br_table 0 0)) 80 ) 81 (func (export "as-br_table-last") (param i32) (result i32) 82 (block (result i32) (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)) (br_table 0 0)) 83 ) 84 85 (func $func (param i32 i32) (result i32) (local.get 0)) 86 (type $check (func (param i32 i32) (result i32))) 87 (table $t funcref (elem $func)) 88 (func (export "as-call_indirect-first") (param i32) (result i32) 89 (block (result i32) 90 (call_indirect $t (type $check) 91 (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 1) (i32.const 0) 92 ) 93 ) 94 ) 95 (func (export "as-call_indirect-mid") (param i32) (result i32) 96 (block (result i32) 97 (call_indirect $t (type $check) 98 (i32.const 1) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 0) 99 ) 100 ) 101 ) 102 (func (export "as-call_indirect-last") (param i32) (result i32) 103 (block (result i32) 104 (call_indirect $t (type $check) 105 (i32.const 1) (i32.const 4) (select (i32.const 2) (i32.const 3) (local.get 0)) 106 ) 107 ) 108 ) 109 110 (func (export "as-store-first") (param i32) 111 (select (i32.const 0) (i32.const 4) (local.get 0)) (i32.const 1) (i32.store) 112 ) 113 (func (export "as-store-last") (param i32) 114 (i32.const 8) (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.store) 115 ) 116 117 (func (export "as-memory.grow-value") (param i32) (result i32) 118 (memory.grow (select (i32.const 1) (i32.const 2) (local.get 0))) 119 ) 120 121 (func $f (param i32) (result i32) (local.get 0)) 122 123 (func (export "as-call-value") (param i32) (result i32) 124 (call $f (select (i32.const 1) (i32.const 2) (local.get 0))) 125 ) 126 (func (export "as-return-value") (param i32) (result i32) 127 (select (i32.const 1) (i32.const 2) (local.get 0)) (return) 128 ) 129 (func (export "as-drop-operand") (param i32) 130 (drop (select (i32.const 1) (i32.const 2) (local.get 0))) 131 ) 132 (func (export "as-br-value") (param i32) (result i32) 133 (block (result i32) (br 0 (select (i32.const 1) (i32.const 2) (local.get 0)))) 134 ) 135 (func (export "as-local.set-value") (param i32) (result i32) 136 (local i32) (local.set 0 (select (i32.const 1) (i32.const 2) (local.get 0))) (local.get 0) 137 ) 138 (func (export "as-local.tee-value") (param i32) (result i32) 139 (local.tee 0 (select (i32.const 1) (i32.const 2) (local.get 0))) 140 ) 141 (global $a (mut i32) (i32.const 10)) 142 (func (export "as-global.set-value") (param i32) (result i32) 143 (global.set $a (select (i32.const 1) (i32.const 2) (local.get 0))) 144 (global.get $a) 145 ) 146 (func (export "as-load-operand") (param i32) (result i32) 147 (i32.load (select (i32.const 0) (i32.const 4) (local.get 0))) 148 ) 149 150 (func (export "as-unary-operand") (param i32) (result i32) 151 (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0))) 152 ) 153 (func (export "as-binary-operand") (param i32) (result i32) 154 (i32.mul 155 (select (i32.const 1) (i32.const 2) (local.get 0)) 156 (select (i32.const 1) (i32.const 2) (local.get 0)) 157 ) 158 ) 159 (func (export "as-test-operand") (param i32) (result i32) 160 (block (result i32) 161 (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0))) 162 ) 163 ) 164 165 (func (export "as-compare-left") (param i32) (result i32) 166 (block (result i32) 167 (i32.le_s (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.const 1)) 168 ) 169 ) 170 (func (export "as-compare-right") (param i32) (result i32) 171 (block (result i32) 172 (i32.ne (i32.const 1) (select (i32.const 0) (i32.const 1) (local.get 0))) 173 ) 174 ) 175 176 (func (export "as-convert-operand") (param i32) (result i32) 177 (block (result i32) 178 (i32.wrap_i64 (select (i64.const 1) (i64.const 0) (local.get 0))) 179 ) 180 ) 181 ) 182 183 (assert_return (invoke "select-i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) 184 (assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) 185 (assert_return (invoke "select-f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) 186 (assert_return (invoke "select-f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) 187 188 (assert_return (invoke "select-i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) 189 (assert_return (invoke "select-i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) 190 (assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) 191 (assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) 192 193 (assert_return (invoke "select-f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) 194 (assert_return (invoke "select-f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) 195 (assert_return (invoke "select-f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) 196 (assert_return (invoke "select-f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) 197 (assert_return (invoke "select-f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) 198 (assert_return (invoke "select-f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) 199 (assert_return (invoke "select-f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) 200 (assert_return (invoke "select-f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) 201 202 (assert_return (invoke "select-f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) 203 (assert_return (invoke "select-f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) 204 (assert_return (invoke "select-f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) 205 (assert_return (invoke "select-f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) 206 (assert_return (invoke "select-f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) 207 (assert_return (invoke "select-f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) 208 (assert_return (invoke "select-f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) 209 (assert_return (invoke "select-f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) 210 211 (assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) 212 (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) 213 (assert_return (invoke "select-f32-t" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) 214 (assert_return (invoke "select-f64-t" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) 215 (assert_return (invoke "select-funcref" (ref.null func) (ref.null func) (i32.const 1)) (ref.null func)) 216 (assert_return (invoke "select-externref" (ref.extern 1) (ref.extern 2) (i32.const 1)) (ref.extern 1)) 217 218 (assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) 219 (assert_return (invoke "select-i32-t" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) 220 (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) 221 (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) 222 (assert_return (invoke "select-externref" (ref.extern 1) (ref.extern 2) (i32.const 0)) (ref.extern 2)) 223 (assert_return (invoke "select-externref" (ref.extern 2) (ref.extern 1) (i32.const 0)) (ref.extern 1)) 224 225 (assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) 226 (assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) 227 (assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) 228 (assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) 229 (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) 230 (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) 231 (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) 232 (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) 233 234 (assert_return (invoke "select-f64-t" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) 235 (assert_return (invoke "select-f64-t" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) 236 (assert_return (invoke "select-f64-t" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) 237 (assert_return (invoke "select-f64-t" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) 238 (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) 239 (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) 240 (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) 241 (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) 242 243 (assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 1)) 244 (assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 0)) 245 (assert_return (invoke "as-select-mid" (i32.const 0)) (i32.const 2)) 246 (assert_return (invoke "as-select-mid" (i32.const 1)) (i32.const 2)) 247 (assert_return (invoke "as-select-last" (i32.const 0)) (i32.const 2)) 248 (assert_return (invoke "as-select-last" (i32.const 1)) (i32.const 3)) 249 250 (assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 3)) 251 (assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 2)) 252 (assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 3)) 253 (assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 2)) 254 (assert_return (invoke "as-loop-last" (i32.const 0)) (i32.const 3)) 255 (assert_return (invoke "as-loop-last" (i32.const 1)) (i32.const 2)) 256 257 (assert_return (invoke "as-if-condition" (i32.const 0))) 258 (assert_return (invoke "as-if-condition" (i32.const 1))) 259 (assert_return (invoke "as-if-then" (i32.const 0)) (i32.const 3)) 260 (assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 2)) 261 (assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 3)) 262 (assert_return (invoke "as-if-else" (i32.const 1)) (i32.const 2)) 263 264 (assert_return (invoke "as-br_if-first" (i32.const 0)) (i32.const 3)) 265 (assert_return (invoke "as-br_if-first" (i32.const 1)) (i32.const 2)) 266 (assert_return (invoke "as-br_if-last" (i32.const 0)) (i32.const 2)) 267 (assert_return (invoke "as-br_if-last" (i32.const 1)) (i32.const 2)) 268 269 (assert_return (invoke "as-br_table-first" (i32.const 0)) (i32.const 3)) 270 (assert_return (invoke "as-br_table-first" (i32.const 1)) (i32.const 2)) 271 (assert_return (invoke "as-br_table-last" (i32.const 0)) (i32.const 2)) 272 (assert_return (invoke "as-br_table-last" (i32.const 1)) (i32.const 2)) 273 274 (assert_return (invoke "as-call_indirect-first" (i32.const 0)) (i32.const 3)) 275 (assert_return (invoke "as-call_indirect-first" (i32.const 1)) (i32.const 2)) 276 (assert_return (invoke "as-call_indirect-mid" (i32.const 0)) (i32.const 1)) 277 (assert_return (invoke "as-call_indirect-mid" (i32.const 1)) (i32.const 1)) 278 (assert_trap (invoke "as-call_indirect-last" (i32.const 0)) "undefined element") 279 (assert_trap (invoke "as-call_indirect-last" (i32.const 1)) "undefined element") 280 281 (assert_return (invoke "as-store-first" (i32.const 0))) 282 (assert_return (invoke "as-store-first" (i32.const 1))) 283 (assert_return (invoke "as-store-last" (i32.const 0))) 284 (assert_return (invoke "as-store-last" (i32.const 1))) 285 286 (assert_return (invoke "as-memory.grow-value" (i32.const 0)) (i32.const 1)) 287 (assert_return (invoke "as-memory.grow-value" (i32.const 1)) (i32.const 3)) 288 289 (assert_return (invoke "as-call-value" (i32.const 0)) (i32.const 2)) 290 (assert_return (invoke "as-call-value" (i32.const 1)) (i32.const 1)) 291 (assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 2)) 292 (assert_return (invoke "as-return-value" (i32.const 1)) (i32.const 1)) 293 (assert_return (invoke "as-drop-operand" (i32.const 0))) 294 (assert_return (invoke "as-drop-operand" (i32.const 1))) 295 (assert_return (invoke "as-br-value" (i32.const 0)) (i32.const 2)) 296 (assert_return (invoke "as-br-value" (i32.const 1)) (i32.const 1)) 297 (assert_return (invoke "as-local.set-value" (i32.const 0)) (i32.const 2)) 298 (assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 1)) 299 (assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const 2)) 300 (assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 1)) 301 (assert_return (invoke "as-global.set-value" (i32.const 0)) (i32.const 2)) 302 (assert_return (invoke "as-global.set-value" (i32.const 1)) (i32.const 1)) 303 (assert_return (invoke "as-load-operand" (i32.const 0)) (i32.const 1)) 304 (assert_return (invoke "as-load-operand" (i32.const 1)) (i32.const 1)) 305 306 (assert_return (invoke "as-unary-operand" (i32.const 0)) (i32.const 0)) 307 (assert_return (invoke "as-unary-operand" (i32.const 1)) (i32.const 1)) 308 (assert_return (invoke "as-binary-operand" (i32.const 0)) (i32.const 4)) 309 (assert_return (invoke "as-binary-operand" (i32.const 1)) (i32.const 1)) 310 (assert_return (invoke "as-test-operand" (i32.const 0)) (i32.const 0)) 311 (assert_return (invoke "as-test-operand" (i32.const 1)) (i32.const 1)) 312 (assert_return (invoke "as-compare-left" (i32.const 0)) (i32.const 0)) 313 (assert_return (invoke "as-compare-left" (i32.const 1)) (i32.const 1)) 314 (assert_return (invoke "as-compare-right" (i32.const 0)) (i32.const 0)) 315 (assert_return (invoke "as-compare-right" (i32.const 1)) (i32.const 1)) 316 (assert_return (invoke "as-convert-operand" (i32.const 0)) (i32.const 0)) 317 (assert_return (invoke "as-convert-operand" (i32.const 1)) (i32.const 1)) 318 319 (assert_invalid 320 (module (func $arity-0-implicit (select (nop) (nop) (i32.const 1)))) 321 "type mismatch" 322 ) 323 (assert_invalid 324 (module (func $arity-0 (select (result) (nop) (nop) (i32.const 1)))) 325 "invalid result arity" 326 ) 327 (assert_invalid 328 (module (func $arity-2 (result i32 i32) 329 (select (result i32 i32) 330 (i32.const 0) (i32.const 0) 331 (i32.const 0) (i32.const 0) 332 (i32.const 1) 333 ) 334 )) 335 "invalid result arity" 336 ) 337 338 339 (assert_invalid 340 (module (func $type-externref-implicit (param $r externref) 341 (drop (select (local.get $r) (local.get $r) (i32.const 1))) 342 )) 343 "type mismatch" 344 ) 345 346 (assert_invalid 347 (module (func $type-num-vs-num 348 (drop (select (i32.const 1) (i64.const 1) (i32.const 1))) 349 )) 350 "type mismatch" 351 ) 352 (assert_invalid 353 (module (func $type-num-vs-num 354 (drop (select (i32.const 1) (f32.const 1.0) (i32.const 1))) 355 )) 356 "type mismatch" 357 ) 358 (assert_invalid 359 (module (func $type-num-vs-num 360 (drop (select (i32.const 1) (f64.const 1.0) (i32.const 1))) 361 )) 362 "type mismatch" 363 ) 364 365 (assert_invalid 366 (module (func $type-num-vs-num (select (i32.const 1) (i64.const 1) (i32.const 1)) (drop))) 367 "type mismatch" 368 ) 369 (assert_invalid 370 (module (func $type-num-vs-num (select (i32.const 1) (f32.const 1.0) (i32.const 1)) (drop))) 371 "type mismatch" 372 ) 373 (assert_invalid 374 (module (func $type-num-vs-num (select (i32.const 1) (i64.const 1) (i32.const 1)) (drop))) 375 "type mismatch" 376 ) 377 (assert_invalid 378 (module (func $type-num-vs-num (select (i32.const 1) (f32.const 1.0) (i32.const 1)) (drop))) 379 "type mismatch" 380 ) 381 (assert_invalid 382 (module (func $type-num-vs-num (select (i32.const 1) (f64.const 1.0) (i32.const 1)) (drop))) 383 "type mismatch" 384 ) 385 386 387 (assert_invalid 388 (module 389 (func $type-1st-operand-empty 390 (select) (drop) 391 ) 392 ) 393 "type mismatch" 394 ) 395 (assert_invalid 396 (module 397 (func $type-2nd-operand-empty 398 (i32.const 0) (select) (drop) 399 ) 400 ) 401 "type mismatch" 402 ) 403 (assert_invalid 404 (module 405 (func $type-3rd-operand-empty 406 (i32.const 0) (i32.const 0) (select) (drop) 407 ) 408 ) 409 "type mismatch" 410 ) 411 (assert_invalid 412 (module 413 (func $type-1st-operand-empty-in-block 414 (i32.const 0) (i32.const 0) (i32.const 0) 415 (block (select) (drop)) 416 ) 417 ) 418 "type mismatch" 419 ) 420 (assert_invalid 421 (module 422 (func $type-2nd-operand-empty-in-block 423 (i32.const 0) (i32.const 0) 424 (block (i32.const 0) (select) (drop)) 425 ) 426 ) 427 "type mismatch" 428 ) 429 (assert_invalid 430 (module 431 (func $type-3rd-operand-empty-in-block 432 (i32.const 0) 433 (block (i32.const 0) (i32.const 0) (select) (drop)) 434 ) 435 ) 436 "type mismatch" 437 ) 438 (assert_invalid 439 (module 440 (func $type-1st-operand-empty-in-loop 441 (i32.const 0) (i32.const 0) (i32.const 0) 442 (loop (select) (drop)) 443 ) 444 ) 445 "type mismatch" 446 ) 447 (assert_invalid 448 (module 449 (func $type-2nd-operand-empty-in-loop 450 (i32.const 0) (i32.const 0) 451 (loop (i32.const 0) (select) (drop)) 452 ) 453 ) 454 "type mismatch" 455 ) 456 (assert_invalid 457 (module 458 (func $type-3rd-operand-empty-in-loop 459 (i32.const 0) 460 (loop (i32.const 0) (i32.const 0) (select) (drop)) 461 ) 462 ) 463 "type mismatch" 464 ) 465 (assert_invalid 466 (module 467 (func $type-1st-operand-empty-in-then 468 (i32.const 0) (i32.const 0) (i32.const 0) 469 (if (then (select) (drop))) 470 ) 471 ) 472 "type mismatch" 473 ) 474 (assert_invalid 475 (module 476 (func $type-2nd-operand-empty-in-then 477 (i32.const 0) (i32.const 0) 478 (if (then (i32.const 0) (select) (drop))) 479 ) 480 ) 481 "type mismatch" 482 ) 483 (assert_invalid 484 (module 485 (func $type-3rd-operand-empty-in-then 486 (i32.const 0) 487 (if (then (i32.const 0) (i32.const 0) (select) (drop))) 488 ) 489 ) 490 "type mismatch" 491 ) 492 493 ;; Third operand must be i32 494 495 (assert_invalid 496 (module (func (select (i32.const 1) (i32.const 1) (i64.const 1)) (drop))) 497 "type mismatch" 498 ) 499 (assert_invalid 500 (module (func (select (i32.const 1) (i32.const 1) (f32.const 1)) (drop))) 501 "type mismatch" 502 ) 503 (assert_invalid 504 (module (func (select (i32.const 1) (i32.const 1) (f64.const 1)) (drop))) 505 "type mismatch" 506 ) 507 508 ;; Result of select has type of first two operands 509 510 (assert_invalid 511 (module (func (result i32) (select (i64.const 1) (i64.const 1) (i32.const 1)))) 512 "type mismatch" 513 ) 514 515 516 ;; Flat syntax 517 518 (module 519 (table 1 funcref) 520 (func (result i32) unreachable select) 521 (func (result i32) unreachable select nop) 522 (func (result i32) unreachable select (select)) 523 (func (result i32) unreachable select select) 524 (func (result i32) unreachable select select select) 525 (func (result i32) unreachable select (result i32)) 526 (func (result i32) unreachable select (result i32) (result)) 527 (func (result i32) unreachable select (result i32) (result) select) 528 (func (result i32) unreachable select (result) (result i32) select (result i32)) 529 (func (result i32) unreachable select call_indirect) 530 (func (result i32) unreachable select call_indirect select) 531 )