Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

28494 views
License: GPL3
ubuntu2004
1
#line 2 "../src/kernel/mips/asm0.h"
2
/* Copyright (C) 2013 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
ASM mulll
17
NOASM addll bfffo divll
18
*/
19
#ifdef ASMINLINE
20
#define LOCAL_HIREMAINDER register ulong hiremainder
21
#define LOCAL_OVERFLOW register ulong overflow
22
23
#define mulll(a, b) \
24
__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \
25
__asm__ ("multu %2,%3\n\tmfhi %1" \
26
: "=&l" (__value), "=&r" (hiremainder) \
27
: "r" (__arg1), "r" (__arg2) \
28
: "hi"); \
29
__value; \
30
})
31
32
#define addmul(a, b) \
33
__extension__ ({ \
34
ulong __arg1 = (a), __arg2 = (b), __value, __tmp; \
35
__asm__ ("multu %3,%4\n\tmfhi %0\n\tmflo %2\n\t" \
36
"addu %1,%2,%5\n\tsltu %2,%1,%5\n\taddu %0,%0,%2" \
37
: "=&r" (hiremainder), "=&r" (__value), "=&r" (__tmp) \
38
: "r" (__arg1), "r" (__arg2), "r" (hiremainder) \
39
: "hi", "lo"); \
40
__value; \
41
})
42
43
#endif
44
45