Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
#line 2 "../src/kernel/hppa64/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/* This file was made using idea from Bruno Haible ix86 asm inline kernel16* and code from Nigel Smart hppa asm kernel. mulll was inspired from17* longlong.h from the GNU MP package.*/1819/*20ASM addll mulll21NOASM bfffo divll22*/23#ifdef ASMINLINE24#define LOCAL_HIREMAINDER register ulong hiremainder25#define LOCAL_OVERFLOW register ulong overflow2627#define addll(a,b) \28__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \29__asm__ ("add %2,%3,%0\n\tadd,dc %%r0,%%r0,%1" \30: "=r" (__value), "=r" (overflow) \31: "r" (__arg1), "r" (__arg2) \32: "cc"); \33__value; \34})3536#define addllx(a,b) \37__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \38__asm__ ("sub %4,%5,%%r0\n\tadd,dc %2,%3,%0\n\tadd,dc %%r0,%%r0,%1" \39: "=r" (__value), "=r" (overflow) \40: "r" (__arg1), "r" (__arg2), "r" (overflow), "r" ((ulong) 1)\41: "cc"); \42__value; \43})4445#define subll(a,b) \46__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \47__asm__ ("sub %2,%3,%0\n\tadd,dc %%r0,%%r0,%1\n\tsubi 1,%1,%1" \48: "=r" (__value), "=r" (overflow) \49: "r" (__arg1), "r" (__arg2) \50: "cc"); \51__value; \52})5354#define subllx(a,b) \55__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \56__asm__ ("sub %%r0,%4,%%r0\n\tsub,db %2,%3,%0\n\tadd,dc %%r0,%%r0,%1\n\tsubi 1,%1,%1" \57: "=&r" (__value), "=r" (overflow) \58: "r" (__arg1), "r" (__arg2), "r" (overflow)\59: "cc"); \60__value; \61})6263/* z=a+b; c+= carry; return z */64#define __addllc(a,b,c) \65__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \66__asm__ ("add %2,%3,%0\n\tadd,dc %4,%%r0,%1" \67: "=&r" (__value), "=r" (c) \68: "r" (__arg1), "r" (__arg2), "r" (c) \69: "cc"); \70__value; \71})7273/* 32x32->64 multiply*/74#define __mulhh(a,b) \75__extension__ ({ unsigned int __arg1 = (a), __arg2 = (b); \76ulong __value; \77__asm__ ("xmpyu %1,%2,%0" \78: "=f" (__value) \79: "f" (__arg1), "f" (__arg2) \80: "cc"); \81__value; \82})8384#define mulll(arg1,arg2) \85__extension__ ({ \86const ulong __x=(arg1), __y=(arg2); \87const ulong __xlo = LOWWORD(__x), __xhi = HIGHWORD(__x); \88const ulong __ylo = LOWWORD(__y), __yhi = HIGHWORD(__y); \89ulong __xylo,__xymid,__xyhi,__xymidhi,__xymidlo; \90ulong __xylh,__xyhl; \91__xylo = __mulhh(__xlo,__ylo); __xyhi = __mulhh(__xhi,__yhi); \92__xylh = __mulhh(__xlo,__yhi); __xyhl = __mulhh(__xhi,__ylo); \93__xymid = __xylh+__xyhl; \94if (__xymid<__xylh) __xyhi += (1UL << BITS_IN_HALFULONG); \95__xymidhi = HIGHWORD(__xymid); \96__xymidlo = __xymid << BITS_IN_HALFULONG; \97__xylo = __addllc(__xylo,__xymidlo,__xyhi); \98hiremainder = __xyhi + __xymidhi; \99__xylo; \100})101102#define addmul(arg1,arg2) \103__extension__ ({ \104const ulong __x=(arg1), __y=(arg2); \105const ulong __xlo = LOWWORD(__x), __xhi = HIGHWORD(__x); \106const ulong __ylo = LOWWORD(__y), __yhi = HIGHWORD(__y); \107ulong __xylo,__xymid,__xyhi,__xymidhi,__xymidlo; \108ulong __xylh,__xyhl; \109__xylo = __mulhh(__xlo,__ylo); __xyhi = __mulhh(__xhi,__yhi); \110__xylh = __mulhh(__xlo,__yhi); __xyhl = __mulhh(__xhi,__ylo); \111__xymid = __xylh+__xyhl; \112if (__xymid<__xylh) __xyhi += (1UL << BITS_IN_HALFULONG); \113__xylo = __addllc(__xylo,hiremainder,__xyhi); \114__xymidhi = HIGHWORD(__xymid); \115__xymidlo = __xymid << BITS_IN_HALFULONG; \116__xylo = __addllc(__xylo,__xymidlo,__xyhi); \117hiremainder = __xyhi + __xymidhi; \118__xylo; \119})120121#endif122123124