Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
#line 2 "../src/kernel/ix86/asm0.h"1/* Copyright (C) 2000 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 defines some "level 0" kernel functions for Intel ix86 */16/* It is intended for use with an external "asm" definition */1718/*19ASM addll mulll bfffo divll20*/21#ifdef ASMINLINE22/* Written by Bruno Haible, 1996-1998.23addllx8/subllx8 by Bill Allombert, 2011.24*/2526/* This file can assume the GNU C extensions.27(It is included only if __GNUC__ is defined.) */2829/* Use local variables whenever possible. */30#define LOCAL_HIREMAINDER register ulong hiremainder31#define LOCAL_OVERFLOW register ulong overflow3233#define addll(a,b) \34__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \35__asm__ ("addl %3,%0 ; adcl %1,%1" \36: "=r" (__value), "=r" (overflow) \37: "0" (__arg1), "g" (__arg2), "1" ((ulong)0) \38: "cc"); \39__value; \40})4142#define addllx(a,b) \43__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b), __temp; \44__asm__ ("subl %5,%2 ; adcl %4,%0 ; adcl %1,%1" \45: "=r" (__value), "=&r" (overflow), "=&r" (__temp) \46: "0" (__arg1), "g" (__arg2), "g" (overflow), "1" ((ulong)0), "2" ((ulong)0) \47: "cc"); \48__value; \49})5051#define addllx8(a,b,c,overflow) \52do { long *__arg1 = a, *__arg2 = b, *__out = c; \53ulong __temp; \54__asm__ ("subl %5, %0 \n\t" \55"movl (%2), %0 ; adcl (%3),%0; movl %0, (%4) \n\t" \56"movl -4(%2), %0 ; adcl -4(%3),%0; movl %0, -4(%4) \n\t" \57"movl -8(%2), %0 ; adcl -8(%3),%0; movl %0, -8(%4) \n\t" \58"movl -12(%2), %0 ; adcl -12(%3),%0; movl %0, -12(%4) \n\t" \59"movl -16(%2), %0 ; adcl -16(%3),%0; movl %0, -16(%4) \n\t" \60"movl -20(%2), %0 ; adcl -20(%3),%0; movl %0, -20(%4) \n\t" \61"movl -24(%2), %0 ; adcl -24(%3),%0; movl %0, -24(%4) \n\t" \62"movl -28(%2), %0 ; adcl -28(%3),%0; movl %0, -28(%4) \n\t" \63"adcl %1, %1" \64: "=&r" (__temp), "=&r" (overflow) \65: "r" (__arg1), "r" (__arg2), "r" (__out), "g" (overflow), "0" ((ulong)0), "1" ((ulong)0) : "cc"); \66} while(0)6768#define subll(a,b) \69__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \70__asm__ ("subl %3,%0 ; adcl %1,%1" \71: "=r" (__value), "=r" (overflow) \72: "0" (__arg1), "g" (__arg2), "1" ((ulong)0) \73: "cc"); \74__value; \75})7677#define subllx(a,b) \78__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b), __temp; \79__asm__ ("subl %5,%2 ; sbbl %4,%0 ; adcl %1,%1" \80: "=r" (__value), "=&r" (overflow), "=&r" (__temp) \81: "0" (__arg1), "g" (__arg2), "g" (overflow), "1" ((ulong)0), "2" ((ulong)0) \82: "cc"); \83__value; \84})8586#define subllx8(a,b,c,overflow) \87do { long *__arg1 = a, *__arg2 = b, *__out = c; \88ulong __temp; \89__asm__ ("subl %5, %0 \n\t" \90"movl (%2), %0 ; sbbl (%3),%0; movl %0, (%4) \n\t" \91"movl -4(%2), %0 ; sbbl -4(%3),%0; movl %0, -4(%4) \n\t" \92"movl -8(%2), %0 ; sbbl -8(%3),%0; movl %0, -8(%4) \n\t" \93"movl -12(%2), %0 ; sbbl -12(%3),%0; movl %0, -12(%4) \n\t" \94"movl -16(%2), %0 ; sbbl -16(%3),%0; movl %0, -16(%4) \n\t" \95"movl -20(%2), %0 ; sbbl -20(%3),%0; movl %0, -20(%4) \n\t" \96"movl -24(%2), %0 ; sbbl -24(%3),%0; movl %0, -24(%4) \n\t" \97"movl -28(%2), %0 ; sbbl -28(%3),%0; movl %0, -28(%4) \n\t" \98"adcl %1, %1" \99: "=&r" (__temp), "=&r" (overflow) \100: "r" (__arg1), "r" (__arg2), "r" (__out), "g" (overflow), "0" ((ulong)0), "1" ((ulong)0) : "cc"); \101} while(0)102103#define mulll(a,b) \104__extension__ ({ ulong __valuelo, __arg1 = (a), __arg2 = (b); \105__asm__ ("mull %3" \106: "=a" /* %eax */ (__valuelo), "=d" /* %edx */ (hiremainder) \107: "0" (__arg1), "rm" (__arg2)); \108__valuelo; \109})110111#define addmul(a,b) \112__extension__ ({ ulong __valuelo, __arg1 = (a), __arg2 = (b), __temp; \113__asm__ ("mull %4 ; addl %5,%0 ; adcl %6,%1" \114: "=a" /* %eax */ (__valuelo), "=&d" /* %edx */ (hiremainder), "=r" (__temp) \115: "0" (__arg1), "rm" (__arg2), "g" (hiremainder), "2" ((ulong)0)); \116__valuelo; \117})118119#define divll(a,b) \120__extension__ ({ ulong __value, __arg1 = (a), __arg2 = (b); \121__asm__ ("divl %4" \122: "=a" /* %eax */ (__value), "=d" /* %edx */ (hiremainder) \123: "0" /* %eax */ (__arg1), "1" /* %edx */ (hiremainder), "mr" (__arg2)); \124__value; \125})126127#define bfffo(x) \128__extension__ ({ ulong __arg = (x); \129int leading_one_position; \130__asm__ ("bsrl %1,%0" : "=r" (leading_one_position) : "rm" (__arg)); \13131 - leading_one_position; \132})133134#endif135136137