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/m68k/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
/* Written by Bill Allombert and dedicated to thoses who wrote the original
17
* m68k kernel mp.s */
18
19
/*
20
ASM addll mulll bfffo divll
21
*/
22
23
#ifdef ASMINLINE
24
#define LOCAL_HIREMAINDER register ulong hiremainder
25
#define LOCAL_OVERFLOW register ulong overflow
26
27
#define addll(a,b) \
28
__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \
29
__asm__ ("add.l %2,%0 ; addx.l %1,%1" \
30
: "=&d" (__value), "=d" (overflow) \
31
: "rm" (__arg1), "0" (__arg2), "1" (0UL) \
32
: "cc"); \
33
__value; \
34
})
35
36
#define addllx(a,b) \
37
__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b), __temp; \
38
__asm__ ("neg.l %2 ; addx.l %4,%0 ; addx.l %1,%1" \
39
: "=d" (__value), "=d" (overflow), "=d" (__temp) \
40
: "0" (__arg1), "d" (__arg2), "2" (overflow), "1" (0UL) \
41
: "cc"); \
42
__value; \
43
})
44
45
#define subll(a,b) \
46
__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \
47
__asm__ ("sub.l %3,%0 ; addx.l %1,%1" \
48
: "=&d" (__value), "=d" (overflow) \
49
: "0" (__arg1), "rm" (__arg2), "1" (0UL) \
50
: "cc"); \
51
__value; \
52
})
53
54
#define subllx(a,b) \
55
__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b), __temp; \
56
__asm__ ("neg.l %2 ; subx.l %4,%0 ; addx.l %1,%1" \
57
: "=d" (__value), "=d" (overflow), "=d" (__temp) \
58
: "0" (__arg1), "d" (__arg2), "2" (overflow), "1" (0UL) \
59
: "cc"); \
60
__value; \
61
})
62
63
#define mulll(a, b) \
64
__extension__ ({ \
65
ulong __arg1 = (a), __arg2 = (b), __value; \
66
__asm__ ("mulu.l %2, %0:%1" \
67
: "=d" (hiremainder), "=d" (__value) \
68
: "md" (__arg1) , "1" (__arg2) \
69
: "cc"); \
70
__value; \
71
})
72
73
#define addmul(a, b) \
74
__extension__ ({ \
75
ulong __arg1 = (a), __arg2 = (b), __value; \
76
__asm__ ("mulu.l %2, %0:%1; add.l %4,%1; addx.l %5,%0" \
77
: "=&d" (hiremainder), "=&d" (__value) \
78
: "md" (__arg1), "1" (__arg2), "d" (hiremainder), "d" (0UL) \
79
: "cc" ); \
80
__value; \
81
})
82
83
#define bfffo(a) \
84
__extension__ ({ \
85
ulong __arg1 = (a), __value; \
86
__asm__ ("bfffo %1{#0:#0}, %0" \
87
: "=d" (__value) \
88
: "md" (__arg1) \
89
: "cc" ); \
90
__value; \
91
})
92
93
#define divll(a, b) \
94
__extension__ ({ \
95
ulong __arg2 = (b), __value =(a); \
96
__asm__ ("divu.l %2, %0:%1" \
97
: "+d" (hiremainder), "+d" (__value) \
98
: "md" (__arg2) \
99
: "cc"); \
100
__value; \
101
})
102
#endif
103
104