@stdlib/blas-base-wasm-dnrm2 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,213 @@
1
+ ;; @license Apache-2.0
2
+ ;;
3
+ ;; Copyright (c) 2024 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)
41
+ i32.const 1
42
+ local.set 9
43
+ local.get 0
44
+ i32.const 0
45
+ i32.gt_s
46
+ if (result f64) ;; label = @1
47
+ loop ;; label = @2
48
+ local.get 0
49
+ local.get 10
50
+ i32.eq
51
+ i32.eqz
52
+ if ;; label = @3
53
+ block ;; label = @4
54
+ local.get 1
55
+ local.get 3
56
+ i32.const 3
57
+ i32.shl
58
+ i32.add
59
+ f64.load
60
+ local.tee 8
61
+ f64.abs
62
+ local.tee 7
63
+ f64.const 0x1p+486 (;=1.99792e+146;)
64
+ f64.gt
65
+ if ;; label = @5
66
+ local.get 6
67
+ local.get 7
68
+ f64.const 0x1p-538 (;=1.11138e-162;)
69
+ f64.mul
70
+ local.tee 6
71
+ local.get 6
72
+ f64.mul
73
+ f64.add
74
+ local.set 6
75
+ i32.const 0
76
+ local.set 9
77
+ br 1 (;@4;)
78
+ end
79
+ local.get 7
80
+ f64.const 0x1p-511 (;=1.49167e-154;)
81
+ f64.lt
82
+ if ;; label = @5
83
+ local.get 9
84
+ local.set 11
85
+ i32.const 0
86
+ local.set 9
87
+ local.get 11
88
+ i32.eqz
89
+ br_if 1 (;@4;)
90
+ local.get 5
91
+ local.get 7
92
+ f64.const 0x1p+537 (;=4.49891e+161;)
93
+ f64.mul
94
+ local.tee 5
95
+ local.get 5
96
+ f64.mul
97
+ f64.add
98
+ local.set 5
99
+ i32.const 1
100
+ local.set 9
101
+ br 1 (;@4;)
102
+ end
103
+ local.get 4
104
+ local.get 8
105
+ local.get 8
106
+ f64.mul
107
+ f64.add
108
+ local.set 4
109
+ end
110
+ local.get 10
111
+ i32.const 1
112
+ i32.add
113
+ local.set 10
114
+ local.get 2
115
+ local.get 3
116
+ i32.add
117
+ local.set 3
118
+ br 1 (;@2;)
119
+ end
120
+ end
121
+ block (result f64) ;; label = @2
122
+ local.get 6
123
+ f64.const 0x0p+0 (;=0;)
124
+ f64.gt
125
+ if ;; label = @3
126
+ local.get 4
127
+ f64.const 0x1p-538 (;=1.11138e-162;)
128
+ f64.mul
129
+ f64.const 0x1p-538 (;=1.11138e-162;)
130
+ f64.mul
131
+ local.get 6
132
+ f64.add
133
+ local.tee 5
134
+ local.get 6
135
+ local.get 4
136
+ f64.const 0x1.fffffffffffffp+1023 (;=1.79769e+308;)
137
+ f64.gt
138
+ select
139
+ local.get 5
140
+ local.get 4
141
+ f64.const 0x0p+0 (;=0;)
142
+ f64.le
143
+ select
144
+ local.set 4
145
+ f64.const 0x1p+538 (;=8.99783e+161;)
146
+ br 1 (;@2;)
147
+ end
148
+ f64.const 0x1p+0 (;=1;)
149
+ local.get 5
150
+ f64.const 0x0p+0 (;=0;)
151
+ f64.gt
152
+ i32.eqz
153
+ br_if 0 (;@2;)
154
+ drop
155
+ local.get 4
156
+ local.get 4
157
+ f64.ne
158
+ local.get 4
159
+ f64.const 0x0p+0 (;=0;)
160
+ f64.gt
161
+ i32.or
162
+ local.get 4
163
+ f64.const 0x1.fffffffffffffp+1023 (;=1.79769e+308;)
164
+ f64.gt
165
+ i32.or
166
+ i32.eqz
167
+ if ;; label = @3
168
+ local.get 5
169
+ local.set 4
170
+ f64.const 0x1p-537 (;=2.22276e-162;)
171
+ br 1 (;@2;)
172
+ end
173
+ local.get 5
174
+ f64.sqrt
175
+ f64.const 0x1p-537 (;=2.22276e-162;)
176
+ f64.mul
177
+ local.tee 5
178
+ local.get 4
179
+ f64.sqrt
180
+ local.tee 4
181
+ local.get 4
182
+ local.get 5
183
+ f64.lt
184
+ local.tee 0
185
+ select
186
+ local.tee 7
187
+ local.get 7
188
+ f64.mul
189
+ local.get 4
190
+ local.get 5
191
+ local.get 0
192
+ select
193
+ local.get 7
194
+ f64.div
195
+ local.tee 4
196
+ local.get 4
197
+ f64.mul
198
+ f64.const 0x1p+0 (;=1;)
199
+ f64.add
200
+ f64.mul
201
+ local.set 4
202
+ f64.const 0x1p+0 (;=1;)
203
+ end
204
+ local.get 4
205
+ f64.sqrt
206
+ f64.mul
207
+ else
208
+ f64.const 0x0p+0 (;=0;)
209
+ end)
210
+ (export "__wasm_call_ctors" (func 0))
211
+ (export "__wasm_apply_data_relocs" (func 0))
212
+ (export "c_dnrm2" (func 1))
213
+ (export "c_dnrm2_ndarray" (func 2)))