[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch 4.1.3] Correctly handle zero operands with gcc on PA

From: John David Anglin
Subject: [patch 4.1.3] Correctly handle zero operands with gcc on PA
Date: Mon, 24 May 2004 19:07:57 -0400 (EDT)

Here is a small fix to correctly handle zero operands using gcc on the
the PA.  See gcc/config/pa.c.

I also note that there are some inconsistencies in how gmp-4.1.3
treats hppa*-*-hpux* configure options relative to other packages.
See configfsf.guess to see how these options are currently being set.

For example, --build=hppa2.0w-hp-hpux11.11 indicates a build system
with a 64-bit PA 2.0 kernel and a CC compiler configured to generate
code for the 32-bit runtime.  --build=hppa64-hp-hpux11.11 indicates
a 64-bit PA 2.0 kernel and a CC compiler configured to generate
code for the 64-bit runtime.  Gmp treats hppa2.0w as indicating
that the compiler supports 64-bit longs and PA 2.0 features.  This
is wrong.

There are only two defined runtimes, irrespective of the PA architecture
(aside from the minor differences in the 32-bit runtime between hpux
10 and 11).  It is possible to use some of the PA 2.0 64-bit features
under the 32-bit runtime when running a wide kernel as it saves the
full 64-bit context state.  GCC doesn't do this as 64-bit register
values are not preserved across function calls.  You can currently fudge
this by configuring gmp with hppa2.0n.  However, this isn't portable, and
you need '-mpa-risc-2-0' set in CFLAGS as otherwise gas will object to
the use of PA 2.0 features.  Even on PA 2.0, GCC defaults to PA 1.1 when
generating 32-bit code.  To get portable 32-bit code on a PA 2.0 system,
you need to explicitly configure gmp using '--host=hppa1.1-hp-hpux11.11
--build=hppa1.1-hp-hpux11.11'.  This avoids using 64-bit registers when
building a 32-bit library.  If for performance reasons it is useful to
use 64-bit PA 2.0 features with the 32-bit runtime, then possibly this
should be controlled by a separate "--with" option.

J. David Anglin                                  address@hidden
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2004-05-24  John David Anglin  <address@hidden>

        * longlong.h (add_ssaaaa, sub_ddmmss): Use 'r' modifier with register
        or zero operands.

--- longlong.h.orig     Fri May 21 15:15:07 2004
+++ longlong.h  Fri May 21 15:16:05 2004
@@ -206,11 +206,11 @@ long __MPN(count_leading_zeros) _PROTO (
    is just a case of no direct support for 2.0n but treating it like 1.0. */
 #if defined (__GNUC__) && ! defined (_LONG_LONG_LIMB)
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
-  __asm__ ("add %4,%5,%1\n\tadd,dc %2,%3,%0"                           \
+  __asm__ ("add %r4,%r5,%1\n\tadd,dc %r2,%r3,%0"                       \
           : "=r" (sh), "=&r" (sl)                                      \
           : "rM" (ah), "rM" (bh), "%rM" (al), "rM" (bl))
 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
-  __asm__ ("sub %4,%5,%1\n\tsub,db %2,%3,%0"                           \
+  __asm__ ("sub %r4,%r5,%1\n\tsub,db %r2,%r3,%0"                       \
           : "=r" (sh), "=&r" (sl)                                      \
           : "rM" (ah), "rM" (bh), "rM" (al), "rM" (bl))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]