diff options
author | Brendan Dahl <brendan.dahl@gmail.com> | 2024-08-27 11:14:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-27 11:14:54 -0700 |
commit | 6c2d0e20906248ab8f8365702b35fd67db29c44f (patch) | |
tree | 17bdd816e894b7872b90e4a81262e3adb65de1af /test/lit/basic | |
parent | 459bc0797f67cb2a8fd4598bb7143b34036608d9 (diff) | |
download | binaryen-6c2d0e20906248ab8f8365702b35fd67db29c44f.tar.gz binaryen-6c2d0e20906248ab8f8365702b35fd67db29c44f.tar.bz2 binaryen-6c2d0e20906248ab8f8365702b35fd67db29c44f.zip |
[FP16] Implement unary operations. (#6867)
Specified at
https://github.com/WebAssembly/half-precision/blob/main/proposals/half-precision/Overview.md
Diffstat (limited to 'test/lit/basic')
-rw-r--r-- | test/lit/basic/f16.wast | 213 |
1 files changed, 183 insertions, 30 deletions
diff --git a/test/lit/basic/f16.wast b/test/lit/basic/f16.wast index df3c0ef2d..2e5ac57dd 100644 --- a/test/lit/basic/f16.wast +++ b/test/lit/basic/f16.wast @@ -15,38 +15,42 @@ ;; CHECK-TEXT: (type $0 (func (param v128 v128) (result v128))) - ;; CHECK-TEXT: (type $1 (func (param i32) (result f32))) + ;; CHECK-TEXT: (type $1 (func (param v128) (result v128))) - ;; CHECK-TEXT: (type $2 (func (param i32 f32))) + ;; CHECK-TEXT: (type $2 (func (param i32) (result f32))) - ;; CHECK-TEXT: (type $3 (func (param f32) (result v128))) + ;; CHECK-TEXT: (type $3 (func (param i32 f32))) - ;; CHECK-TEXT: (type $4 (func (param v128) (result f32))) + ;; CHECK-TEXT: (type $4 (func (param f32) (result v128))) - ;; CHECK-TEXT: (type $5 (func (param v128 f32) (result v128))) + ;; CHECK-TEXT: (type $5 (func (param v128) (result f32))) + + ;; CHECK-TEXT: (type $6 (func (param v128 f32) (result v128))) ;; CHECK-TEXT: (memory $0 1 1) - ;; CHECK-TEXT: (func $f32.load_f16 (type $1) (param $0 i32) (result f32) + ;; CHECK-TEXT: (func $f32.load_f16 (type $2) (param $0 i32) (result f32) ;; CHECK-TEXT-NEXT: (f32.load_f16 ;; CHECK-TEXT-NEXT: (local.get $0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $0 (func (param v128 v128) (result v128))) - ;; CHECK-BIN: (type $1 (func (param i32) (result f32))) + ;; CHECK-BIN: (type $1 (func (param v128) (result v128))) + + ;; CHECK-BIN: (type $2 (func (param i32) (result f32))) - ;; CHECK-BIN: (type $2 (func (param i32 f32))) + ;; CHECK-BIN: (type $3 (func (param i32 f32))) - ;; CHECK-BIN: (type $3 (func (param f32) (result v128))) + ;; CHECK-BIN: (type $4 (func (param f32) (result v128))) - ;; CHECK-BIN: (type $4 (func (param v128) (result f32))) + ;; CHECK-BIN: (type $5 (func (param v128) (result f32))) - ;; CHECK-BIN: (type $5 (func (param v128 f32) (result v128))) + ;; CHECK-BIN: (type $6 (func (param v128 f32) (result v128))) ;; CHECK-BIN: (memory $0 1 1) - ;; CHECK-BIN: (func $f32.load_f16 (type $1) (param $0 i32) (result f32) + ;; CHECK-BIN: (func $f32.load_f16 (type $2) (param $0 i32) (result f32) ;; CHECK-BIN-NEXT: (f32.load_f16 ;; CHECK-BIN-NEXT: (local.get $0) ;; CHECK-BIN-NEXT: ) @@ -56,13 +60,13 @@ (local.get $0) ) ) - ;; CHECK-TEXT: (func $f32.store_f16 (type $2) (param $0 i32) (param $1 f32) + ;; CHECK-TEXT: (func $f32.store_f16 (type $3) (param $0 i32) (param $1 f32) ;; CHECK-TEXT-NEXT: (f32.store_f16 ;; CHECK-TEXT-NEXT: (local.get $0) ;; CHECK-TEXT-NEXT: (local.get $1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $f32.store_f16 (type $2) (param $0 i32) (param $1 f32) + ;; CHECK-BIN: (func $f32.store_f16 (type $3) (param $0 i32) (param $1 f32) ;; CHECK-BIN-NEXT: (f32.store_f16 ;; CHECK-BIN-NEXT: (local.get $0) ;; CHECK-BIN-NEXT: (local.get $1) @@ -75,12 +79,12 @@ ) ) - ;; CHECK-TEXT: (func $f16x8.splat (type $3) (param $0 f32) (result v128) + ;; CHECK-TEXT: (func $f16x8.splat (type $4) (param $0 f32) (result v128) ;; CHECK-TEXT-NEXT: (f16x8.splat ;; CHECK-TEXT-NEXT: (local.get $0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $f16x8.splat (type $3) (param $0 f32) (result v128) + ;; CHECK-BIN: (func $f16x8.splat (type $4) (param $0 f32) (result v128) ;; CHECK-BIN-NEXT: (f16x8.splat ;; CHECK-BIN-NEXT: (local.get $0) ;; CHECK-BIN-NEXT: ) @@ -91,12 +95,12 @@ ) ) - ;; CHECK-TEXT: (func $f16x8.extract_lane (type $4) (param $0 v128) (result f32) + ;; CHECK-TEXT: (func $f16x8.extract_lane (type $5) (param $0 v128) (result f32) ;; CHECK-TEXT-NEXT: (f16x8.extract_lane 0 ;; CHECK-TEXT-NEXT: (local.get $0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $f16x8.extract_lane (type $4) (param $0 v128) (result f32) + ;; CHECK-BIN: (func $f16x8.extract_lane (type $5) (param $0 v128) (result f32) ;; CHECK-BIN-NEXT: (f16x8.extract_lane 0 ;; CHECK-BIN-NEXT: (local.get $0) ;; CHECK-BIN-NEXT: ) @@ -107,13 +111,13 @@ ) ) - ;; CHECK-TEXT: (func $f16x8.replace_lane (type $5) (param $0 v128) (param $1 f32) (result v128) + ;; CHECK-TEXT: (func $f16x8.replace_lane (type $6) (param $0 v128) (param $1 f32) (result v128) ;; CHECK-TEXT-NEXT: (f16x8.replace_lane 0 ;; CHECK-TEXT-NEXT: (local.get $0) ;; CHECK-TEXT-NEXT: (local.get $1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $f16x8.replace_lane (type $5) (param $0 v128) (param $1 f32) (result v128) + ;; CHECK-BIN: (func $f16x8.replace_lane (type $6) (param $0 v128) (param $1 f32) (result v128) ;; CHECK-BIN-NEXT: (f16x8.replace_lane 0 ;; CHECK-BIN-NEXT: (local.get $0) ;; CHECK-BIN-NEXT: (local.get $1) @@ -377,47 +381,154 @@ (local.get $1) ) ) + ;; CHECK-TEXT: (func $f16x8.abs (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.abs + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.abs (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.abs + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.abs (param $0 v128) (result v128) + (f16x8.abs + (local.get $0) + ) + ) + ;; CHECK-TEXT: (func $f16x8.neg (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.neg + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.neg (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.neg + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.neg (param $0 v128) (result v128) + (f16x8.neg + (local.get $0) + ) + ) + ;; CHECK-TEXT: (func $f16x8.sqrt (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.sqrt + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.sqrt (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.sqrt + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.sqrt (param $0 v128) (result v128) + (f16x8.sqrt + (local.get $0) + ) + ) + ;; CHECK-TEXT: (func $f16x8.ceil (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.ceil + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.ceil (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.ceil + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.ceil (param $0 v128) (result v128) + (f16x8.ceil + (local.get $0) + ) + ) + ;; CHECK-TEXT: (func $f16x8.floor (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.floor + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.floor (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.floor + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.floor (param $0 v128) (result v128) + (f16x8.floor + (local.get $0) + ) + ) + ;; CHECK-TEXT: (func $f16x8.trunc (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.trunc + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.trunc (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.trunc + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.trunc (param $0 v128) (result v128) + (f16x8.trunc + (local.get $0) + ) + ) + ;; CHECK-TEXT: (func $f16x8.nearest (type $1) (param $0 v128) (result v128) + ;; CHECK-TEXT-NEXT: (f16x8.nearest + ;; CHECK-TEXT-NEXT: (local.get $0) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-TEXT-NEXT: ) + ;; CHECK-BIN: (func $f16x8.nearest (type $1) (param $0 v128) (result v128) + ;; CHECK-BIN-NEXT: (f16x8.nearest + ;; CHECK-BIN-NEXT: (local.get $0) + ;; CHECK-BIN-NEXT: ) + ;; CHECK-BIN-NEXT: ) + (func $f16x8.nearest (param $0 v128) (result v128) + (f16x8.nearest + (local.get $0) + ) + ) ) ;; CHECK-BIN-NODEBUG: (type $0 (func (param v128 v128) (result v128))) -;; CHECK-BIN-NODEBUG: (type $1 (func (param i32) (result f32))) +;; CHECK-BIN-NODEBUG: (type $1 (func (param v128) (result v128))) -;; CHECK-BIN-NODEBUG: (type $2 (func (param i32 f32))) +;; CHECK-BIN-NODEBUG: (type $2 (func (param i32) (result f32))) -;; CHECK-BIN-NODEBUG: (type $3 (func (param f32) (result v128))) +;; CHECK-BIN-NODEBUG: (type $3 (func (param i32 f32))) -;; CHECK-BIN-NODEBUG: (type $4 (func (param v128) (result f32))) +;; CHECK-BIN-NODEBUG: (type $4 (func (param f32) (result v128))) -;; CHECK-BIN-NODEBUG: (type $5 (func (param v128 f32) (result v128))) +;; CHECK-BIN-NODEBUG: (type $5 (func (param v128) (result f32))) + +;; CHECK-BIN-NODEBUG: (type $6 (func (param v128 f32) (result v128))) ;; CHECK-BIN-NODEBUG: (memory $0 1 1) -;; CHECK-BIN-NODEBUG: (func $0 (type $1) (param $0 i32) (result f32) +;; CHECK-BIN-NODEBUG: (func $0 (type $2) (param $0 i32) (result f32) ;; CHECK-BIN-NODEBUG-NEXT: (f32.load_f16 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG: (func $1 (type $2) (param $0 i32) (param $1 f32) +;; CHECK-BIN-NODEBUG: (func $1 (type $3) (param $0 i32) (param $1 f32) ;; CHECK-BIN-NODEBUG-NEXT: (f32.store_f16 ;; 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 $2 (type $3) (param $0 f32) (result v128) +;; CHECK-BIN-NODEBUG: (func $2 (type $4) (param $0 f32) (result v128) ;; CHECK-BIN-NODEBUG-NEXT: (f16x8.splat ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG: (func $3 (type $4) (param $0 v128) (result f32) +;; CHECK-BIN-NODEBUG: (func $3 (type $5) (param $0 v128) (result f32) ;; CHECK-BIN-NODEBUG-NEXT: (f16x8.extract_lane 0 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG: (func $4 (type $5) (param $0 v128) (param $1 f32) (result v128) +;; CHECK-BIN-NODEBUG: (func $4 (type $6) (param $0 v128) (param $1 f32) (result v128) ;; CHECK-BIN-NODEBUG-NEXT: (f16x8.replace_lane 0 ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) @@ -521,3 +632,45 @@ ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) ;; CHECK-BIN-NODEBUG-NEXT: ) ;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $19 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.abs +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $20 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.neg +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $21 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.sqrt +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $22 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.ceil +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $23 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.floor +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $24 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.trunc +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) + +;; CHECK-BIN-NODEBUG: (func $25 (type $1) (param $0 v128) (result v128) +;; CHECK-BIN-NODEBUG-NEXT: (f16x8.nearest +;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) +;; CHECK-BIN-NODEBUG-NEXT: ) +;; CHECK-BIN-NODEBUG-NEXT: ) |