@stdlib/blas-base-wasm-dznrm2 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/main.wat ADDED
@@ -0,0 +1,277 @@
1
+ ;; @license Apache-2.0
2
+ ;;
3
+ ;; Copyright (c) 2025 The Stdlib Authors.
4
+ ;;
5
+ ;; Licensed under the Apache License, Version 2.0 (the "License");
6
+ ;; you may not use this file except in compliance with the License.
7
+ ;; You may obtain a copy of the License at
8
+ ;;
9
+ ;; http://www.apache.org/licenses/LICENSE-2.0
10
+ ;;
11
+ ;; Unless required by applicable law or agreed to in writing, software
12
+ ;; distributed under the License is distributed on an "AS IS" BASIS,
13
+ ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ;; See the License for the specific language governing permissions and
15
+ ;; limitations under the License.
16
+
17
+ (module
18
+ (type (;0;) (func))
19
+ (type (;1;) (func (param i32 i32 i32) (result f64)))
20
+ (type (;2;) (func (param i32 i32 i32 i32) (result f64)))
21
+ (import "env" "memory" (memory (;0;) 0))
22
+ (func (;0;) (type 0)
23
+ nop)
24
+ (func (;1;) (type 1) (param i32 i32 i32) (result f64)
25
+ local.get 0
26
+ local.get 1
27
+ local.get 2
28
+ i32.const 1
29
+ local.get 0
30
+ i32.sub
31
+ local.get 2
32
+ i32.mul
33
+ i32.const 0
34
+ local.get 2
35
+ i32.const 0
36
+ i32.le_s
37
+ select
38
+ call 2)
39
+ (func (;2;) (type 2) (param i32 i32 i32 i32) (result f64)
40
+ (local f64 f64 f64 f64 f64 i32 i32 i32 i32)
41
+ local.get 0
42
+ i32.const 0
43
+ i32.le_s
44
+ if ;; label = @1
45
+ f64.const 0x0p+0 (;=0;)
46
+ return
47
+ end
48
+ local.get 3
49
+ i32.const 1
50
+ i32.shl
51
+ local.set 9
52
+ local.get 2
53
+ i32.const 1
54
+ i32.shl
55
+ local.set 11
56
+ i32.const 0
57
+ local.set 3
58
+ i32.const 1
59
+ local.set 2
60
+ loop ;; label = @1
61
+ local.get 0
62
+ local.get 3
63
+ i32.eq
64
+ i32.eqz
65
+ if ;; label = @2
66
+ block ;; label = @3
67
+ local.get 1
68
+ local.get 9
69
+ i32.const 3
70
+ i32.shl
71
+ i32.add
72
+ local.tee 12
73
+ f64.load
74
+ local.tee 6
75
+ f64.abs
76
+ local.tee 8
77
+ f64.const 0x1p+486 (;=1.99792e+146;)
78
+ f64.gt
79
+ if ;; label = @4
80
+ local.get 7
81
+ local.get 8
82
+ f64.const 0x1p-538 (;=1.11138e-162;)
83
+ f64.mul
84
+ local.tee 6
85
+ local.get 6
86
+ f64.mul
87
+ f64.add
88
+ local.set 7
89
+ i32.const 0
90
+ local.set 2
91
+ br 1 (;@3;)
92
+ end
93
+ local.get 8
94
+ f64.const 0x1p-511 (;=1.49167e-154;)
95
+ f64.lt
96
+ if ;; label = @4
97
+ local.get 2
98
+ i32.const 1
99
+ i32.and
100
+ local.set 10
101
+ i32.const 0
102
+ local.set 2
103
+ local.get 10
104
+ i32.eqz
105
+ br_if 1 (;@3;)
106
+ local.get 4
107
+ local.get 8
108
+ f64.const 0x1p+537 (;=4.49891e+161;)
109
+ f64.mul
110
+ local.tee 4
111
+ local.get 4
112
+ f64.mul
113
+ f64.add
114
+ local.set 4
115
+ i32.const 1
116
+ local.set 2
117
+ br 1 (;@3;)
118
+ end
119
+ local.get 5
120
+ local.get 6
121
+ local.get 6
122
+ f64.mul
123
+ f64.add
124
+ local.set 5
125
+ end
126
+ block ;; label = @3
127
+ local.get 12
128
+ f64.load offset=8
129
+ local.tee 6
130
+ f64.abs
131
+ local.tee 8
132
+ f64.const 0x1p+486 (;=1.99792e+146;)
133
+ f64.gt
134
+ if ;; label = @4
135
+ local.get 7
136
+ local.get 8
137
+ f64.const 0x1p-538 (;=1.11138e-162;)
138
+ f64.mul
139
+ local.tee 6
140
+ local.get 6
141
+ f64.mul
142
+ f64.add
143
+ local.set 7
144
+ i32.const 0
145
+ local.set 2
146
+ br 1 (;@3;)
147
+ end
148
+ local.get 8
149
+ f64.const 0x1p-511 (;=1.49167e-154;)
150
+ f64.lt
151
+ if ;; label = @4
152
+ local.get 2
153
+ i32.const 1
154
+ i32.and
155
+ local.set 10
156
+ i32.const 0
157
+ local.set 2
158
+ local.get 10
159
+ i32.eqz
160
+ br_if 1 (;@3;)
161
+ local.get 4
162
+ local.get 8
163
+ f64.const 0x1p+537 (;=4.49891e+161;)
164
+ f64.mul
165
+ local.tee 4
166
+ local.get 4
167
+ f64.mul
168
+ f64.add
169
+ local.set 4
170
+ i32.const 1
171
+ local.set 2
172
+ br 1 (;@3;)
173
+ end
174
+ local.get 5
175
+ local.get 6
176
+ local.get 6
177
+ f64.mul
178
+ f64.add
179
+ local.set 5
180
+ end
181
+ local.get 3
182
+ i32.const 1
183
+ i32.add
184
+ local.set 3
185
+ local.get 9
186
+ local.get 11
187
+ i32.add
188
+ local.set 9
189
+ br 1 (;@1;)
190
+ end
191
+ end
192
+ block (result f64) ;; label = @1
193
+ local.get 7
194
+ f64.const 0x0p+0 (;=0;)
195
+ f64.gt
196
+ if ;; label = @2
197
+ local.get 5
198
+ f64.const 0x1p-538 (;=1.11138e-162;)
199
+ f64.mul
200
+ f64.const 0x1p-538 (;=1.11138e-162;)
201
+ f64.mul
202
+ local.get 7
203
+ f64.add
204
+ local.tee 4
205
+ local.get 7
206
+ local.get 5
207
+ f64.const 0x1.fffffffffffffp+1023 (;=1.79769e+308;)
208
+ f64.gt
209
+ select
210
+ local.get 4
211
+ local.get 5
212
+ f64.const 0x0p+0 (;=0;)
213
+ f64.le
214
+ select
215
+ local.set 5
216
+ f64.const 0x1p+538 (;=8.99783e+161;)
217
+ br 1 (;@1;)
218
+ end
219
+ f64.const 0x1p+0 (;=1;)
220
+ local.get 4
221
+ f64.const 0x0p+0 (;=0;)
222
+ f64.gt
223
+ i32.eqz
224
+ br_if 0 (;@1;)
225
+ drop
226
+ local.get 5
227
+ f64.const 0x0p+0 (;=0;)
228
+ f64.le
229
+ i32.eqz
230
+ local.get 5
231
+ f64.const 0x1.fffffffffffffp+1023 (;=1.79769e+308;)
232
+ f64.gt
233
+ i32.or
234
+ i32.eqz
235
+ if ;; label = @2
236
+ local.get 4
237
+ local.set 5
238
+ f64.const 0x1p-537 (;=2.22276e-162;)
239
+ br 1 (;@1;)
240
+ end
241
+ local.get 4
242
+ f64.sqrt
243
+ f64.const 0x1p-537 (;=2.22276e-162;)
244
+ f64.mul
245
+ local.tee 6
246
+ local.get 5
247
+ f64.sqrt
248
+ local.tee 5
249
+ local.get 5
250
+ local.get 6
251
+ f64.lt
252
+ local.tee 0
253
+ select
254
+ local.tee 4
255
+ local.get 4
256
+ f64.mul
257
+ local.get 5
258
+ local.get 6
259
+ local.get 0
260
+ select
261
+ local.get 4
262
+ f64.div
263
+ local.tee 4
264
+ local.get 4
265
+ f64.mul
266
+ f64.const 0x1p+0 (;=1;)
267
+ f64.add
268
+ f64.mul
269
+ local.set 5
270
+ f64.const 0x1p+0 (;=1;)
271
+ end
272
+ local.get 5
273
+ f64.sqrt
274
+ f64.mul)
275
+ (export "__wasm_call_ctors" (func 0))
276
+ (export "c_dznrm2" (func 1))
277
+ (export "c_dznrm2_ndarray" (func 2)))