wa-lang.org/wazero@v1.0.2/internal/integration_test/spectest/v2/testdata/simd_i64x2_arith2.wast (about)

     1  ;; Tests for i64x2 [abs] operations.
     2  
     3  (module
     4    (func (export "i64x2.abs") (param v128) (result v128) (i64x2.abs (local.get 0)))
     5    (func (export "i64x2.abs_with_const_0") (result v128) (i64x2.abs (v128.const i64x2 -9223372036854775808 9223372036854775807)))
     6  )
     7  
     8  (assert_return (invoke "i64x2.abs" (v128.const i64x2 1 1))
     9                                     (v128.const i64x2 1 1))
    10  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -1 -1))
    11                                     (v128.const i64x2 1 1))
    12  (assert_return (invoke "i64x2.abs" (v128.const i64x2 18446744073709551615 18446744073709551615))
    13                                     (v128.const i64x2 1 1))
    14  (assert_return (invoke "i64x2.abs" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff))
    15                                     (v128.const i64x2 0x1 0x1))
    16  (assert_return (invoke "i64x2.abs" (v128.const i64x2 9223372036854775808 9223372036854775808))
    17                                     (v128.const i64x2 9223372036854775808 9223372036854775808))
    18  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -9223372036854775808 -9223372036854775808))
    19                                     (v128.const i64x2 9223372036854775808 9223372036854775808))
    20  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -0x8000000000000000 -0x8000000000000000))
    21                                     (v128.const i64x2 0x8000000000000000 0x8000000000000000))
    22  (assert_return (invoke "i64x2.abs" (v128.const i64x2 0x8000000000000000 0x8000000000000000))
    23                                     (v128.const i64x2 0x8000000000000000 0x8000000000000000))
    24  (assert_return (invoke "i64x2.abs" (v128.const i64x2 01_2_3 01_2_3))
    25                                     (v128.const i64x2 01_2_3 01_2_3))
    26  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -01_2_3 -01_2_3))
    27                                     (v128.const i64x2 123 123))
    28  (assert_return (invoke "i64x2.abs" (v128.const i64x2 0x80 0x80))
    29                                     (v128.const i64x2 0x80 0x80))
    30  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -0x80 -0x80))
    31                                     (v128.const i64x2 0x80 0x80))
    32  (assert_return (invoke "i64x2.abs" (v128.const i64x2 0x0_8_0 0x0_8_0))
    33                                     (v128.const i64x2 0x0_8_0 0x0_8_0))
    34  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -0x0_8_0 -0x0_8_0))
    35                                     (v128.const i64x2 0x80 0x80))
    36  
    37  ;; Const vs const
    38  (assert_return (invoke "i64x2.abs_with_const_0") (v128.const i64x2 9223372036854775808 9223372036854775807))
    39  
    40  ;; Param vs const
    41  
    42  ;; Test different lanes go through different if-then clauses
    43  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -9223372036854775808 9223372036854775807))
    44                                     (v128.const i64x2 9223372036854775808 9223372036854775807))
    45  
    46  ;; Test opposite signs of zero
    47  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -0 -0))
    48                                     (v128.const i64x2 -0 -0))
    49  (assert_return (invoke "i64x2.abs" (v128.const i64x2 +0 0))
    50                                     (v128.const i64x2 +0 0))
    51  (assert_return (invoke "i64x2.abs" (v128.const i64x2 -0 -0))
    52                                     (v128.const i64x2 -0 -0))
    53  (assert_return (invoke "i64x2.abs" (v128.const i64x2 +0 +0))
    54                                     (v128.const i64x2 +0 +0))
    55  
    56  ;; Unknown operators
    57  
    58  ;; Type check
    59  (assert_invalid (module (func (result v128) (i64x2.abs (f32.const 0.0)))) "type mismatch")
    60  
    61  ;; Test operation with empty argument
    62  
    63  (assert_invalid
    64    (module
    65      (func $i64x2.abs-arg-empty (result v128)
    66        (i64x2.abs)
    67      )
    68    )
    69    "type mismatch"
    70  )
    71  
    72  ;; Combination
    73  (module
    74    (func (export "i64x2.abs-i64x2.abs") (param v128) (result v128) (i64x2.abs (i64x2.abs (local.get 0))))
    75  )
    76  
    77  (assert_return (invoke "i64x2.abs-i64x2.abs" (v128.const i64x2 -1 -1))
    78                                               (v128.const i64x2 1 1))