summaryrefslogtreecommitdiff
path: root/test/gen-spec-js
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-03-24 14:44:37 -0700
committerGitHub <noreply@github.com>2017-03-24 14:44:37 -0700
commitaad6e98314bc4225dca7e12aa9795cb0ad87f21e (patch)
treef1b7ad8914a19a169e9e256f0a1dd211616df3c8 /test/gen-spec-js
parent41d597d678b6443d9e8a692316271ceafd8bcc2d (diff)
downloadwabt-aad6e98314bc4225dca7e12aa9795cb0ad87f21e.tar.gz
wabt-aad6e98314bc4225dca7e12aa9795cb0ad87f21e.tar.bz2
wabt-aad6e98314bc4225dca7e12aa9795cb0ad87f21e.zip
Support arithmetic/canonical NaN; update testsuite (#368)
Positive NaN (+nan) is defined as being a NaN value where the sign bit is clear, the exponent is all ones, and the tag has only the "quiet" bit set. The quiet bit is the most-significant bit of the tag. For example, for a 32-bit float, +nan is 0x7cf00000. "Canonical NaN" is either +nan or -nan, where -nan is +nan with the sign bit set. "Arithmetic NaN" is defined as any other quiet NaN (i.e. the quiet bit must be set, but any other bit can be either 0 or 1.) This change doesn't update the interpreter because it is only a loosening of the previous NaN behavior.
Diffstat (limited to 'test/gen-spec-js')
-rw-r--r--test/gen-spec-js/assert_return_nan.txt31
1 files changed, 25 insertions, 6 deletions
diff --git a/test/gen-spec-js/assert_return_nan.txt b/test/gen-spec-js/assert_return_nan.txt
index 754d1345..b154c108 100644
--- a/test/gen-spec-js/assert_return_nan.txt
+++ b/test/gen-spec-js/assert_return_nan.txt
@@ -1,16 +1,35 @@
;;; TOOL: run-gen-spec-js
;;; FLAGS: --prefix=%(test_dir)s/gen-spec-empty-prefix.js
(module
- (func (export "nan") (result f32) f32.const nan)
- (func (export "passthru") (param f32) (result f32) get_local 0))
+ (func (export "f32_nan") (result f32) f32.const nan)
+ (func (export "f32_nan_with_tag") (result f32) f32.const nan:0x1234)
+ (func (export "f32_passthru") (param f32) (result f32) get_local 0)
+
+ (func (export "f64_nan") (result f64) f64.const nan)
+ (func (export "f64_nan_with_tag") (result f64) f64.const nan:0x1234)
+ (func (export "f64_passthru") (param f64) (result f64) get_local 0))
+
+(assert_return_canonical_nan (invoke "f32_nan"))
+(assert_return_arithmetic_nan (invoke "f32_nan_with_tag"))
+(assert_return_canonical_nan (invoke "f64_nan"))
+(assert_return_arithmetic_nan (invoke "f64_nan_with_tag"))
-(assert_return_nan (invoke "nan"))
;; Rewritten to avoid passing nan as a parameter.
-(assert_return_nan (invoke "passthru" (f32.const -nan)))
+(assert_return_canonical_nan (invoke "f32_passthru" (f32.const -nan)))
+(assert_return_arithmetic_nan (invoke "f32_passthru" (f32.const nan:0x1234)))
+(assert_return_canonical_nan (invoke "f64_passthru" (f64.const -nan)))
+(assert_return_arithmetic_nan (invoke "f64_passthru" (f64.const nan:0x1234)))
+
(;; STDOUT ;;;
// A deliberately empty file for testing.
-$$ = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x0d\x03\x60\x00\x01\x7d\x60\x01\x7d\x01\x7d\x60\x00\x00\x03\x04\x03\x00\x01\x02\x07\x1d\x03\x03\x6e\x61\x6e\x00\x00\x08\x70\x61\x73\x73\x74\x68\x72\x75\x00\x01\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x02\x0a\x29\x03\x07\x00\x43\x00\x00\xc0\x7f\x0b\x04\x00\x20\x00\x0b\x1a\x01\x01\x7d\x02\x40\x43\x00\x00\xc0\xff\x10\x01\x22\x00\xbc\x20\x00\xbc\x46\x45\x0d\x00\x0f\x0b\x00\x0b");
-assert_return_nan(() => $$.exports["nan"]());
+$$ = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x16\x05\x60\x00\x01\x7d\x60\x01\x7d\x01\x7d\x60\x00\x01\x7c\x60\x01\x7c\x01\x7c\x60\x00\x00\x03\x0b\x0a\x00\x00\x01\x02\x02\x03\x04\x04\x04\x04\x07\x85\x01\x0a\x07\x66\x33\x32\x5f\x6e\x61\x6e\x00\x00\x10\x66\x33\x32\x5f\x6e\x61\x6e\x5f\x77\x69\x74\x68\x5f\x74\x61\x67\x00\x01\x0c\x66\x33\x32\x5f\x70\x61\x73\x73\x74\x68\x72\x75\x00\x02\x07\x66\x36\x34\x5f\x6e\x61\x6e\x00\x03\x10\x66\x36\x34\x5f\x6e\x61\x6e\x5f\x77\x69\x74\x68\x5f\x74\x61\x67\x00\x04\x0c\x66\x36\x34\x5f\x70\x61\x73\x73\x74\x68\x72\x75\x00\x05\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x06\x08\x61\x73\x73\x65\x72\x74\x5f\x31\x00\x07\x08\x61\x73\x73\x65\x72\x74\x5f\x32\x00\x08\x08\x61\x73\x73\x65\x72\x74\x5f\x33\x00\x09\x0a\xd3\x01\x0a\x07\x00\x43\x00\x00\xc0\x7f\x0b\x07\x00\x43\x34\x12\x80\x7f\x0b\x04\x00\x20\x00\x0b\x0b\x00\x44\x00\x00\x00\x00\x00\x00\xf8\x7f\x0b\x0b\x00\x44\x34\x12\x00\x00\x00\x00\xf0\x7f\x0b\x04\x00\x20\x00\x0b\x20\x00\x02\x40\x43\x00\x00\xc0\xff\x10\x02\xbc\x41\xff\xff\xff\xff\x07\x71\x41\x80\x80\x80\xfe\x07\x46\x45\x0d\x00\x0f\x0b\x00\x0b\x20\x00\x02\x40\x43\x34\x12\x80\x7f\x10\x02\xbc\x41\x80\x80\x80\xfe\x07\x71\x41\x80\x80\x80\xfe\x07\x46\x45\x0d\x00\x0f\x0b\x00\x0b\x2e\x00\x02\x40\x44\x00\x00\x00\x00\x00\x00\xf8\xff\x10\x05\xbd\x42\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x83\x42\x80\x80\x80\x80\x80\x80\x80\xfc\xff\x00\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x2e\x00\x02\x40\x44\x34\x12\x00\x00\x00\x00\xf0\x7f\x10\x05\xbd\x42\x80\x80\x80\x80\x80\x80\x80\xfc\xff\x00\x83\x42\x80\x80\x80\x80\x80\x80\x80\xfc\xff\x00\x51\x45\x0d\x00\x0f\x0b\x00\x0b");
+assert_return_canonical_nan(() => $$.exports["f32_nan"]());
+assert_return_arithmetic_nan(() => $$.exports["f32_nan_with_tag"]());
+assert_return_canonical_nan(() => $$.exports["f64_nan"]());
+assert_return_arithmetic_nan(() => $$.exports["f64_nan_with_tag"]());
assert_return(() => $$.exports["assert_0"]());
+assert_return(() => $$.exports["assert_1"]());
+assert_return(() => $$.exports["assert_2"]());
+assert_return(() => $$.exports["assert_3"]());
;;; STDOUT ;;)