github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/spectest/v2/testdata/simd_i32x4_trunc_sat_f64x2.wast (about)

     1  ;; Tests for i32x4 trunc sat conversions from float.
     2  
     3  (module
     4    (func (export "i32x4.trunc_sat_f64x2_s_zero") (param v128) (result v128) (i32x4.trunc_sat_f64x2_s_zero (local.get 0)))
     5    (func (export "i32x4.trunc_sat_f64x2_u_zero") (param v128) (result v128) (i32x4.trunc_sat_f64x2_u_zero (local.get 0)))
     6  )
     7  
     8  
     9  ;; i32x4.trunc_sat_f64x2_s_zero
    10  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0.0 0.0))
    11                                                        (v128.const i32x4 0 0 0 0))
    12  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0.0 -0.0))
    13                                                        (v128.const i32x4 0 0 0 0))
    14  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 1.5 1.5))
    15                                                        (v128.const i32x4 1 1 0 0))
    16  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -1.5 -1.5))
    17                                                        (v128.const i32x4 -1 -1 0 0))
    18  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 1.9 1.9))
    19                                                        (v128.const i32x4 1 1 0 0))
    20  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 2.0 2.0))
    21                                                        (v128.const i32x4 2 2 0 0))
    22  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -1.9 -1.9))
    23                                                        (v128.const i32x4 -1 -1 0 0))
    24  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -2.0 -2.0))
    25                                                        (v128.const i32x4 -2 -2 0 0))
    26  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 2147483520.0 2147483520.0))
    27                                                        (v128.const i32x4 2147483520 2147483520 0 0))
    28  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -2147483520.0 -2147483520.0))
    29                                                        (v128.const i32x4 -2147483520 -2147483520 0 0))
    30  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 2147483648.0 2147483648.0))
    31                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    32  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -2147483648.0 -2147483648.0))
    33                                                        (v128.const i32x4 -2147483648 -2147483648 0 0))
    34  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 4294967294.0 4294967294.0))
    35                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    36  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -4294967294.0 -4294967294.0))
    37                                                        (v128.const i32x4 -2147483648 -2147483648 0 0))
    38  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 2147483647.0 2147483647.0))
    39                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    40  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -2147483647.0 -2147483647.0))
    41                                                        (v128.const i32x4 -2147483647 -2147483647 0 0))
    42  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 4294967294.0 4294967294.0))
    43                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    44  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 4294967295.0 4294967295.0))
    45                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    46  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 4294967296.0 4294967296.0))
    47                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    48  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1p-149 0x1p-149))
    49                                                        (v128.const i32x4 0 0 0 0))
    50  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1p-149 -0x1p-149))
    51                                                        (v128.const i32x4 0 0 0 0))
    52  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1p-126 0x1p-126))
    53                                                        (v128.const i32x4 0 0 0 0))
    54  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1p-126 -0x1p-126))
    55                                                        (v128.const i32x4 0 0 0 0))
    56  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1p-1 0x1p-1))
    57                                                        (v128.const i32x4 0 0 0 0))
    58  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1p-1 -0x1p-1))
    59                                                        (v128.const i32x4 0 0 0 0))
    60  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1p+0 0x1p+0))
    61                                                        (v128.const i32x4 1 1 0 0))
    62  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1p+0 -0x1p+0))
    63                                                        (v128.const i32x4 -1 -1 0 0))
    64  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.19999ap+0 0x1.19999ap+0))
    65                                                        (v128.const i32x4 1 1 0 0))
    66  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.19999ap+0 -0x1.19999ap+0))
    67                                                        (v128.const i32x4 -1 -1 0 0))
    68  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.921fb6p+2 0x1.921fb6p+2))
    69                                                        (v128.const i32x4 6 6 0 0))
    70  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.921fb6p+2 -0x1.921fb6p+2))
    71                                                        (v128.const i32x4 -6 -6 0 0))
    72  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.fffffep+127 0x1.fffffep+127))
    73                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    74  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.fffffep+127 -0x1.fffffep+127))
    75                                                        (v128.const i32x4 -2147483648 -2147483648 0 0))
    76  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.ccccccp-1 0x1.ccccccp-1))
    77                                                        (v128.const i32x4 0 0 0 0))
    78  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.ccccccp-1 -0x1.ccccccp-1))
    79                                                        (v128.const i32x4 0 0 0 0))
    80  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.fffffep-1 0x1.fffffep-1))
    81                                                        (v128.const i32x4 0 0 0 0))
    82  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.fffffep-1 -0x1.fffffep-1))
    83                                                        (v128.const i32x4 0 0 0 0))
    84  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.921fb6p+2 0x1.921fb6p+2))
    85                                                        (v128.const i32x4 6 6 0 0))
    86  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.921fb6p+2 -0x1.921fb6p+2))
    87                                                        (v128.const i32x4 -6 -6 0 0))
    88  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0x1.fffffep+127 0x1.fffffep+127))
    89                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    90  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -0x1.fffffep+127 -0x1.fffffep+127))
    91                                                        (v128.const i32x4 -2147483648 -2147483648 0 0))
    92  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 +inf +inf))
    93                                                        (v128.const i32x4 2147483647 2147483647 0 0))
    94  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -inf -inf))
    95                                                        (v128.const i32x4 -2147483648 -2147483648 0 0))
    96  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 +nan +nan))
    97                                                        (v128.const i32x4 0 0 0 0))
    98  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -nan -nan))
    99                                                        (v128.const i32x4 0 0 0 0))
   100  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 nan:0x444444 nan:0x444444))
   101                                                        (v128.const i32x4 0 0 0 0))
   102  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -nan:0x444444 -nan:0x444444))
   103                                                        (v128.const i32x4 0 0 0 0))
   104  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 42 42))
   105                                                        (v128.const i32x4 42 42 0 0))
   106  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 -42 -42))
   107                                                        (v128.const i32x4 -42 -42 0 0))
   108  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 0123456792.0 0123456792.0))
   109                                                        (v128.const i32x4 123456792 123456792 0 0))
   110  (assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 01234567890.0 01234567890.0))
   111                                                        (v128.const i32x4 1234567890 1234567890 0 0))
   112  
   113  ;; i32x4.trunc_sat_f64x2_u_zero
   114  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0.0 0.0))
   115                                                        (v128.const i32x4 0 0 0 0))
   116  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0.0 -0.0))
   117                                                        (v128.const i32x4 0 0 0 0))
   118  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 1.5 1.5))
   119                                                        (v128.const i32x4 1 1 0 0))
   120  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -1.5 -1.5))
   121                                                        (v128.const i32x4 0 0 0 0))
   122  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 1.9 1.9))
   123                                                        (v128.const i32x4 1 1 0 0))
   124  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 2.0 2.0))
   125                                                        (v128.const i32x4 2 2 0 0))
   126  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -1.9 -1.9))
   127                                                        (v128.const i32x4 0 0 0 0))
   128  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -2.0 -2.0))
   129                                                        (v128.const i32x4 0 0 0 0))
   130  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 2147483520.0 2147483520.0))
   131                                                        (v128.const i32x4 2147483520 2147483520 0 0))
   132  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -2147483520.0 -2147483520.0))
   133                                                        (v128.const i32x4 0 0 0 0))
   134  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 2147483648.0 2147483648.0))
   135                                                        (v128.const i32x4 2147483648 2147483648 0 0))
   136  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -2147483648.0 -2147483648.0))
   137                                                        (v128.const i32x4 0 0 0 0))
   138  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 4294967294.0 4294967294.0))
   139                                                        (v128.const i32x4 4294967294 4294967294 0 0))
   140  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -4294967294.0 -4294967294.0))
   141                                                        (v128.const i32x4 0 0 0 0))
   142  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 2147483647.0 2147483647.0))
   143                                                        (v128.const i32x4 2147483647 2147483647 0 0))
   144  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -2147483647.0 -2147483647.0))
   145                                                        (v128.const i32x4 0 0 0 0))
   146  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 4294967294.0 4294967294.0))
   147                                                        (v128.const i32x4 4294967294 4294967294 0 0))
   148  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 4294967295.0 4294967295.0))
   149                                                        (v128.const i32x4 4294967295 4294967295 0 0))
   150  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 4294967296.0 4294967296.0))
   151                                                        (v128.const i32x4 4294967295 4294967295 0 0))
   152  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1p-149 0x1p-149))
   153                                                        (v128.const i32x4 0 0 0 0))
   154  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1p-149 -0x1p-149))
   155                                                        (v128.const i32x4 0 0 0 0))
   156  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1p-126 0x1p-126))
   157                                                        (v128.const i32x4 0 0 0 0))
   158  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1p-126 -0x1p-126))
   159                                                        (v128.const i32x4 0 0 0 0))
   160  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1p-1 0x1p-1))
   161                                                        (v128.const i32x4 0 0 0 0))
   162  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1p-1 -0x1p-1))
   163                                                        (v128.const i32x4 0 0 0 0))
   164  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1p+0 0x1p+0))
   165                                                        (v128.const i32x4 1 1 0 0))
   166  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1p+0 -0x1p+0))
   167                                                        (v128.const i32x4 0 0 0 0))
   168  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.19999ap+0 0x1.19999ap+0))
   169                                                        (v128.const i32x4 1 1 0 0))
   170  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.19999ap+0 -0x1.19999ap+0))
   171                                                        (v128.const i32x4 0 0 0 0))
   172  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.921fb6p+2 0x1.921fb6p+2))
   173                                                        (v128.const i32x4 6 6 0 0))
   174  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.921fb6p+2 -0x1.921fb6p+2))
   175                                                        (v128.const i32x4 0 0 0 0))
   176  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.fffffep+127 0x1.fffffep+127))
   177                                                        (v128.const i32x4 4294967295 4294967295 0 0))
   178  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.fffffep+127 -0x1.fffffep+127))
   179                                                        (v128.const i32x4 0 0 0 0))
   180  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.ccccccp-1 0x1.ccccccp-1))
   181                                                        (v128.const i32x4 0 0 0 0))
   182  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.ccccccp-1 -0x1.ccccccp-1))
   183                                                        (v128.const i32x4 0 0 0 0))
   184  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.fffffep-1 0x1.fffffep-1))
   185                                                        (v128.const i32x4 0 0 0 0))
   186  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.fffffep-1 -0x1.fffffep-1))
   187                                                        (v128.const i32x4 0 0 0 0))
   188  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.921fb6p+2 0x1.921fb6p+2))
   189                                                        (v128.const i32x4 6 6 0 0))
   190  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.921fb6p+2 -0x1.921fb6p+2))
   191                                                        (v128.const i32x4 0 0 0 0))
   192  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0x1.fffffep+127 0x1.fffffep+127))
   193                                                        (v128.const i32x4 4294967295 4294967295 0 0))
   194  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -0x1.fffffep+127 -0x1.fffffep+127))
   195                                                        (v128.const i32x4 0 0 0 0))
   196  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 +inf +inf))
   197                                                        (v128.const i32x4 4294967295 4294967295 0 0))
   198  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -inf -inf))
   199                                                        (v128.const i32x4 0 0 0 0))
   200  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 +nan +nan))
   201                                                        (v128.const i32x4 0 0 0 0))
   202  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -nan -nan))
   203                                                        (v128.const i32x4 0 0 0 0))
   204  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 nan:0x444444 nan:0x444444))
   205                                                        (v128.const i32x4 0 0 0 0))
   206  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -nan:0x444444 -nan:0x444444))
   207                                                        (v128.const i32x4 0 0 0 0))
   208  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 42 42))
   209                                                        (v128.const i32x4 42 42 0 0))
   210  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 -42 -42))
   211                                                        (v128.const i32x4 0 0 0 0))
   212  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 0123456792.0 0123456792.0))
   213                                                        (v128.const i32x4 123456792 123456792 0 0))
   214  (assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 01234567890.0 01234567890.0))
   215                                                        (v128.const i32x4 1234567890 1234567890 0 0))
   216  
   217  ;; type check
   218  (assert_invalid (module (func (result v128) (i32x4.trunc_sat_f64x2_s_zero (i32.const 0)))) "type mismatch")
   219  (assert_invalid (module (func (result v128) (i32x4.trunc_sat_f64x2_u_zero (i32.const 0)))) "type mismatch")
   220  
   221  ;; Test operation with empty argument
   222  
   223  (assert_invalid
   224    (module
   225      (func $i32x4.trunc_sat_f64x2_s_zero-arg-empty (result v128)
   226        (i32x4.trunc_sat_f64x2_s_zero)
   227      )
   228    )
   229    "type mismatch"
   230  )
   231  (assert_invalid
   232    (module
   233      (func $i32x4.trunc_sat_f64x2_u_zero-arg-empty (result v128)
   234        (i32x4.trunc_sat_f64x2_u_zero)
   235      )
   236    )
   237    "type mismatch"
   238  )
   239