MCPcopy Create free account
hub / github.com/nodejs/node / test_vector_add

Function test_vector_add

deps/v8/test/mjsunit/wasm/simd-usaddl.js:181–204  ·  view source on GitHub ↗
(s1, s2, array, signed_func, unsigned_func)

Source from the content-addressed store, hash-verified

179const module = builder.instantiate();
180
181function test_vector_add(s1, s2, array, signed_func, unsigned_func) {
182 for (let i = 0; i < array.length-2; i++) {
183 let a = BigInt(array[i]);
184 let b = BigInt(array[i+2]);
185 let ua = BigInt.asUintN(s1, a);
186 let ub = BigInt.asUintN(s1, b);
187 let sa = BigInt.asIntN(s1, a);
188 let sb = BigInt.asIntN(s1, b);
189 assertEquals(
190 BigInt.asUintN(s2, ua + ub),
191 BigInt.asUintN(s2, BigInt(unsigned_func(
192 s1>32 ? ua : Number(ua),
193 s1>32 ? ub : Number(ub)
194 )))
195 );
196 assertEquals(
197 BigInt.asIntN(s2, sa + sb),
198 BigInt.asIntN(s2, BigInt(signed_func(
199 s1>32 ? sa : Number(sa),
200 s1>32 ? sb : Number(sb)
201 )))
202 );
203 }
204}
205
206// 2D
207test_vector_add(32, 64, uint64_array, module.exports.main_vector_2D_L_S, module.exports.main_vector_2D_L_U);

Callers 1

simd-usaddl.jsFile · 0.70

Calls 1

assertEqualsFunction · 0.50

Tested by

no test coverage detected