Skip to content

Commit 585a827

Browse files
committed
build: generate wasm support for sasum
1 parent ffaf947 commit 585a827

File tree

3 files changed

+205
-0
lines changed

3 files changed

+205
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' );
24+
25+
26+
// MAIN //
27+
28+
var wasm = base64ToUint8Array( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGADf39/AX1gBH9/f38BfQIPAQNlbnYGbWVtb3J5AgAAAwQDAAECB0wEEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAAHY19zYXN1bQABD2Nfc2FzdW1fbmRhcnJheQACCoMCAwMAAQshAQF+IAAgASACIAKsIgNCASAArH1+QgAgA0IAVxunEAIL2gECAX0CfyAAQQBMBEBDAAAAAA8LAkAgAkEBRwRAA0AgBCABIANBAnRqKgIAi5IhBCACIANqIQMgBUEBaiIFIABHDQALDAELAkAgAEEGcCICRQRAIAMhBQwBCwNAIAQgASADQQJ0aioCAIuSIQQgA0EBaiIFIQMgBkEBaiIGIAJHDQALCyAAQQZIDQADQCAEIAEgBUECdGoiAyoCAIsgAyoCBIuSIAMqAgiLkiADKgIMi5IgAyoCEIuSIAMqAhSLkpIhBCAFQQZqIQUgAkEGaiICIABIDQALCyAECw==' );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = wasm;
409 Bytes
Binary file not shown.
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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 f32)))
20+
(type (;2;) (func (param i32 i32 i32 i32) (result f32)))
21+
(import "env" "memory" (memory (;0;) 0))
22+
(func (;0;) (type 0)
23+
nop)
24+
(func (;1;) (type 1) (param i32 i32 i32) (result f32)
25+
(local i64)
26+
local.get 0
27+
local.get 1
28+
local.get 2
29+
local.get 2
30+
i64.extend_i32_s
31+
local.tee 3
32+
i64.const 1
33+
local.get 0
34+
i64.extend_i32_s
35+
i64.sub
36+
i64.mul
37+
i64.const 0
38+
local.get 3
39+
i64.const 0
40+
i64.le_s
41+
select
42+
i32.wrap_i64
43+
call 2)
44+
(func (;2;) (type 2) (param i32 i32 i32 i32) (result f32)
45+
(local f32 i32 i32)
46+
local.get 0
47+
i32.const 0
48+
i32.le_s
49+
if ;; label = @1
50+
f32.const 0x0p+0 (;=0;)
51+
return
52+
end
53+
block ;; label = @1
54+
local.get 2
55+
i32.const 1
56+
i32.ne
57+
if ;; label = @2
58+
loop ;; label = @3
59+
local.get 4
60+
local.get 1
61+
local.get 3
62+
i32.const 2
63+
i32.shl
64+
i32.add
65+
f32.load
66+
f32.abs
67+
f32.add
68+
local.set 4
69+
local.get 2
70+
local.get 3
71+
i32.add
72+
local.set 3
73+
local.get 5
74+
i32.const 1
75+
i32.add
76+
local.tee 5
77+
local.get 0
78+
i32.ne
79+
br_if 0 (;@3;)
80+
end
81+
br 1 (;@1;)
82+
end
83+
block ;; label = @2
84+
local.get 0
85+
i32.const 6
86+
i32.rem_u
87+
local.tee 2
88+
i32.eqz
89+
if ;; label = @3
90+
local.get 3
91+
local.set 5
92+
br 1 (;@2;)
93+
end
94+
loop ;; label = @3
95+
local.get 4
96+
local.get 1
97+
local.get 3
98+
i32.const 2
99+
i32.shl
100+
i32.add
101+
f32.load
102+
f32.abs
103+
f32.add
104+
local.set 4
105+
local.get 3
106+
i32.const 1
107+
i32.add
108+
local.tee 5
109+
local.set 3
110+
local.get 6
111+
i32.const 1
112+
i32.add
113+
local.tee 6
114+
local.get 2
115+
i32.ne
116+
br_if 0 (;@3;)
117+
end
118+
end
119+
local.get 0
120+
i32.const 6
121+
i32.lt_s
122+
br_if 0 (;@1;)
123+
loop ;; label = @2
124+
local.get 4
125+
local.get 1
126+
local.get 5
127+
i32.const 2
128+
i32.shl
129+
i32.add
130+
local.tee 3
131+
f32.load
132+
f32.abs
133+
local.get 3
134+
f32.load offset=4
135+
f32.abs
136+
f32.add
137+
local.get 3
138+
f32.load offset=8
139+
f32.abs
140+
f32.add
141+
local.get 3
142+
f32.load offset=12
143+
f32.abs
144+
f32.add
145+
local.get 3
146+
f32.load offset=16
147+
f32.abs
148+
f32.add
149+
local.get 3
150+
f32.load offset=20
151+
f32.abs
152+
f32.add
153+
f32.add
154+
local.set 4
155+
local.get 5
156+
i32.const 6
157+
i32.add
158+
local.set 5
159+
local.get 2
160+
i32.const 6
161+
i32.add
162+
local.tee 2
163+
local.get 0
164+
i32.lt_s
165+
br_if 0 (;@2;)
166+
end
167+
end
168+
local.get 4)
169+
(export "__wasm_call_ctors" (func 0))
170+
(export "__wasm_apply_data_relocs" (func 0))
171+
(export "c_sasum" (func 1))
172+
(export "c_sasum_ndarray" (func 2)))

0 commit comments

Comments
 (0)