summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-10-30 11:36:52 -0700
committerGitHub <noreply@github.com>2020-10-30 11:36:52 -0700
commitebaddfbd09359a9de6424e0c302255b8f8caf6f6 (patch)
treef7a0ee4e3aa6217d70f37c729f937e12e8ece7f1 /test
parent253c6a50130a16a1a1aae80bba4885fe99d3f625 (diff)
downloadbinaryen-ebaddfbd09359a9de6424e0c302255b8f8caf6f6.tar.gz
binaryen-ebaddfbd09359a9de6424e0c302255b8f8caf6f6.tar.bz2
binaryen-ebaddfbd09359a9de6424e0c302255b8f8caf6f6.zip
Standardize NaNs in the interpreter, when there is nondeterminism (#3298)
Specifically, pick a simple positive canonical NaN as the NaN output, when the output is a NaN. This is the same as what tools like wabt do. This fixes a testcase found by the fuzzer on #3289 but it was not that PR's fault.
Diffstat (limited to 'test')
-rw-r--r--test/passes/O_fast-math.txt2
-rw-r--r--test/passes/fuzz-exec_O.txt57
-rw-r--r--test/passes/optimize-instructions_fuzz-exec.txt255
-rw-r--r--test/passes/optimize-instructions_fuzz-exec.wast206
-rw-r--r--test/spec/old_float_exprs.wast48
-rw-r--r--test/spec/simd.wast16
6 files changed, 521 insertions, 63 deletions
diff --git a/test/passes/O_fast-math.txt b/test/passes/O_fast-math.txt
index e3833dbba..c6ae6ec16 100644
--- a/test/passes/O_fast-math.txt
+++ b/test/passes/O_fast-math.txt
@@ -22,7 +22,7 @@
(f32.const -nan:0x34546d)
)
(func $2 (; has Stack IR ;) (result f32)
- (f32.const -nan:0x74546d)
+ (f32.const nan:0x400000)
)
(func $9 (; has Stack IR ;) (param $0 f32) (result f32)
(f32.neg
diff --git a/test/passes/fuzz-exec_O.txt b/test/passes/fuzz-exec_O.txt
index f17b04650..2a32e23e8 100644
--- a/test/passes/fuzz-exec_O.txt
+++ b/test/passes/fuzz-exec_O.txt
@@ -31,59 +31,56 @@
[fuzz-exec] comparing func_0
[fuzz-exec] comparing func_1
[fuzz-exec] calling div
-[fuzz-exec] note result: div => -nan:0x63017a
+[fuzz-exec] note result: div => nan:0x400000
[fuzz-exec] calling mul1
-[fuzz-exec] note result: mul1 => -nan:0x74546d
+[fuzz-exec] note result: mul1 => nan:0x400000
[fuzz-exec] calling mul2
-[fuzz-exec] note result: mul2 => -nan:0x74546d
+[fuzz-exec] note result: mul2 => nan:0x400000
[fuzz-exec] calling add1
-[fuzz-exec] note result: add1 => -nan:0x74546d
+[fuzz-exec] note result: add1 => nan:0x400000
[fuzz-exec] calling add2
-[fuzz-exec] note result: add2 => -nan:0x74546d
+[fuzz-exec] note result: add2 => nan:0x400000
[fuzz-exec] calling add3
-[fuzz-exec] note result: add3 => -nan:0x74546d
+[fuzz-exec] note result: add3 => nan:0x400000
[fuzz-exec] calling add4
-[fuzz-exec] note result: add4 => -nan:0x74546d
+[fuzz-exec] note result: add4 => nan:0x400000
[fuzz-exec] calling sub1
-[fuzz-exec] note result: sub1 => -nan:0x74546d
+[fuzz-exec] note result: sub1 => nan:0x400000
[fuzz-exec] calling sub2
-[fuzz-exec] note result: sub2 => -nan:0x74546d
+[fuzz-exec] note result: sub2 => nan:0x400000
(module
(type $none_=>_f32 (func (result f32)))
(export "div" (func $0))
- (export "mul1" (func $1))
- (export "mul2" (func $1))
- (export "add1" (func $1))
- (export "add2" (func $1))
- (export "add3" (func $1))
- (export "add4" (func $1))
- (export "sub1" (func $1))
- (export "sub2" (func $1))
+ (export "mul1" (func $0))
+ (export "mul2" (func $0))
+ (export "add1" (func $0))
+ (export "add2" (func $0))
+ (export "add3" (func $0))
+ (export "add4" (func $0))
+ (export "sub1" (func $0))
+ (export "sub2" (func $0))
(func $0 (; has Stack IR ;) (result f32)
- (f32.const -nan:0x63017a)
- )
- (func $1 (; has Stack IR ;) (result f32)
- (f32.const -nan:0x74546d)
+ (f32.const nan:0x400000)
)
)
[fuzz-exec] calling div
-[fuzz-exec] note result: div => -nan:0x63017a
+[fuzz-exec] note result: div => nan:0x400000
[fuzz-exec] calling mul1
-[fuzz-exec] note result: mul1 => -nan:0x74546d
+[fuzz-exec] note result: mul1 => nan:0x400000
[fuzz-exec] calling mul2
-[fuzz-exec] note result: mul2 => -nan:0x74546d
+[fuzz-exec] note result: mul2 => nan:0x400000
[fuzz-exec] calling add1
-[fuzz-exec] note result: add1 => -nan:0x74546d
+[fuzz-exec] note result: add1 => nan:0x400000
[fuzz-exec] calling add2
-[fuzz-exec] note result: add2 => -nan:0x74546d
+[fuzz-exec] note result: add2 => nan:0x400000
[fuzz-exec] calling add3
-[fuzz-exec] note result: add3 => -nan:0x74546d
+[fuzz-exec] note result: add3 => nan:0x400000
[fuzz-exec] calling add4
-[fuzz-exec] note result: add4 => -nan:0x74546d
+[fuzz-exec] note result: add4 => nan:0x400000
[fuzz-exec] calling sub1
-[fuzz-exec] note result: sub1 => -nan:0x74546d
+[fuzz-exec] note result: sub1 => nan:0x400000
[fuzz-exec] calling sub2
-[fuzz-exec] note result: sub2 => -nan:0x74546d
+[fuzz-exec] note result: sub2 => nan:0x400000
[fuzz-exec] comparing add1
[fuzz-exec] comparing add2
[fuzz-exec] comparing add3
diff --git a/test/passes/optimize-instructions_fuzz-exec.txt b/test/passes/optimize-instructions_fuzz-exec.txt
new file mode 100644
index 000000000..548148e09
--- /dev/null
+++ b/test/passes/optimize-instructions_fuzz-exec.txt
@@ -0,0 +1,255 @@
+[fuzz-exec] calling test32
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x7fff82]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[fuzz-exec] calling test64
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0xfffffffffff82]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[fuzz-exec] calling just-one-nan
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[fuzz-exec] calling ignore
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+(module
+ (type $none_=>_none (func))
+ (type $f32_=>_none (func (param f32)))
+ (type $f64_=>_none (func (param f64)))
+ (import "fuzzing-support" "log-f32" (func $logf32 (param f32)))
+ (import "fuzzing-support" "log-f64" (func $logf64 (param f64)))
+ (export "test32" (func $0))
+ (export "test64" (func $1))
+ (export "just-one-nan" (func $2))
+ (export "ignore" (func $3))
+ (func $0
+ (call $logf32
+ (f32.add
+ (f32.const -nan:0x7fff82)
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.sub
+ (f32.const -nan:0x7fff82)
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.mul
+ (f32.const -nan:0x7fff82)
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const nan:0x7fff82)
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ (call $logf32
+ (f32.copysign
+ (f32.const -nan:0x7fff82)
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.min
+ (f32.const -nan:0x7fff82)
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.max
+ (f32.const -nan:0x7fff82)
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ )
+ )
+ )
+ (func $1
+ (call $logf64
+ (f64.add
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.sub
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.mul
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.div
+ (f64.const nan:0xfffffffffff82)
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ (call $logf64
+ (f64.copysign
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.min
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.max
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ )
+ (func $2
+ (call $logf32
+ (f32.add
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ (f32.const 0)
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const -nan:0x7ff622)
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.neg
+ (f32.const -nan:0x7ff622)
+ )
+ (f32.const -0)
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const -nan:0x7ff622)
+ (f32.neg
+ (f32.const -0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.neg
+ (f32.const nan:0x7ff622)
+ )
+ (f32.const 0)
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const nan:0x7ff622)
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+ )
+ )
+ (func $3
+ (call $logf32
+ (f32.div
+ (f32.const -0)
+ (f32.const 0)
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const 0)
+ (f32.const 0)
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const -0)
+ (f32.const -0)
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const 0)
+ (f32.const -0)
+ )
+ )
+ )
+)
+[fuzz-exec] calling test32
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x7fff82]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[fuzz-exec] calling test64
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0xfffffffffff82]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[LoggingExternalInterface logging nan:0x8000000000000]
+[fuzz-exec] calling just-one-nan
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[fuzz-exec] calling ignore
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
+[LoggingExternalInterface logging nan:0x400000]
diff --git a/test/passes/optimize-instructions_fuzz-exec.wast b/test/passes/optimize-instructions_fuzz-exec.wast
new file mode 100644
index 000000000..317db04e4
--- /dev/null
+++ b/test/passes/optimize-instructions_fuzz-exec.wast
@@ -0,0 +1,206 @@
+(module
+ (import "fuzzing-support" "log-f32" (func $logf32 (param f32)))
+ (import "fuzzing-support" "log-f64" (func $logf64 (param f64)))
+ (func "test32"
+ (call $logf32
+ (f32.add
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.sub
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.mul
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.copysign
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.min
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.max
+ (f32.const -nan:0xffff82)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ )
+ (func "test64"
+ (call $logf64
+ (f64.add
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.sub
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.mul
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.div
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.copysign
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.min
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ (call $logf64
+ (f64.max
+ (f64.const -nan:0xfffffffffff82)
+ (f64.neg
+ (f64.const -nan:0xfffffffffa622)
+ )
+ )
+ )
+ )
+ (func "just-one-nan"
+ (call $logf32
+ (f32.add
+ (f32.const 0)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const -nan:0xfff622)
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const -0)
+ (f32.neg
+ (f32.const -nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const -nan:0xfff622)
+ (f32.neg
+ (f32.const -0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const 0)
+ (f32.neg
+ (f32.const nan:0xfff622)
+ )
+ )
+ )
+ (call $logf32
+ (f32.add
+ (f32.const nan:0xfff622)
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+ )
+ )
+ (func "ignore"
+ ;; none of these are nan inputs, so the interpreter must not change the sign
+ (call $logf32
+ (f32.div
+ (f32.const 0)
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const -0)
+ (f32.neg
+ (f32.const 0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const 0)
+ (f32.neg
+ (f32.const -0)
+ )
+ )
+ )
+ (call $logf32
+ (f32.div
+ (f32.const -0)
+ (f32.neg
+ (f32.const -0)
+ )
+ )
+ )
+ )
+)
+
diff --git a/test/spec/old_float_exprs.wast b/test/spec/old_float_exprs.wast
index 7900832b0..854e21a62 100644
--- a/test/spec/old_float_exprs.wast
+++ b/test/spec/old_float_exprs.wast
@@ -46,8 +46,8 @@
(assert_return (invoke "f32.no_fold_add_zero" (f32.const -0.0)) (f32.const 0.0))
(assert_return (invoke "f64.no_fold_add_zero" (f64.const -0.0)) (f64.const 0.0))
-(assert_return (invoke "f32.no_fold_add_zero" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_add_zero" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_add_zero" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_add_zero" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that 0.0 - x is not folded to -x.
@@ -60,8 +60,8 @@
(assert_return (invoke "f32.no_fold_zero_sub" (f32.const 0.0)) (f32.const 0.0))
(assert_return (invoke "f64.no_fold_zero_sub" (f64.const 0.0)) (f64.const 0.0))
-(assert_return (invoke "f32.no_fold_zero_sub" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_zero_sub" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_zero_sub" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_zero_sub" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x - 0.0 is not folded to x.
@@ -72,8 +72,8 @@
(f64.sub (local.get $x) (f64.const 0.0)))
)
-(assert_return (invoke "f32.no_fold_sub_zero" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_sub_zero" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_sub_zero" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_sub_zero" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x*0.0 is not folded to 0.0.
@@ -87,11 +87,11 @@
(assert_return (invoke "f32.no_fold_mul_zero" (f32.const -0.0)) (f32.const -0.0))
(assert_return (invoke "f32.no_fold_mul_zero" (f32.const -1.0)) (f32.const -0.0))
(assert_return (invoke "f32.no_fold_mul_zero" (f32.const -2.0)) (f32.const -0.0))
-(assert_return (invoke "f32.no_fold_mul_zero" (f32.const nan:0x200000)) (f32.const nan:0x600000))
+(assert_return (invoke "f32.no_fold_mul_zero" (f32.const nan:0x200000)) (f32.const nan:0x400000))
(assert_return (invoke "f64.no_fold_mul_zero" (f64.const -0.0)) (f64.const -0.0))
(assert_return (invoke "f64.no_fold_mul_zero" (f64.const -1.0)) (f64.const -0.0))
(assert_return (invoke "f64.no_fold_mul_zero" (f64.const -2.0)) (f64.const -0.0))
-(assert_return (invoke "f64.no_fold_mul_zero" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f64.no_fold_mul_zero" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x*1.0 is not folded to x.
;; See IEEE 754-2008 10.4 "Literal meaning and value-changing optimizations".
@@ -103,8 +103,8 @@
(f64.mul (local.get $x) (f64.const 1.0)))
)
-(assert_return (invoke "f32.no_fold_mul_one" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_mul_one" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_mul_one" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_mul_one" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that 0.0/x is not folded to 0.0.
@@ -118,11 +118,11 @@
(assert_return_nan (invoke "f32.no_fold_zero_div" (f32.const 0.0)))
(assert_return_nan (invoke "f32.no_fold_zero_div" (f32.const -0.0)))
(assert_return (invoke "f32.no_fold_zero_div" (f32.const nan)) (f32.const nan))
-(assert_return (invoke "f32.no_fold_zero_div" (f32.const nan:0x200000)) (f32.const nan:0x600000))
+(assert_return (invoke "f32.no_fold_zero_div" (f32.const nan:0x200000)) (f32.const nan:0x400000))
(assert_return_nan (invoke "f64.no_fold_zero_div" (f64.const 0.0)))
(assert_return_nan (invoke "f64.no_fold_zero_div" (f64.const -0.0)))
(assert_return (invoke "f64.no_fold_zero_div" (f64.const nan)) (f64.const nan))
-(assert_return (invoke "f64.no_fold_zero_div" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f64.no_fold_zero_div" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x/1.0 is not folded to x.
@@ -133,8 +133,8 @@
(f64.div (local.get $x) (f64.const 1.0)))
)
-(assert_return (invoke "f32.no_fold_div_one" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_div_one" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_div_one" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_div_one" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x/-1.0 is not folded to -x.
@@ -145,8 +145,8 @@
(f64.div (local.get $x) (f64.const -1.0)))
)
-(assert_return (invoke "f32.no_fold_div_neg1" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_div_neg1" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_div_neg1" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_div_neg1" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that -0.0 - x is not folded to -x.
@@ -157,8 +157,8 @@
(f64.sub (f64.const -0.0) (local.get $x)))
)
-(assert_return (invoke "f32.no_fold_neg0_sub" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_neg0_sub" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_neg0_sub" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_neg0_sub" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that -1.0 * x is not folded to -x.
@@ -169,8 +169,8 @@
(f64.mul (f64.const -1.0) (local.get $x)))
)
-(assert_return (invoke "f32.no_fold_neg1_mul" (f32.const nan:0x200000)) (f32.const nan:0x600000))
-(assert_return (invoke "f64.no_fold_neg1_mul" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f32.no_fold_neg1_mul" (f32.const nan:0x200000)) (f32.const nan:0x400000))
+(assert_return (invoke "f64.no_fold_neg1_mul" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x == x is not folded to true.
@@ -365,7 +365,7 @@
(assert_return (invoke "f32.no_fold_div_0" (f32.const -infinity)) (f32.const -infinity))
(assert_return_nan (invoke "f32.no_fold_div_0" (f32.const 0)))
(assert_return_nan (invoke "f32.no_fold_div_0" (f32.const -0)))
-(assert_return (invoke "f32.no_fold_div_0" (f32.const nan:0x200000)) (f32.const nan:0x600000))
+(assert_return (invoke "f32.no_fold_div_0" (f32.const nan:0x200000)) (f32.const nan:0x400000))
(assert_return (invoke "f32.no_fold_div_0" (f32.const nan)) (f32.const nan))
(assert_return (invoke "f64.no_fold_div_0" (f64.const 1.0)) (f64.const infinity))
(assert_return (invoke "f64.no_fold_div_0" (f64.const -1.0)) (f64.const -infinity))
@@ -374,7 +374,7 @@
(assert_return_nan (invoke "f64.no_fold_div_0" (f64.const 0)))
(assert_return_nan (invoke "f64.no_fold_div_0" (f64.const -0)))
(assert_return (invoke "f64.no_fold_div_0" (f64.const nan)) (f64.const nan))
-(assert_return (invoke "f64.no_fold_div_0" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f64.no_fold_div_0" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that x/-0 is not folded away.
@@ -391,7 +391,7 @@
(assert_return (invoke "f32.no_fold_div_neg0" (f32.const -infinity)) (f32.const infinity))
(assert_return_nan (invoke "f32.no_fold_div_neg0" (f32.const 0)))
(assert_return_nan (invoke "f32.no_fold_div_neg0" (f32.const -0)))
-(assert_return (invoke "f32.no_fold_div_neg0" (f32.const nan:0x200000)) (f32.const nan:0x600000))
+(assert_return (invoke "f32.no_fold_div_neg0" (f32.const nan:0x200000)) (f32.const nan:0x400000))
(assert_return (invoke "f32.no_fold_div_neg0" (f32.const nan)) (f32.const nan))
(assert_return (invoke "f64.no_fold_div_neg0" (f64.const 1.0)) (f64.const -infinity))
(assert_return (invoke "f64.no_fold_div_neg0" (f64.const -1.0)) (f64.const infinity))
@@ -400,7 +400,7 @@
(assert_return_nan (invoke "f64.no_fold_div_neg0" (f64.const 0)))
(assert_return_nan (invoke "f64.no_fold_div_neg0" (f64.const -0)))
(assert_return (invoke "f64.no_fold_div_neg0" (f64.const nan)) (f64.const nan))
-(assert_return (invoke "f64.no_fold_div_neg0" (f64.const nan:0x4000000000000)) (f64.const nan:0xc000000000000))
+(assert_return (invoke "f64.no_fold_div_neg0" (f64.const nan:0x4000000000000)) (f64.const nan:0x8000000000000))
;; Test that sqrt(x*x+y*y) is not folded to hypot.
diff --git a/test/spec/simd.wast b/test/spec/simd.wast
index 41b47170b..332d48d01 100644
--- a/test/spec/simd.wast
+++ b/test/spec/simd.wast
@@ -866,10 +866,10 @@
(assert_return (invoke "f32x4.neg" (v128.const f32x4 -0 nan -infinity 5)) (v128.const f32x4 0 -nan infinity -5))
(assert_return (invoke "f32x4.sqrt" (v128.const f32x4 -0 nan infinity 4)) (v128.const f32x4 -0 nan infinity 2))
;; TODO: qfma/qfms tests
-(assert_return (invoke "f32x4.add" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity infinity 1)) (v128.const f32x4 nan -nan infinity 43))
-(assert_return (invoke "f32x4.sub" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity -infinity 1)) (v128.const f32x4 nan -nan infinity 41))
-(assert_return (invoke "f32x4.mul" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity infinity 2)) (v128.const f32x4 nan -nan infinity 84))
-(assert_return (invoke "f32x4.div" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity 2 2)) (v128.const f32x4 nan -nan infinity 21))
+(assert_return (invoke "f32x4.add" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity infinity 1)) (v128.const f32x4 nan nan infinity 43))
+(assert_return (invoke "f32x4.sub" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity -infinity 1)) (v128.const f32x4 nan nan infinity 41))
+(assert_return (invoke "f32x4.mul" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity infinity 2)) (v128.const f32x4 nan nan infinity 84))
+(assert_return (invoke "f32x4.div" (v128.const f32x4 nan -nan infinity 42) (v128.const f32x4 42 infinity 2 2)) (v128.const f32x4 nan nan infinity 21))
(assert_return (invoke "f32x4.min" (v128.const f32x4 -0 0 nan 5) (v128.const f32x4 0 -0 5 nan)) (v128.const f32x4 -0 -0 nan nan))
(assert_return (invoke "f32x4.max" (v128.const f32x4 -0 0 nan 5) (v128.const f32x4 0 -0 5 nan)) (v128.const f32x4 0 0 nan nan))
(assert_return (invoke "f32x4.pmin" (v128.const f32x4 -0 0 nan 5) (v128.const f32x4 0 -0 5 nan)) (v128.const f32x4 -0 0 nan 5))
@@ -895,13 +895,13 @@
(assert_return (invoke "f64x2.sqrt" (v128.const f64x2 -0 nan)) (v128.const f64x2 -0 nan))
(assert_return (invoke "f64x2.sqrt" (v128.const f64x2 infinity 4)) (v128.const f64x2 infinity 2))
;; TODO: qfma/qfms tests
-(assert_return (invoke "f64x2.add" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan -nan))
+(assert_return (invoke "f64x2.add" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan nan))
(assert_return (invoke "f64x2.add" (v128.const f64x2 infinity 42) (v128.const f64x2 infinity 1)) (v128.const f64x2 infinity 43))
-(assert_return (invoke "f64x2.sub" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan -nan))
+(assert_return (invoke "f64x2.sub" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan nan))
(assert_return (invoke "f64x2.sub" (v128.const f64x2 infinity 42) (v128.const f64x2 -infinity 1)) (v128.const f64x2 infinity 41))
-(assert_return (invoke "f64x2.mul" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan -nan))
+(assert_return (invoke "f64x2.mul" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan nan))
(assert_return (invoke "f64x2.mul" (v128.const f64x2 infinity 42) (v128.const f64x2 infinity 2)) (v128.const f64x2 infinity 84))
-(assert_return (invoke "f64x2.div" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan -nan))
+(assert_return (invoke "f64x2.div" (v128.const f64x2 nan -nan) (v128.const f64x2 42 infinity)) (v128.const f64x2 nan nan))
(assert_return (invoke "f64x2.div" (v128.const f64x2 infinity 42) (v128.const f64x2 2 2)) (v128.const f64x2 infinity 21))
(assert_return (invoke "f64x2.min" (v128.const f64x2 -0 0) (v128.const f64x2 0 -0)) (v128.const f64x2 -0 -0))
(assert_return (invoke "f64x2.min" (v128.const f64x2 nan 5) (v128.const f64x2 5 nan)) (v128.const f64x2 nan nan))