summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/basic/f16.wast201
-rw-r--r--test/spec/f16.wast66
2 files changed, 266 insertions, 1 deletions
diff --git a/test/lit/basic/f16.wast b/test/lit/basic/f16.wast
index 21c9fc100..df3c0ef2d 100644
--- a/test/lit/basic/f16.wast
+++ b/test/lit/basic/f16.wast
@@ -233,7 +233,150 @@
(local.get $1)
)
)
-
+ ;; CHECK-TEXT: (func $f16x8.add (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.add
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.add (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.add
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.add (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.add
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.sub (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.sub
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.sub (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.sub
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.sub (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.sub
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.mul (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.mul
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.mul (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.mul
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.mul (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.mul
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.div (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.div
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.div (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.div
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.div (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.div
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.min (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.min
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.min (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.min
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.min (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.min
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.max (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.max
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.max (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.max
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.max (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.max
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.pmin (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.pmin
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.pmin (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.pmin
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.pmin (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.pmin
+ (local.get $0)
+ (local.get $1)
+ )
+ )
+ ;; CHECK-TEXT: (func $f16x8.pmax (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-TEXT-NEXT: (f16x8.pmax
+ ;; CHECK-TEXT-NEXT: (local.get $0)
+ ;; CHECK-TEXT-NEXT: (local.get $1)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $f16x8.pmax (type $0) (param $0 v128) (param $1 v128) (result v128)
+ ;; CHECK-BIN-NEXT: (f16x8.pmax
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $f16x8.pmax (param $0 v128) (param $1 v128) (result v128)
+ (f16x8.pmax
+ (local.get $0)
+ (local.get $1)
+ )
+ )
)
;; CHECK-BIN-NODEBUG: (type $0 (func (param v128 v128) (result v128)))
@@ -322,3 +465,59 @@
;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $11 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.add
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $12 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.sub
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $13 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.mul
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $14 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.div
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $15 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.min
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $16 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.max
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $17 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.pmin
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $18 (type $0) (param $0 v128) (param $1 v128) (result v128)
+;; CHECK-BIN-NODEBUG-NEXT: (f16x8.pmax
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
diff --git a/test/spec/f16.wast b/test/spec/f16.wast
index 360464e15..70d0043f7 100644
--- a/test/spec/f16.wast
+++ b/test/spec/f16.wast
@@ -17,6 +17,14 @@
(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)))
+ (func (export "f16x8.add") (param $0 v128) (param $1 v128) (result v128) (f16x8.add (local.get $0) (local.get $1)))
+ (func (export "f16x8.sub") (param $0 v128) (param $1 v128) (result v128) (f16x8.sub (local.get $0) (local.get $1)))
+ (func (export "f16x8.mul") (param $0 v128) (param $1 v128) (result v128) (f16x8.mul (local.get $0) (local.get $1)))
+ (func (export "f16x8.div") (param $0 v128) (param $1 v128) (result v128) (f16x8.div (local.get $0) (local.get $1)))
+ (func (export "f16x8.min") (param $0 v128) (param $1 v128) (result v128) (f16x8.min (local.get $0) (local.get $1)))
+ (func (export "f16x8.max") (param $0 v128) (param $1 v128) (result v128) (f16x8.max (local.get $0) (local.get $1)))
+ (func (export "f16x8.pmin") (param $0 v128) (param $1 v128) (result v128) (f16x8.pmin (local.get $0) (local.get $1)))
+ (func (export "f16x8.pmax") (param $0 v128) (param $1 v128) (result v128) (f16x8.pmax (local.get $0) (local.get $1)))
)
(assert_return (invoke "f32.load_f16") (f32.const 42.0))
@@ -81,3 +89,61 @@
)
(v128.const i16x8 -1 0 -1 0 -1 0 -1 0)
)
+
+;; arithmetic operations
+(assert_return (invoke "f16x8.add"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan nan inf 3 -1 0 1 2
+ (v128.const i16x8 0x7e00 0x7e00 0x7c00 0x4200 0xbc00 0 0x3c00 0x4000))
+(assert_return (invoke "f16x8.sub"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan nan nan 0 -1 -2 1 0
+ (v128.const i16x8 0x7e00 0x7e00 0x7e00 0 0xbc00 0xc000 0x3c00 0))
+(assert_return (invoke "f16x8.mul"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan nan inf 2.25 0 -1 0 1
+ (v128.const i16x8 0x7e00 0x7e00 0x7c00 0x4080 0x8000 0xbc00 0 0x3c00))
+(assert_return (invoke "f16x8.div"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan nan nan 1 -inf -1 inf 1
+ (v128.const i16x8 0x7e00 0x7e00 0x7e00 0x3c00 0xfc00 0xbc00 0x7c00 0x3c00))
+(assert_return (invoke "f16x8.min"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan nan inf 1.5 -1 -1 0 1
+ (v128.const i16x8 0x7e00 0x7e00 0x7c00 0x3e00 0xbc00 0xbc00 0 0x3c00))
+(assert_return (invoke "f16x8.max"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan nan inf 1.5 0 1 1 1
+ (v128.const i16x8 0x7e00 0x7e00 0x7c00 0x3e00 0 0x3c00 0x3c00 0x3c00))
+(assert_return (invoke "f16x8.pmin"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan -nan inf 1.5 -1 -1 0 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0 0x3c00))
+(assert_return (invoke "f16x8.pmax"
+ ;; nan -nan inf 1.5 -1 -1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0xbc00 0xbc00 0x3c00 0x3c00)
+ ;; 42 -nan inf 1.5 0 1 0 1
+ (v128.const i16x8 0x5140 0xfe00 0x7c00 0x3e00 0 0x3c00 0 0x3c00))
+ ;; nan -nan inf 1.5 0 1 1 1
+ (v128.const i16x8 0x7e00 0xfe00 0x7c00 0x3e00 0 0x3c00 0x3c00 0x3c00))