summaryrefslogtreecommitdiff
path: root/test/passes/precompute_all-features.wast
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-01-04 14:25:18 -0800
committerGitHub <noreply@github.com>2024-01-04 14:25:18 -0800
commita58281ca114359cd6e65f5daaf086636aa18b0b0 (patch)
treeff98bd31d1c87b598027c2303b17855a44346515 /test/passes/precompute_all-features.wast
parent0ed42cf976ce9a3dfbe9cbb0885122e8fb6a377b (diff)
downloadbinaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.tar.gz
binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.tar.bz2
binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.zip
Require `then` and `else` with `if` (#6201)
We previously supported (and primarily used) a non-standard text format for conditionals in which the condition, if-true expression, and if-false expression were all simply s-expression children of the `if` expression. The standard text format, however, requires the use of `then` and `else` forms to introduce the if-true and if-false arms of the conditional. Update the legacy text parser to require the standard format and update all tests to match. Update the printer to print the standard format as well. The .wast and .wat test inputs were mechanically updated with this script: https://gist.github.com/tlively/85ae7f01f92f772241ec994c840ccbb1
Diffstat (limited to 'test/passes/precompute_all-features.wast')
-rw-r--r--test/passes/precompute_all-features.wast54
1 files changed, 32 insertions, 22 deletions
diff --git a/test/passes/precompute_all-features.wast b/test/passes/precompute_all-features.wast
index 450001533..633787fad 100644
--- a/test/passes/precompute_all-features.wast
+++ b/test/passes/precompute_all-features.wast
@@ -192,16 +192,22 @@
)
(func $ret (result i32)
(if (call $ret)
- (return (i32.const 0))
+ (then
+ (return (i32.const 0))
+ )
)
(if (call $ret)
- (return (return (i32.const 1)))
+ (then
+ (return (return (i32.const 1)))
+ )
)
(i32.const 1)
)
(func $noret
(if (call $ret)
- (return)
+ (then
+ (return)
+ )
)
)
(func $refinalize-br-condition-unreachable
@@ -234,33 +240,37 @@
(i32.const 1919623207)
(if (result i32)
(i32.const 1)
- (block $label$2 (result i32)
- (drop
- (i64.and
- (i64.trunc_f32_u
- (f32.const 70847791997969805621592064)
+ (then
+ (block $label$2 (result i32)
+ (drop
+ (i64.and
+ (i64.trunc_f32_u
+ (f32.const 70847791997969805621592064)
+ )
+ (i64.const 729618461987467893)
)
- (i64.const 729618461987467893)
)
- )
- (br_if $label$2
- (i32.const 2049535349)
- (f32.eq
- (f32.demote_f64
- (f64.mul
- (br_if $label$0 ;; this br is optimized, and br *and* values reused
- (f64.const 6.134856208230095e-154)
- (i32.const 690910817)
+ (br_if $label$2
+ (i32.const 2049535349)
+ (f32.eq
+ (f32.demote_f64
+ (f64.mul
+ (br_if $label$0 ;; this br is optimized, and br *and* values reused
+ (f64.const 6.134856208230095e-154)
+ (i32.const 690910817)
+ )
+ (f64.const 1.515470884183969e-152)
)
- (f64.const 1.515470884183969e-152)
)
+ (f32.const 66524025679377434935296)
)
- (f32.const 66524025679377434935296)
)
)
)
- (i32.load offset=3 align=2
- (i32.const 169901344)
+ (else
+ (i32.load offset=3 align=2
+ (i32.const 169901344)
+ )
)
)
)