summaryrefslogtreecommitdiff
path: root/test/spec
diff options
context:
space:
mode:
authorBrendan Dahl <brendan.dahl@gmail.com>2024-08-09 09:13:33 -0700
committerGitHub <noreply@github.com>2024-08-09 09:13:33 -0700
commitb3e22d29451fbf52521d59ea34e8a5d735c4149c (patch)
tree034a8d510b7d6fa7589115ac2a046b11585390ce /test/spec
parentd945aa489a1ad62c130e04ceea8492c7a728ab57 (diff)
downloadbinaryen-b3e22d29451fbf52521d59ea34e8a5d735c4149c.tar.gz
binaryen-b3e22d29451fbf52521d59ea34e8a5d735c4149c.tar.bz2
binaryen-b3e22d29451fbf52521d59ea34e8a5d735c4149c.zip
[FP16] Implement relation operations. (#6825)
Specified at https://github.com/WebAssembly/half-precision/blob/main/proposals/half-precision/Overview.md
Diffstat (limited to 'test/spec')
-rw-r--r--test/spec/f16.wast56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/spec/f16.wast b/test/spec/f16.wast
index ef32b2ab5..360464e15 100644
--- a/test/spec/f16.wast
+++ b/test/spec/f16.wast
@@ -11,6 +11,12 @@
(func (export "f16x8.extract_lane_last") (param $0 v128) (result f32) (f16x8.extract_lane 7 (local.get $0)))
(func (export "f16x8.replace_lane_first") (param $0 v128) (param $1 f32) (result v128) (f16x8.replace_lane 0 (local.get $0) (local.get $1)))
(func (export "f16x8.replace_lane_last") (param $0 v128) (param $1 f32) (result v128) (f16x8.replace_lane 7 (local.get $0) (local.get $1)))
+ (func (export "f16x8.eq") (param $0 v128) (param $1 v128) (result v128) (f16x8.eq (local.get $0) (local.get $1)))
+ (func (export "f16x8.ne") (param $0 v128) (param $1 v128) (result v128) (f16x8.ne (local.get $0) (local.get $1)))
+ (func (export "f16x8.lt") (param $0 v128) (param $1 v128) (result v128) (f16x8.lt (local.get $0) (local.get $1)))
+ (func (export "f16x8.gt") (param $0 v128) (param $1 v128) (result v128) (f16x8.gt (local.get $0) (local.get $1)))
+ (func (export "f16x8.le") (param $0 v128) (param $1 v128) (result v128) (f16x8.le (local.get $0) (local.get $1)))
+ (func (export "f16x8.ge") (param $0 v128) (param $1 v128) (result v128) (f16x8.ge (local.get $0) (local.get $1)))
)
(assert_return (invoke "f32.load_f16") (f32.const 42.0))
@@ -25,3 +31,53 @@
(assert_return (invoke "f16x8.extract_lane_last" (v128.const i16x8 0 0 0 0 0 0 0 0xc500)) (f32.const -5))
(assert_return (invoke "f16x8.replace_lane_first" (v128.const i64x2 0 0) (f32.const 100.5)) (v128.const i16x8 0x5648 0 0 0 0 0 0 0))
(assert_return (invoke "f16x8.replace_lane_last" (v128.const i64x2 0 0) (f32.const 100.5)) (v128.const i16x8 0 0 0 0 0 0 0 0x5648))
+
+;; comparisons
+(assert_return (invoke "f16x8.eq"
+ ;; 0 -1 1 nan inf nan inf nan
+ ;; 0 0 -1 nan inf 0 -inf inf
+ (v128.const i16x8 0 0xbc00 0x3c00 0x7e00 0x7c00 0x7e00 0x7c00 0x7e00)
+ (v128.const i16x8 0 0 0xbc00 0x7e00 0x7c00 0 0xfc00 0x7c00)
+ )
+ (v128.const i16x8 -1 0 0 0 -1 0 0 0)
+)
+(assert_return (invoke "f16x8.ne"
+ ;; 0 -1 1 nan inf nan inf nan
+ ;; 0 0 -1 nan inf 0 -inf inf
+ (v128.const i16x8 0 0xbc00 0x3c00 0x7e00 0x7c00 0x7e00 0x7c00 0x7e00)
+ (v128.const i16x8 0 0 0xbc00 0x7e00 0x7c00 0 0xfc00 0x7c00)
+ )
+ (v128.const i16x8 0 -1 -1 -1 0 -1 -1 -1)
+)
+(assert_return (invoke "f16x8.lt"
+ ;; 0 -1 1 nan inf nan inf nan
+ ;; 0 0 -1 nan inf 0 -inf inf
+ (v128.const i16x8 0 0xbc00 0x3c00 0x7e00 0x7c00 0x7e00 0x7c00 0x7e00)
+ (v128.const i16x8 0 0 0xbc00 0x7e00 0x7c00 0 0xfc00 0x7c00)
+ )
+ (v128.const i16x8 0 -1 0 0 0 0 0 0)
+)
+(assert_return (invoke "f16x8.gt"
+ ;; 0 -1 1 nan inf nan inf nan
+ ;; 0 0 -1 nan inf 0 -inf inf
+ (v128.const i16x8 0 0xbc00 0x3c00 0x7e00 0x7c00 0x7e00 0x7c00 0x7e00)
+ (v128.const i16x8 0 0 0xbc00 0x7e00 0x7c00 0 0xfc00 0x7c00)
+ )
+ (v128.const i16x8 0 0 -1 0 0 0 -1 0)
+)
+(assert_return (invoke "f16x8.le"
+ ;; 0 -1 1 nan inf nan inf nan
+ ;; 0 0 -1 nan inf 0 -inf inf
+ (v128.const i16x8 0 0xbc00 0x3c00 0x7e00 0x7c00 0x7e00 0x7c00 0x7e00)
+ (v128.const i16x8 0 0 0xbc00 0x7e00 0x7c00 0 0xfc00 0x7c00)
+ )
+ (v128.const i16x8 -1 -1 0 0 -1 0 0 0)
+)
+(assert_return (invoke "f16x8.ge"
+ ;; 0 -1 1 nan inf nan inf nan
+ ;; 0 0 -1 nan inf 0 -inf inf
+ (v128.const i16x8 0 0xbc00 0x3c00 0x7e00 0x7c00 0x7e00 0x7c00 0x7e00)
+ (v128.const i16x8 0 0 0xbc00 0x7e00 0x7c00 0 0xfc00 0x7c00)
+ )
+ (v128.const i16x8 -1 0 -1 0 -1 0 -1 0)
+)