Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
#line 2 "../src/kernel/x86-64/asm0.h"1/* Copyright (C) 2004 The PARI group.23This file is part of the PARI/GP package.45PARI/GP is free software; you can redistribute it and/or modify it under the6terms of the GNU General Public License as published by the Free Software7Foundation; either version 2 of the License, or (at your option) any later8version. It is distributed in the hope that it will be useful, but WITHOUT9ANY WARRANTY WHATSOEVER.1011Check the License for details. You should have received a copy of it, along12with the package; see the file 'COPYING'. If not, write to the Free Software13Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */1415/*16ASM addll mulll bfffo divll17*/18/* Written by Bill Allombert from the ix86 version by Bruno Haible. Basically19* change insl to insq*/20#ifdef ASMINLINE21#define LOCAL_HIREMAINDER register ulong hiremainder22#define LOCAL_OVERFLOW register ulong overflow2324#define addll(a,b) \25__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \26__asm__ ("addq %3,%0 ; adcq %1,%1" \27: "=r" (__value), "=r" (overflow) \28: "0" (__arg1), "g" (__arg2), "1" ((ulong)0) \29: "cc"); \30__value; \31})3233#define addllx(a,b) \34__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b), __temp; \35__asm__ ("subq %5,%2 ; adcq %4,%0 ; adcq %1,%1" \36: "=r" (__value), "=&r" (overflow), "=&r" (__temp) \37: "0" (__arg1), "g" (__arg2), "g" (overflow), "1" ((ulong)0), "2" ((ulong)0) \38: "cc"); \39__value; \40})4142#define addllx8(a,b,c,overflow) \43do { long *__arg1 = a, *__arg2 = b, *__out = c; \44ulong __temp; \45__asm__ ("subq %5, %0 \n\t" \46"movq (%2), %0 ; adcq (%3),%0; movq %0, (%4) \n\t" \47"movq -8(%2), %0 ; adcq -8(%3),%0; movq %0, -8(%4) \n\t" \48"movq -16(%2), %0 ; adcq -16(%3),%0; movq %0, -16(%4) \n\t" \49"movq -24(%2), %0 ; adcq -24(%3),%0; movq %0, -24(%4) \n\t" \50"movq -32(%2), %0 ; adcq -32(%3),%0; movq %0, -32(%4) \n\t" \51"movq -40(%2), %0 ; adcq -40(%3),%0; movq %0, -40(%4) \n\t" \52"movq -48(%2), %0 ; adcq -48(%3),%0; movq %0, -48(%4) \n\t" \53"movq -56(%2), %0 ; adcq -56(%3),%0; movq %0, -56(%4) \n\t" \54"adcq %1, %1" \55: "=&r" (__temp), "=&r" (overflow) \56: "r" (__arg1), "r" (__arg2), "r" (__out), "g" (overflow), "0" ((ulong)0), "1" ((ulong)0) \57: "cc"); \58} while(0)5960#define subll(a,b) \61__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \62__asm__ ("subq %3,%0 ; adcq %1,%1" \63: "=r" (__value), "=r" (overflow) \64: "0" (__arg1), "g" (__arg2), "1" ((ulong)0) \65: "cc"); \66__value; \67})6869#define subllx(a,b) \70__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b), __temp; \71__asm__ ("subq %5,%2 ; sbbq %4,%0 ; adcq %1,%1" \72: "=r" (__value), "=&r" (overflow), "=&r" (__temp) \73: "0" (__arg1), "g" (__arg2), "g" (overflow), "1" ((ulong)0), "2" ((ulong)0) \74: "cc"); \75__value; \76})7778#define subllx8(a,b,c,overflow) \79do { long *__arg1 = a, *__arg2 = b, *__out = c; \80ulong __temp; \81__asm__ ("subq %5, %0 \n\t" \82"movq (%2), %0 ; sbbq (%3),%0; movq %0, (%4) \n\t" \83"movq -8(%2), %0 ; sbbq -8(%3),%0; movq %0, -8(%4) \n\t" \84"movq -16(%2), %0 ; sbbq -16(%3),%0; movq %0, -16(%4) \n\t" \85"movq -24(%2), %0 ; sbbq -24(%3),%0; movq %0, -24(%4) \n\t" \86"movq -32(%2), %0 ; sbbq -32(%3),%0; movq %0, -32(%4) \n\t" \87"movq -40(%2), %0 ; sbbq -40(%3),%0; movq %0, -40(%4) \n\t" \88"movq -48(%2), %0 ; sbbq -48(%3),%0; movq %0, -48(%4) \n\t" \89"movq -56(%2), %0 ; sbbq -56(%3),%0; movq %0, -56(%4) \n\t" \90"adcq %1, %1" \91: "=&r" (__temp), "=&r" (overflow) \92: "r" (__arg1), "r" (__arg2), "r" (__out), "g" (overflow), "0" ((ulong)0), "1" ((ulong)0) \93: "cc"); \94} while(0)9596#define mulll(a,b) \97__extension__ ({ ulong __valuelo, __arg1 = (a), __arg2 = (b); \98__asm__ ("mulq %3" \99: "=a" /* %eax */ (__valuelo), "=d" /* %edx */ (hiremainder) \100: "0" (__arg1), "rm" (__arg2)); \101__valuelo; \102})103104#define addmul(a,b) \105__extension__ ({ ulong __valuelo, __arg1 = (a), __arg2 = (b), __temp; \106__asm__ ("mulq %4 ; addq %5,%0 ; adcq %6,%1" \107: "=a" /* %eax */ (__valuelo), "=&d" /* %edx */ (hiremainder), "=r" (__temp) \108: "0" (__arg1), "rm" (__arg2), "g" (hiremainder), "2" ((ulong)0)); \109__valuelo; \110})111112#define divll(a,b) \113__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \114__asm__ ("divq %4" \115: "=a" /* %eax */ (__value), "=d" /* %edx */ (hiremainder) \116: "0" /* %eax */ (__arg1), "1" /* %edx */ (hiremainder), "mr" (__arg2)); \117__value; \118})119120#define bfffo(x) \121__extension__ ({ ulong __arg = (x); \122long leading_one_position; \123__asm__ ("bsrq %1,%0" : "=r" (leading_one_position) : "rm" (__arg)); \12463 - leading_one_position; \125})126#endif127128129