File: canonicalize-nan.wast

package info (click to toggle)
rust-wasmtime 26.0.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 48,492 kB
  • sloc: ansic: 4,003; sh: 561; javascript: 542; cpp: 254; asm: 175; ml: 96; makefile: 55
file content (107 lines) | stat: -rw-r--r-- 3,802 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
;; This *.wast test should be run with `cranelift_nan_canonicalization` set to
;; `true` in `wast.rs`

(module
  (func (export "f32x4.floor") (param v128) (result v128)
    local.get 0
    f32x4.floor)
  (func (export "f32x4.nearest") (param v128) (result v128)
    local.get 0
    f32x4.nearest)
  (func (export "f32x4.sqrt") (param v128) (result v128)
    local.get 0
    f32x4.sqrt)
  (func (export "f32x4.trunc") (param v128) (result v128)
    local.get 0
    f32x4.trunc)
  (func (export "f32x4.ceil") (param v128) (result v128)
    local.get 0
    f32x4.ceil)

  (func (export "f64x2.floor") (param v128) (result v128)
    local.get 0
    f64x2.floor)
  (func (export "f64x2.nearest") (param v128) (result v128)
    local.get 0
    f64x2.nearest)
  (func (export "f64x2.sqrt") (param v128) (result v128)
    local.get 0
    f64x2.sqrt)
  (func (export "f64x2.trunc") (param v128) (result v128)
    local.get 0
    f64x2.trunc)
  (func (export "f64x2.ceil") (param v128) (result v128)
    local.get 0
    f64x2.ceil)

  (func (export "reinterpret-and-demote") (param i64) (result i32)
    local.get 0
    f64.reinterpret_i64
    f32.demote_f64
    i32.reinterpret_f32)

  (func (export "reinterpret-and-promote") (param i32) (result i64)
    local.get 0
    f32.reinterpret_i32
    f64.promote_f32
    i64.reinterpret_f64)

  (func (export "copysign-and-demote") (param f64) (result f32)
    local.get 0
    f64.const -0x1
    f64.copysign
    f32.demote_f64)

  (func (export "copysign-and-promote") (param f32) (result f64)
    local.get 0
    f32.const -0x1
    f32.copysign
    f64.promote_f32)

  (func (export "f32x4.demote_f64x2_zero") (param v128) (result v128)
    local.get 0
    f32x4.demote_f64x2_zero)

  (func (export "f64x2.promote_low_f32x4") (param v128) (result v128)
    local.get 0
    f64x2.promote_low_f32x4)
)

(assert_return (invoke "f32x4.floor" (v128.const f32x4 1 -2.2 3.4 nan))
               (v128.const f32x4 1 -3 3 nan))
(assert_return (invoke "f32x4.nearest" (v128.const f32x4 1 -2.2 3.4 nan))
               (v128.const f32x4 1 -2 3 nan))
(assert_return (invoke "f32x4.sqrt" (v128.const f32x4 1 4 -1 nan))
               (v128.const f32x4 1 2 nan nan))
(assert_return (invoke "f32x4.trunc" (v128.const f32x4 1 -2.2 3.4 nan))
               (v128.const f32x4 1 -2 3 nan))
(assert_return (invoke "f32x4.ceil" (v128.const f32x4 1 -2.2 3.4 nan))
               (v128.const f32x4 1 -2 4 nan))

(assert_return (invoke "f64x2.floor" (v128.const f64x2 -2.2 nan))
               (v128.const f64x2 -3 nan))
(assert_return (invoke "f64x2.nearest" (v128.const f64x2 -2.2 nan))
               (v128.const f64x2 -2 nan))
(assert_return (invoke "f64x2.sqrt" (v128.const f64x2 4 nan))
               (v128.const f64x2 2 nan))
(assert_return (invoke "f64x2.trunc" (v128.const f64x2 3.4 nan))
               (v128.const f64x2 3 nan))
(assert_return (invoke "f64x2.ceil" (v128.const f64x2 3.4 nan))
               (v128.const f64x2 4 nan))

(assert_return (invoke "reinterpret-and-demote" (i64.const 0xfffefdfccccdcecf))
               (i32.const 0x7fc00000))
(assert_return (invoke "reinterpret-and-promote" (i32.const 0xfffefdfc))
               (i64.const 0x7ff8000000000000))
(assert_return (invoke "copysign-and-demote" (f64.const nan))
               (f32.const nan:0x7fc00000))
(assert_return (invoke "copysign-and-promote" (f32.const nan))
               (f64.const nan:0x7ff8000000000000))

(assert_return (invoke "f32x4.demote_f64x2_zero"
               (v128.const i64x2 0xfffefdfccccdcecf 0xfffefdfccccdcecf))
               (v128.const f32x4 nan:0x7fc00000 nan:0x7fc00000 0 0))

(assert_return (invoke "f64x2.promote_low_f32x4"
               (v128.const i32x4 0xfffefdfc 0xfffefdfc 0 0))
               (v128.const f64x2 nan:0x7ff8000000000000 nan:0x7ff8000000000000))