Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28495 views
License: GPL3
ubuntu2004
1
#line 2 "../src/kernel/ia64/asm0.h"
2
/* Copyright (C) 2006 The PARI group.
3
4
This file is part of the PARI/GP package.
5
6
PARI/GP is free software; you can redistribute it and/or modify it under the
7
terms of the GNU General Public License as published by the Free Software
8
Foundation; either version 2 of the License, or (at your option) any later
9
version. It is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY WHATSOEVER.
11
12
Check the License for details. You should have received a copy of it, along
13
with the package; see the file 'COPYING'. If not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
15
16
/*
17
ASM mulll bfffo
18
NOASM addll divll
19
*/
20
21
#ifdef ASMINLINE
22
/* Written by Guillaume Hanrot */
23
#define LOCAL_HIREMAINDER register ulong hiremainder
24
25
#define bfffo(a) \
26
__extension__ ({ ulong __arg1 = (a), __tmp, _a, _c; \
27
__asm__ ("mux1 %0 = %1, @rev" : "=r" (__tmp) : "r" (__arg1)); \
28
__asm__ ("czx1.l %0 = %1" : "=r" (_a) : "r" (-__tmp | __tmp)); \
29
_c = (_a - 1) << 3; \
30
__arg1 >>= _c; \
31
if (__arg1 >= 1 << 4) \
32
__arg1 >>= 4, _c += 4; \
33
if (__arg1 >= 1 << 2) \
34
__arg1 >>= 2, _c += 2; \
35
_c += __arg1 >> 1; \
36
63 - _c; \
37
})
38
39
#define mulll(a, b) \
40
__extension__ ({ \
41
ulong __arg1 = (a), __arg2 = (b), __value; \
42
__asm__ ("xma.hu %0 = %2, %3, f0\n\t;;\n\txma.l %1 = %2, %3, f0" \
43
: "=&f" (hiremainder), "=f" (__value) \
44
: "f" (__arg1), "f" (__arg2)); \
45
__value; \
46
})
47
48
#define addmul(a, b) \
49
__extension__ ({ \
50
ulong __arg1 = (a), __arg2 = (b), __value; \
51
__asm__ ("xma.hu %0 = %2, %3, %4\n\txma.l %1 = %2, %3, %4" \
52
: "=&f" (hiremainder), "=f" (__value) \
53
: "f" (__arg1), "f" (__arg2), "f" (hiremainder)); \
54
__value; \
55
})
56
#endif
57
58