| ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. |
| ;; RUN: wasm-opt %s --optimize-instructions --enable-multivalue -S -o - | filecheck %s |
| |
| (module |
| ;; CHECK: (func $if-identical-arms-tuple (param $x i32) (result i32) |
| ;; CHECK-NEXT: (tuple.extract 0 |
| ;; CHECK-NEXT: (if (result i32 i32) |
| ;; CHECK-NEXT: (local.get $x) |
| ;; CHECK-NEXT: (tuple.make |
| ;; CHECK-NEXT: (i32.const 0) |
| ;; CHECK-NEXT: (i32.const 1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (tuple.make |
| ;; CHECK-NEXT: (i32.const 2) |
| ;; CHECK-NEXT: (i32.const 3) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $if-identical-arms-tuple (param $x i32) (result i32) |
| (if (result i32) |
| (local.get $x) |
| ;; The tuple.extract can be hoisted out. |
| (tuple.extract 0 |
| (tuple.make |
| (i32.const 0) |
| (i32.const 1) |
| ) |
| ) |
| (tuple.extract 0 |
| (tuple.make |
| (i32.const 2) |
| (i32.const 3) |
| ) |
| ) |
| ) |
| ) |
| ;; CHECK: (func $select-identical-arms-tuple (param $x i32) (result i32) |
| ;; CHECK-NEXT: (select |
| ;; CHECK-NEXT: (tuple.extract 0 |
| ;; CHECK-NEXT: (tuple.make |
| ;; CHECK-NEXT: (i32.const 0) |
| ;; CHECK-NEXT: (i32.const 1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (tuple.extract 0 |
| ;; CHECK-NEXT: (tuple.make |
| ;; CHECK-NEXT: (i32.const 2) |
| ;; CHECK-NEXT: (i32.const 3) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (local.get $x) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $select-identical-arms-tuple (param $x i32) (result i32) |
| (select |
| ;; The tuple.extract cannot be hoisted out, as the spec disallows a |
| ;; select with multiple values in its arms. |
| (tuple.extract 0 |
| (tuple.make |
| (i32.const 0) |
| (i32.const 1) |
| ) |
| ) |
| (tuple.extract 0 |
| (tuple.make |
| (i32.const 2) |
| (i32.const 3) |
| ) |
| ) |
| (local.get $x) |
| ) |
| ) |
| ) |