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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
;;; TOOL: run-interp
(module
;; i8x16 neg
(func (export "i8x16_neg_0") (result v128)
v128.const i32x4 0x00000001 0x00000002 0x00000003 0x00000004
i8x16.neg)
;; i16x8 neg
(func (export "i16x8_neg_0") (result v128)
v128.const i32x4 0x0000ffff 0x00007fff 0x00000003 0x00000004
i16x8.neg)
;; i32x4 neg
(func (export "i32x4_neg_0") (result v128)
v128.const i32x4 0x00000001 0x00000002 0x00000003 0x00000004
i32x4.neg)
;; i64x2 neg
(func (export "i64x2_neg_0") (result v128)
v128.const i32x4 0x00000001 0x00000002 0x00000003 0x00000004
i64x2.neg)
;; v128 not
(func (export "v128_not_0") (result v128)
v128.const i32x4 0x00ff0001 0x00550002 0x00000003 0x00000004
v128.not)
;; v128 any_true
(func (export "v128_any_true_0") (result i32)
v128.const i32x4 0x00ff0001 0x00550002 0x00000003 0x00000004
v128.any_true)
(func (export "v128_any_true_1") (result i32)
v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
v128.any_true)
;; i8x16 all_true
(func (export "i8x16_all_true_0") (result i32)
v128.const i32x4 0x01020304 0x01050706 0x10020403 0x20103004
i8x16.all_true)
(func (export "i8x16_all_true_1") (result i32)
v128.const i32x4 0x00000001 0x00000200 0x00030000 0x00000000
i8x16.all_true)
;; i16x8 all_true
(func (export "i16x8_all_true_0") (result i32)
v128.const i32x4 0x00040004 0x00030003 0x00020002 0x00010001
i16x8.all_true)
(func (export "i16x8_all_true_1") (result i32)
v128.const i32x4 0x00ff0001 0x00550002 0x00000003 0x00000004
i16x8.all_true)
;; i32x4 all_true
(func (export "i32x4_all_true_0") (result i32)
v128.const i32x4 0x00ff0001 0x00550002 0x00000003 0x00000004
i32x4.all_true)
(func (export "i32x4_all_true_1") (result i32)
v128.const i32x4 0x01010101 0x000000ff 0x000ff000 0x00000000
i32x4.all_true)
;; i8x16 bitmask
(func (export "i8x16_bitmask_0") (result i32)
v128.const i32x4 0x80808080 0x80808080 0x80808080 0x80808080
i8x16.bitmask)
(func (export "i8x16_bitmask_1") (result i32)
v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
i8x16.bitmask)
;; i16x8 bitmask
(func (export "i16x8_bitmask_0") (result i32)
v128.const i32x4 0x80008000 0x80008000 0x80008000 0x80008000
i16x8.bitmask)
(func (export "i16x8_bitmask_1") (result i32)
v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
i16x8.bitmask)
;; i32x4 bitmask
(func (export "i32x4_bitmask_0") (result i32)
v128.const i32x4 0x80000000 0x80000000 0x80000000 0x80000000
i32x4.bitmask)
(func (export "i32x4_bitmask_1") (result i32)
v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
i32x4.bitmask)
;; f32x4 neg
;; For Floating num:
;; +0.0 = 0x00000000, -0.0 = 0x80000000
;; 0xffc00000 is a NaN, 0x7fc00000 is a NaN.
;; 1234.5 = 0x449a5000, 1.0 = 0x3f800000
;; -1234.5 = 0xc49a5000, -1.0 = 0xbf800000
;; test is: [-0.0, NaN, 1234.5, -1.0]
;; expect is: [ 0.0, NaN, -1234.5, 1.0]
(func (export "f32x4_neg_0") (result v128)
v128.const i32x4 0x80000000 0xffc00000 0x449a5000 0xbf800000
f32x4.neg)
;; f64x2 neg
;; For Double num:
;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000
;; 0xfff8000000000000 is a NaN, 0x7ff8000000000000 is a NaN.
;; 1234.5 = 0x40934a0000000000, 1.0 = 0x3ff0000000000000
;; -1234.5 = 0xc0934a0000000000, -1.0 = 0xbff0000000000000
;; tests are: [ 0.0, NaN], [-1234.5, 1.0]
;; expects are: [-0.0, NaN], [ 1234.5, -1.0]
(func (export "f64x2_neg_0") (result v128)
v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000
f64x2.neg)
(func (export "f64x2_neg_1") (result v128)
v128.const i32x4 0x00000000 0xc0934a00 0x00000000 0x3ff00000
f64x2.neg)
;; f32x4 abs
;; For Floating num:
;; +0.0 = 0x00000000, -0.0 = 0x80000000
;; 0xffc00000 is a NaN, 0x7fc00000 is a NaN.
;; 1234.5 = 0x449a5000, 1.0 = 0x3f800000
;; -1234.5 = 0xc49a5000, -1.0 = 0xbf800000
;; test is: [-0.0, NaN, 1234.5, -1.0]
;; expect is: [ 0.0, NaN, 1234.5, 1.0]
(func (export "f32x4_abs_0") (result v128)
v128.const i32x4 0x80000000 0xffc00000 0x449a5000 0xbf800000
f32x4.abs)
;; f64x2 abs
;; For Double num:
;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000
;; 0xfff8000000000000 is a NaN, 0x7ff8000000000000 is a NaN.
;; 1234.5 = 0x40934a0000000000, 1.0 = 0x3ff0000000000000
;; -1234.5 = 0xc0934a0000000000, -1.0 = 0xbff0000000000000
;; tests are: [-0.0, NaN], [-1234.5, 1.0]
;; expects are: [ 0.0, NaN], [ 1234.5, 1.0]
(func (export "f64x2_abs_0") (result v128)
v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000
f64x2.abs)
(func (export "f64x2_abs_1") (result v128)
v128.const i32x4 0x00000000 0xc0934a00 0x00000000 0x3ff00000
f64x2.abs)
;; f32x4 sqrt
;; For Floating num:
;; 0xffc00000 is a NaN, 0x7fc00000 is a NaN.
;; -1.0 = 0xbf800000, 4.0 = 0x40800000, 2.0 = 0x40000000
;; 9.0 = 0x41100000, 3.0 = 0x40400000
;; test is: [-1.0, NaN, 4.0, 9.0]
;; expect is: [ NaN, NaN, 2.0, 3.0]
(func (export "f32x4_sqrt_0") (result v128)
v128.const i32x4 0xbf800000 0xffc00000 0x40800000 0x41100000
f32x4.sqrt)
;; f64x2 sqrt
;; For Double num:
;; 0xfff8000000000000 is a NaN, 0x7ff8000000000000 is a NaN.
;; -1.0 = 0xbff0000000000000, 4.0 = 0x4010000000000000
;; 2.0 = 0x4000000000000000, 9.0 = 0x4022000000000000
;; 3.0 = 0x4008000000000000
;; tests are: [-1.0, NaN], [ 4.0, 9.0]
;; expects are: [ NaN, NaN], [ 2.0, 3.0]
(func (export "f64x2_sqrt_0") (result v128)
v128.const i32x4 0x00000000 0xbff00000 0x00000000 0xfff80000
f64x2.sqrt)
(func (export "f64x2_sqrt_1") (result v128)
v128.const i32x4 0x00000000 0x40100000 0x00000000 0x40220000
f64x2.sqrt)
;; f32x4 convert_i32x4_s
;; For Floating num:
;; 1.0 = 0x3f800000 -1.0 = 0xbf800000 3.0 = 0x40400000
;; test is: [ 1, -1, 0, 3]
;; expect is: [ 1.0, -1.0, 0.0, 3.0]
(func (export "f32x4_convert_i32x4_s_0") (result v128)
v128.const i32x4 0x00000001 0xffffffff 0x00000000 0x00000003
f32x4.convert_i32x4_s)
;; f32x4 convert_i32x4_u
;; For Floating num:
;; 1.0 = 0x3f800000 0.0 = 0x00000000 3.0 = 0x40400000
;; 2.0 = 0x40000000
;; test is: [ 1, 2, 0, 3]
;; expect is: [ 1.0, 2.0, 0.0, 3.0]
(func (export "f32x4_convert_i32x4_u_0") (result v128)
v128.const i32x4 0x00000001 0x00000002 0x00000000 0x00000003
f32x4.convert_i32x4_u)
;; i32x4 trunc_sat_f32x4_s
;; For Floating num:
;; 0xffc00000 is a NaN.
;; 1.5 = 0x3fc00000 -4.5 = 0xc0900000 1234.8 = 0x449a599a
;; 1234 = 0x000004d2
;; test is: [ 1.5, -4.5, NaN, 1234.8]
;; expect is: [ 1, -4, 0, 1234]
(func (export "i32x4_trunc_sat_f32x4_s_0") (result v128)
v128.const i32x4 0x3fc00000 0xc0900000 0xffc00000 0x449a599a
i32x4.trunc_sat_f32x4_s)
;; i32x4 trunc_sat_f32x4_u
;; For Floating num:
;; 0xffc00000 is a NaN.
;; 1.5 = 0x3fc00000 4.5 = 0x40900000 1234.8 = 0x449a599a
;; 1234 = 0x000004d2
;; test is: [ 1.5, 4.5, NaN, 1234.8]
;; expect is: [ 1, 4, 0, 1234]
(func (export "i32x4_trunc_sat_f32x4_u_0") (result v128)
v128.const i32x4 0x3fc00000 0x40900000 0xffc00000 0x449a599a
i32x4.trunc_sat_f32x4_u)
)
(;; STDOUT ;;;
i8x16_neg_0() => v128 i32x4:0x000000ff 0x000000fe 0x000000fd 0x000000fc
i16x8_neg_0() => v128 i32x4:0x00000001 0x00008001 0x0000fffd 0x0000fffc
i32x4_neg_0() => v128 i32x4:0xffffffff 0xfffffffe 0xfffffffd 0xfffffffc
i64x2_neg_0() => v128 i32x4:0xffffffff 0xfffffffd 0xfffffffd 0xfffffffb
v128_not_0() => v128 i32x4:0xff00fffe 0xffaafffd 0xfffffffc 0xfffffffb
v128_any_true_0() => i32:1
v128_any_true_1() => i32:0
i8x16_all_true_0() => i32:1
i8x16_all_true_1() => i32:0
i16x8_all_true_0() => i32:1
i16x8_all_true_1() => i32:0
i32x4_all_true_0() => i32:1
i32x4_all_true_1() => i32:0
i8x16_bitmask_0() => i32:65535
i8x16_bitmask_1() => i32:0
i16x8_bitmask_0() => i32:255
i16x8_bitmask_1() => i32:0
i32x4_bitmask_0() => i32:15
i32x4_bitmask_1() => i32:0
f32x4_neg_0() => v128 i32x4:0x00000000 0x7fc00000 0xc49a5000 0x3f800000
f64x2_neg_0() => v128 i32x4:0x00000000 0x80000000 0x00000000 0x7ff80000
f64x2_neg_1() => v128 i32x4:0x00000000 0x40934a00 0x00000000 0xbff00000
f32x4_abs_0() => v128 i32x4:0x00000000 0x7fc00000 0x449a5000 0x3f800000
f64x2_abs_0() => v128 i32x4:0x00000000 0x00000000 0x00000000 0x7ff80000
f64x2_abs_1() => v128 i32x4:0x00000000 0x40934a00 0x00000000 0x3ff00000
f32x4_sqrt_0() => v128 i32x4:0x7fc00000 0x7fc00000 0x40000000 0x40400000
f64x2_sqrt_0() => v128 i32x4:0x00000000 0x7ff80000 0x00000000 0x7ff80000
f64x2_sqrt_1() => v128 i32x4:0x00000000 0x40000000 0x00000000 0x40080000
f32x4_convert_i32x4_s_0() => v128 i32x4:0x3f800000 0xbf800000 0x00000000 0x40400000
f32x4_convert_i32x4_u_0() => v128 i32x4:0x3f800000 0x40000000 0x00000000 0x40400000
i32x4_trunc_sat_f32x4_s_0() => v128 i32x4:0x00000001 0xfffffffc 0x00000000 0x000004d2
i32x4_trunc_sat_f32x4_u_0() => v128 i32x4:0x00000001 0x00000004 0x00000000 0x000004d2
;;; STDOUT ;;)
|