[BACK]Return to asm0.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src / kernel / alpha

Annotation of OpenXM_contrib/pari-2.2/src/kernel/alpha/asm0.h, Revision 1.2

1.2     ! noro        1: /* $Id: asm0.h,v 1.3 2001/10/12 20:27:09 karim Exp $
        !             2:
        !             3: Copyright (C) 2000  The PARI group.
        !             4:
        !             5: This file is part of the PARI/GP package.
        !             6:
        !             7: PARI/GP is free software; you can redistribute it and/or modify it under the
        !             8: terms of the GNU General Public License as published by the Free Software
        !             9: Foundation. 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
        !            15:
1.1       noro       16: ulong overflow;
                     17: ulong hiremainder;
                     18:
                     19: #define LOCAL_OVERFLOW
                     20: #define LOCAL_HIREMAINDER
                     21: #define SAVE_OVERFLOW
                     22: #define SAVE_HIREMAINDER
                     23:
1.2     ! noro       24: #ifndef ASMINLINE
        !            25: BEGINEXTERN
        !            26:   extern long addll(ulong a, ulong b);
        !            27:   extern long addllx(ulong a, ulong b);
        !            28:   extern long subll(ulong a, ulong b);
        !            29:   extern long subllx(ulong a, ulong b);
        !            30:   extern long shiftl(ulong x, ulong y);
        !            31:   extern long shiftlr(ulong x, ulong y);
        !            32:   extern long mulll(ulong x, ulong y);
        !            33:   extern long addmul(ulong x, ulong y);
        !            34: ENDEXTERN
1.1       noro       35:
1.2     ! noro       36: #else /* ASMINLINE */
1.1       noro       37: /* From the PARI source, using gcc __asm__ format. */
                     38:
                     39: #define addll(a, b)\
                     40: ({ register ulong __value, __arg1 = (a), __arg2 = (b); \
                     41:   __asm__ volatile ("addq %2,%3,%0\n\tcmpult %4,%2,%1" \
                     42:    : "=r" (__value), "=r" (overflow) \
                     43:    : "r" (__arg1), "r" (__arg2), "0" ((ulong) 0)); \
                     44:   __value; \
                     45: })
                     46:
                     47: #define addllx(a, b)\
                     48: ({ register ulong __value, __arg1 = (a), __arg2 = (b), __temp; \
                     49:  __asm__ volatile ("addq %3,%4,%0\n\tcmpult %5,%3,%2\n\taddq %5,%6,%0\n\tcmpult %5,%6,%1\n\taddq %6,%7,%1\n\t" \
                     50:    : "=r" (__value), "=r" (overflow), "=r" (__temp) \
                     51:    : "r" (__arg1), "r" (__arg2), "0" ((ulong) 0), "1" (overflow), "2" ((ulong) 0)); \
                     52: __value; \
                     53: })
                     54:
                     55: #define subll(a, b)\
                     56: ({ register ulong __value, __arg1 = (a), __arg2 = (b); \
                     57:   __asm__ volatile ("subq %2,%3,%0\n\tcmpult %2,%4,%1" \
                     58:    : "=r" (__value), "=r" (overflow) \
                     59:    : "r" (__arg1), "r" (__arg2), "0" ((ulong)0)); \
                     60:   __value; \
                     61: })
                     62:
                     63: #define subllx(a, b)\
                     64: ({ register ulong __value, __arg1 = (a), __arg2 = (b), __temp1, __temp2; \
                     65: __asm__ volatile ("subq %4,%5,%2\n\tcmpult %4,%8,%3\n\tsubq %8,%7,%0\n\tcmpult %8,%6,%1\n\taddq %7,%9,%1\n\t" \
                     66:    : "=r" (__value), "=r" (overflow), "=r" (__temp1), "=r" (__temp2)  \
                     67:    : "r" (__arg1), "r" (__arg2), "0" ((ulong)0), "1" (overflow), "2" ((ulong)0), "3" ((ulong)0)); \
                     68:  __value; \
                     69: })
                     70:
                     71: #define shiftl(a, b) \
                     72: ({ register ulong __value, __arg1 = (a), __arg2 = (b), __temp; \
                     73:  __asm__ volatile ("subq %5,%4,%2\n\tsll %3,%4,%0\n\tsrl %3,%6,%1\n\t" \
                     74:    : "=r" (__value), "=r" (hiremainder), "=r" (__temp) \
                     75:    : "r" (__arg1), "r" (__arg2), "n" ((ulong) 64), "2" ((ulong)0)); \
                     76:  __value; \
                     77: })
                     78:
                     79: #define shiftlr(a, b) \
                     80: ({ register ulong __value, __arg1 = (a), __arg2 = (b), __temp; \
                     81:  __asm__ volatile ("subq %5,%4,%2\n\tsrl %3,%4,%0\n\tsll %3,%6,%1\n\t" \
                     82:    : "=r" (__value), "=r" (hiremainder), "=r" (__temp) \
                     83:    : "r" (__arg1), "r" (__arg2), "n" ((ulong) 64), "2" ((ulong)0)); \
                     84:  __value; \
                     85: })
                     86:
                     87: #define mulll(a, b) \
                     88: ({ register ulong __value, __arg1 = (a), __arg2 = (b); \
                     89:  __asm__ volatile ("umulh %2,%3,%1\n\tmulq %2,%3,%0\n\t" \
                     90:    : "=r" (__value), "=r" (hiremainder) \
                     91:    : "r" (__arg1), "r" (__arg2)); \
                     92:  __value; \
                     93: })
                     94:
                     95: #define addmul(a, b) \
                     96: ({ register ulong __value, __arg1 = (a), __arg2 = (b), __temp; \
                     97:  __asm__ volatile ("mulq %3,%4,%0\n\tumulh %3,%4,%2\n\taddq %5,%6,%0\n\tcmpult %5,%6,%1\n\taddq %7,%6,%1\n\t" \
                     98:    : "=r" (__value), "=r" (hiremainder), "=r" (__temp) \
                     99:    : "r" (__arg1), "r" (__arg2), "0" ((ulong) 0), "1" (hiremainder), "2" ((ulong) 0)); \
                    100:  __value; \
                    101: })
1.2     ! noro      102: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>