mpn/gcd_1.asm fails to build on Solaris 10 SPARC 64bit with Studio 12.3 cc - SOLVED

Mark Ashley mark at ibiblio.org
Wed May 8 06:33:25 CEST 2013


Posting this for the archives

Summary: Edit mpn/Makefile and remove "-xcode=pic32" for the mpn/gcd_1.asm
compile to complete.

Maybe Torbjorn or others can figure out why gmp-5.1.1/mpn/sparc64/gcd_1.asm
won't compile with that flag on.

The working recipe I'm using is:

    setenv CC "cc -xtarget=ultra -m64 -xcode=pic32"
    setenv CXX "CC -xtarget=ultra -m64 -xcode=pic32"
    setenv M4 /usr/local/bin/m4

    cd /var/tmp
    rm -rf gmp-5.1.1 /gmp
    xz -dc /usr/local/src/gnu/gmp-5.1.1.tar.xz | gtar -xvf -
    cd gmp-5.1.1
    setenv M4 /usr/local/bin/m4
    /bin/perl -pe 's#xarch=v9#m64#' -i configure
    ./configure --prefix=/usr/local
    /bin/perl -pe 's#^CCAS = .*#CCAS = cc -xtarget=ultra -m64 -D_STDC_C99=
-c #' -i mpn/Makefile
    /bin/perl -pe 's#^CFLAGS = .*#CFLAGS = -xtarget=ultra -m64 -DDBUG_OFF
#' -i mpn/Makefile
    gmake
    gmake check
    gmake install

Details:

host:/var/tmp/gmp-5.1.1/mpn root# /usr/local/bin/m4 --version
m4 (GNU M4) 1.4.16
host:/var/tmp/gmp-5.1.1/mpn root# sh -x ../mpn/m4-ccas
--m4=/usr/local/bin/m4 cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c
-DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1
-xtarget=ultra -m64 -xcode=pic32 -DDBUG_OFF gcd_1.asm -o gcd_1.o
M4=
CC=
DEFS=
ASM=
SEEN_O=no
+ sed s/^--m4=//
+ echo --m4=/usr/local/bin/m4
M4=/usr/local/bin/m4
CC= cc
CC= cc -xtarget=ultra
CC= cc -xtarget=ultra -m64
CC= cc -xtarget=ultra -m64 -xcode=pic32
DEFS= -D_STDC_C99=
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99=
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c
DEFS= -D_STDC_C99= -DHAVE_CONFIG_H
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I..
DEFS= -D_STDC_C99= -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I..
DEFS= -D_STDC_C99= -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_gcd_1
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32
DEFS= -D_STDC_C99= -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_gcd_1
-DDBUG_OFF
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF
+ test -n
+ sed + echo gcd_1.asm-e s/\.asm$// -e s/^.*[\/:]//

BASENAME=gcd_1
TMP=tmp-gcd_1.s
ASM=gcd_1.asm
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF tmp-gcd_1.s
SEEN_O=yes
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF tmp-gcd_1.s -o
CC= cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF tmp-gcd_1.s -o gcd_1.o
+ test -z /usr/local/bin/m4
+ test -z gcd_1.asm
+ test yes = no
+ echo /usr/local/bin/m4  -D_STDC_C99= -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP
-DOPERATION_gcd_1 -DDBUG_OFF gcd_1.asm >tmp-gcd_1.s
/usr/local/bin/m4  -D_STDC_C99= -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP
-DOPERATION_gcd_1 -DDBUG_OFF gcd_1.asm >tmp-gcd_1.s
+ /usr/local/bin/m4 -D_STDC_C99= -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP
-DOPERATION_gcd_1 -DDBUG_OFF gcd_1.asm
+ echo  cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H
-I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF tmp-gcd_1.s -o gcd_1.o
 cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF tmp-gcd_1.s -o gcd_1.o
+ cc -xtarget=ultra -m64 -xcode=pic32 -D_STDC_C99= -c -DHAVE_CONFIG_H -I.
-I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_gcd_1 -xtarget=ultra -m64
-xcode=pic32 -DDBUG_OFF tmp-gcd_1.s -o gcd_1.o
/opt/solarisstudio12.3/prod/bin/fbe: "tmp-gcd_1.s": , approx line 282:
internal error: pic_relocs(): hh reltype?
cc: fbe failed for tmp-gcd_1.s
+ exit


Fiddling with the compiler args:

This fails (using the original compiler args):
host:/var/tmp/gmp-5.1.1/mpn root# cc -xtarget=ultra -m64 -xcode=pic32 -c
tmp-gcd_1.s -o gcd_1.o
/opt/solarisstudio12.3/prod/bin/fbe: "tmp-gcd_1.s": , approx line 282:
internal error: pic_relocs(): hh reltype?
cc: fbe failed for tmp-gcd_1.s

This works (removed -xcode=pic32):
host:/var/tmp/gmp-5.1.1/mpn root# cc -xtarget=ultra -m64 -c tmp-gcd_1.s -o
gcd_1.o
host:/var/tmp/gmp-5.1.1/mpn root#

This page talks about the pic32 setting:
http://docs.oracle.com/cd/E19205-01/819-5267/bkbaq/index.html

Edited gmp-5.1.1/mpn/Makefile and removed -xcode=pic32 from the CCAS and
CFLAGS variable definitions
Added the perl commands to the recipe above to automate this.

The gmake then builds everything.

gmake check passes everything:
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests'
PASS: t-bswap
PASS: t-constants
PASS: t-count_zeros
PASS: t-gmpmax
PASS: t-hightomask
PASS: t-modlinv
PASS: t-popc
PASS: t-parity
PASS: t-sub
==================
All 9 tests passed
==================
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests/mpn'
PASS: t-asmtype
PASS: t-aors_1
PASS: t-divrem_1
PASS: t-mod_1
PASS: t-fat
PASS: t-get_d
PASS: t-instrument
PASS: t-iord_u
PASS: t-mp_bases
PASS: t-perfsqr
PASS: t-scan
PASS: logic
PASS: t-toom22
PASS: t-toom32
PASS: t-toom33
PASS: t-toom42
PASS: t-toom43
PASS: t-toom44
PASS: t-toom52
PASS: t-toom53
PASS: t-toom54
PASS: t-toom62
PASS: t-toom63
PASS: t-toom6h
PASS: t-toom8h
PASS: t-toom2-sqr
PASS: t-toom3-sqr
PASS: t-toom4-sqr
PASS: t-toom6-sqr
PASS: t-toom8-sqr
PASS: t-mul
PASS: t-mullo
PASS: t-mulmod_bnm1
PASS: t-sqrmod_bnm1
PASS: t-mulmid
PASS: t-hgcd
PASS: t-hgcd_appr
PASS: t-matrix22
PASS: t-invert
PASS: t-div
PASS: t-bdiv
PASS: t-broot
PASS: t-brootinv
===================
All 43 tests passed
===================
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests/mpz'
PASS: t-addsub
PASS: t-cmp
PASS: t-mul
PASS: t-mul_i
PASS: t-tdiv
PASS: t-tdiv_ui
PASS: t-fdiv
PASS: t-fdiv_ui
PASS: t-cdiv_ui
PASS: t-gcd
PASS: t-gcd_ui
PASS: t-lcm
PASS: t-invert
PASS: dive
PASS: dive_ui
PASS: t-sqrtrem
PASS: convert
PASS: io
PASS: t-inp_str
PASS: logic
PASS: bit
PASS: t-powm
PASS: t-powm_ui
PASS: t-pow
PASS: t-div_2exp
PASS: reuse
PASS: t-root
PASS: t-perfsqr
PASS: t-perfpow
PASS: t-jac
PASS: t-bin
PASS: t-get_d
PASS: t-get_d_2exp
PASS: t-get_si
PASS: t-set_d
PASS: t-set_si
PASS: t-fac_ui
PASS: t-mfac_uiui
PASS: t-primorial_ui
PASS: t-fib_ui
PASS: t-lucnum_ui
PASS: t-scan
PASS: t-fits
PASS: t-divis
PASS: t-divis_2exp
PASS: t-cong
PASS: t-cong_2exp
PASS: t-sizeinbase
PASS: t-set_str
PASS: t-aorsmul
PASS: t-cmp_d
PASS: t-cmp_si
PASS: t-hamdist
PASS: t-oddeven
PASS: t-popcount
PASS: t-set_f
PASS: t-io_raw
PASS: t-import
PASS: t-export
PASS: t-pprime_p
PASS: t-nextprime
PASS: t-remove
===================
All 62 tests passed
===================
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests/mpq'
PASS: t-aors
PASS: t-cmp
PASS: t-cmp_ui
PASS: t-cmp_si
PASS: t-equal
PASS: t-get_d
PASS: t-get_str
PASS: t-inp_str
PASS: t-inv
PASS: t-md_2exp
PASS: t-set_f
PASS: t-set_str
PASS: io
PASS: reuse
===================
All 14 tests passed
===================
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests/mpf'
PASS: t-add
PASS: t-sub
PASS: t-conv
PASS: t-sqrt
PASS: t-sqrt_ui
PASS: t-muldiv
PASS: t-dm2exp
PASS: reuse
PASS: t-cmp_d
PASS: t-cmp_si
PASS: t-div
PASS: t-fits
PASS: t-get_d
PASS: t-get_d_2exp
PASS: t-get_si
PASS: t-get_ui
PASS: t-gsprec
PASS: t-inp_str
PASS: t-int_p
PASS: t-mul_ui
PASS: t-set
PASS: t-set_q
PASS: t-set_si
PASS: t-set_ui
PASS: t-trunc
PASS: t-ui_div
PASS: t-eq
===================
All 27 tests passed
===================
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests/rand'
PASS: t-iset
PASS: t-lc2exp
PASS: t-mt
PASS: t-rand
PASS: t-urbui
PASS: t-urmui
PASS: t-urndmm
==================
All 7 tests passed
==================
gmake[4]: Entering directory `/var/tmp/gmp-5.1.1/tests/misc'
PASS: t-printf
PASS: t-scanf
PASS: t-locale
==================
All 3 tests passed
==================




The files :

host:/var/tmp/gmp-5.1.1/mpn root# ls -al gcd_1.asm
lrwxrwxrwx   1 root     root          24 May  8 11:39 gcd_1.asm ->
../mpn/sparc64/gcd_1.asm


host:/var/tmp/gmp-5.1.1/mpn root# cat -n gcd_1.asm
     1  dnl  SPARC64 mpn_gcd_1.
     2
     3  dnl  Based on the K7 gcd_1.asm, by Kevin Ryde.  Rehacked for SPARC
by Torbjorn
     4  dnl  Granlund.
     5
     6  dnl  Copyright 2000, 2001, 2002, 2005, 2009, 2011, 2012 Free
Software
     7  dnl  Foundation, Inc.
     8
     9  dnl  This file is part of the GNU MP Library.
    10
    11  dnl  The GNU MP Library is free software; you can redistribute it
and/or modify
    12  dnl  it under the terms of the GNU Lesser General Public License as
published
    13  dnl  by the Free Software Foundation; either version 3 of the
License, or (at
    14  dnl  your option) any later version.
    15
    16  dnl  The GNU MP Library is distributed in the hope that it will be
useful, but
    17  dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
    18  dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
General Public
    19  dnl  License for more details.
    20
    21  dnl  You should have received a copy of the GNU Lesser General
Public License
    22  dnl  along with the GNU MP Library.  If not, see
http://www.gnu.org/licenses/.
    23
    24  include(`../config.m4')
    25
    26
    27  C                 cycles/bit (approx)
    28  C UltraSPARC 1&2:      5.1
    29  C UltraSPARC 3:        5.0
    30  C UltraSPARC T1:      12.8
    31  C Numbers measured with: speed -CD -s32-64 -t32 mpn_gcd_1
    32
    33  C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if
n==0.
    34
    35  deflit(MAXSHIFT, 7)
    36  deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
    37
    38          .section        ".rodata"
    39  ctz_table:
    40          .byte   MAXSHIFT
    41  forloop(i,1,MASK,
    42  `       .byte   m4_count_trailing_zeros(i)
    43  ')
    44
    45
    46  C Threshold of when to call bmod when U is one limb.  Should be
about
    47  C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
    48  define(`BMOD_THRES_LOG2', 14)
    49
    50  C INPUT PARAMETERS
    51  define(`up',    `%i0')
    52  define(`n',     `%i1')
    53  define(`v0',    `%i2')
    54
    55
    56  ASM_START()
    57          REGISTER(%g2,#scratch)
    58          REGISTER(%g3,#scratch)
    59  PROLOGUE(mpn_gcd_1)
    60          save    %sp, -192, %sp
    61          ldx     [up+0], %g1             C U low limb
    62          mov     -1, %i4
    63          or      v0, %g1, %g2            C x | y
    64
    65  L(twos):
    66          inc     %i4
    67          andcc   %g2, 1, %g0
    68          bz,a    %xcc, L(twos)
    69           srlx   %g2, 1, %g2
    70
    71  L(divide_strip_y):
    72          andcc   v0, 1, %g0
    73          bz,a    %xcc, L(divide_strip_y)
    74           srlx   v0, 1, v0
    75
    76          cmp     n, 1                    C if n > 1 we need
    77          bnz     %xcc, L(bmod)           C to call bmod_1
    78           nop
    79
    80  C Both U and V are single limbs, reduce with bmod if u0 >> v0.
    81          srlx    %g1, BMOD_THRES_LOG2, %g2
    82          cmp     %g2, v0
    83          bleu    %xcc, L(noreduce)
    84           mov    %g1, %o0
    85
    86  L(bmod):
    87          mov     up, %o0
    88          mov     n, %o1
    89          mov     v0, %o2
    90          call    mpn_modexact_1c_odd
    91           mov    0, %o3
    92
    93  L(noreduce):
    94
    95  ifdef(`PIC',`
    96          sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
    97          call    L(LGETPC0)
    98          add     %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
    99          sethi   %hi(ctz_table), %g1
   100          or      %g1, %lo(ctz_table), %g1
   101          ldx     [%l7+%g1], %i5
   102  ',`
   103          sethi   %hh(ctz_table), %l7
   104          or      %l7, %hm(ctz_table), %l7
   105          sllx    %l7, 32, %l7
   106          sethi   %lm(ctz_table), %g1
   107          add     %l7, %g1, %l7
   108          or      %l7, %lo(ctz_table), %i5
   109  ')
   110
   111          cmp     %o0, 0
   112          bnz     %xcc, L(mid)
   113           andcc  %o0, MASK, %g3          C
   114
   115          return  %i7+8
   116           sllx   %o2, %o4, %o0           C CAUTION: v0 alias for o2
   117
   118          ALIGN(16)
   119  L(top): movcc   %xcc, %l4, v0           C v = min(u,v)
   120          movcc   %xcc, %l2, %o0          C u = |v - u]
   121          cmp     %g3, 0                  C are all MAXSHIFT low bits
zero?
   122  L(mid): ldub    [%i5+%g3], %g3          C
   123          bz,a    %xcc, L(shift_alot)     C
   124           srlx   %o0, MAXSHIFT, %o0
   125          srlx    %o0, %g3, %l4           C new u, odd
   126          nop                             C force parallel exec of
sub insns
   127          subcc   v0, %l4, %l2            C v - u, set flags for
branch and movcc
   128          sub     %l4, v0, %o0            C u - v
   129          bnz     %xcc, L(top)            C
   130           and    %l2, MASK, %g3          C extract low MAXSHIFT bits
from (v-u)
   131
   132          return  %i7+8
   133           sllx   %o2, %o4, %o0           C CAUTION: v0 alias for o2
   134
   135  L(shift_alot):
   136          b       L(mid)
   137           andcc  %o0, MASK, %g3          C
   138
   139  ifdef(`PIC',`
   140  L(LGETPC0):
   141          retl
   142          add     %o7, %l7, %l7
   143  ')
   144  EPILOGUE()


host:/var/tmp/gmp-5.1.1/mpn root# cat -n tmp-gcd_1.s
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58          .section        ".rodata"
    59  ctz_table:
    60          .byte   7
    61          .byte   0
    62          .byte   1
    63          .byte   0
    64          .byte   2
    65          .byte   0
    66          .byte   1
    67          .byte   0
    68          .byte   3
    69          .byte   0
    70          .byte   1
    71          .byte   0
    72          .byte   2
    73          .byte   0
    74          .byte   1
    75          .byte   0
    76          .byte   4
    77          .byte   0
    78          .byte   1
    79          .byte   0
    80          .byte   2
    81          .byte   0
    82          .byte   1
    83          .byte   0
    84          .byte   3
    85          .byte   0
    86          .byte   1
    87          .byte   0
    88          .byte   2
    89          .byte   0
    90          .byte   1
    91          .byte   0
    92          .byte   5
    93          .byte   0
    94          .byte   1
    95          .byte   0
    96          .byte   2
    97          .byte   0
    98          .byte   1
    99          .byte   0
   100          .byte   3
   101          .byte   0
   102          .byte   1
   103          .byte   0
   104          .byte   2
   105          .byte   0
   106          .byte   1
   107          .byte   0
   108          .byte   4
   109          .byte   0
   110          .byte   1
   111          .byte   0
   112          .byte   2
   113          .byte   0
   114          .byte   1
   115          .byte   0
   116          .byte   3
   117          .byte   0
   118          .byte   1
   119          .byte   0
   120          .byte   2
   121          .byte   0
   122          .byte   1
   123          .byte   0
   124          .byte   6
   125          .byte   0
   126          .byte   1
   127          .byte   0
   128          .byte   2
   129          .byte   0
   130          .byte   1
   131          .byte   0
   132          .byte   3
   133          .byte   0
   134          .byte   1
   135          .byte   0
   136          .byte   2
   137          .byte   0
   138          .byte   1
   139          .byte   0
   140          .byte   4
   141          .byte   0
   142          .byte   1
   143          .byte   0
   144          .byte   2
   145          .byte   0
   146          .byte   1
   147          .byte   0
   148          .byte   3
   149          .byte   0
   150          .byte   1
   151          .byte   0
   152          .byte   2
   153          .byte   0
   154          .byte   1
   155          .byte   0
   156          .byte   5
   157          .byte   0
   158          .byte   1
   159          .byte   0
   160          .byte   2
   161          .byte   0
   162          .byte   1
   163          .byte   0
   164          .byte   3
   165          .byte   0
   166          .byte   1
   167          .byte   0
   168          .byte   2
   169          .byte   0
   170          .byte   1
   171          .byte   0
   172          .byte   4
   173          .byte   0
   174          .byte   1
   175          .byte   0
   176          .byte   2
   177          .byte   0
   178          .byte   1
   179          .byte   0
   180          .byte   3
   181          .byte   0
   182          .byte   1
   183          .byte   0
   184          .byte   2
   185          .byte   0
   186          .byte   1
   187          .byte   0
   188
   189
   190
   191
   192
   193
   194
   195
   196
   197
   198
   199
   200
   201
   202          .register %g2,#scratch
   203          .register %g3,#scratch
   204          .text
   205          .align  8
   206          .globl  __gmpn_gcd_1
   207          .type   __gmpn_gcd_1,#function
   208  __gmpn_gcd_1:
   209          save    %sp, -192, %sp
   210          ldx     [%i0+0], %g1
   211          mov     -1, %i4
   212          or      %i2, %g1, %g2
   213
   214  .Ltwos:
   215          inc     %i4
   216          andcc   %g2, 1, %g0
   217          bz,a    %xcc, .Ltwos
   218           srlx   %g2, 1, %g2
   219
   220  .Ldivide_strip_y:
   221          andcc   %i2, 1, %g0
   222          bz,a    %xcc, .Ldivide_strip_y
   223           srlx   %i2, 1, %i2
   224
   225          cmp     %i1, 1
   226          bnz     %xcc, .Lbmod
   227           nop
   228
   229
   230          srlx    %g1, 14, %g2
   231          cmp     %g2, %i2
   232          bleu    %xcc, .Lnoreduce
   233           mov    %g1, %o0
   234
   235  .Lbmod:
   236          mov     %i0, %o0
   237          mov     %i1, %o1
   238          mov     %i2, %o2
   239          call    __gmpn_modexact_1c_odd
   240           mov    0, %o3
   241
   242  .Lnoreduce:
   243
   244
   245          sethi   %hh(ctz_table), %l7
   246          or      %l7, %hm(ctz_table), %l7
   247          sllx    %l7, 32, %l7
   248          sethi   %lm(ctz_table), %g1
   249          add     %l7, %g1, %l7
   250          or      %l7, %lo(ctz_table), %i5
   251
   252
   253          cmp     %o0, 0
   254          bnz     %xcc, .Lmid
   255           andcc  %o0, 127, %g3
   256
   257          return  %i7+8
   258           sllx   %o2, %o4, %o0
   259
   260          .align  16
   261  .Ltop:  movcc   %xcc, %l4, %i2
   262          movcc   %xcc, %l2, %o0
   263          cmp     %g3, 0
   264  .Lmid:  ldub    [%i5+%g3], %g3
   265          bz,a    %xcc, .Lshift_alot
   266           srlx   %o0, 7, %o0
   267          srlx    %o0, %g3, %l4
   268          nop
   269          subcc   %i2, %l4, %l2
   270          sub     %l4, %i2, %o0
   271          bnz     %xcc, .Ltop
   272           and    %l2, 127, %g3
   273
   274          return  %i7+8
   275           sllx   %o2, %o4, %o0
   276
   277  .Lshift_alot:
   278          b       .Lmid
   279           andcc  %o0, 127, %g3
   280
   281
   282          .size   __gmpn_gcd_1,.-__gmpn_gcd_1


host:/var/tmp/gmp-5.1.1/mpn root# cat ../config.h | grep ^#
#define GMP_MPARAM_H_SUGGEST "./mpn/sparc64/ultrasparct1/gmp-mparam.h"
#define HAVE_ALARM 1
#define HAVE_ALLOCA_H 1
#define HAVE_ATTRIBUTE_CONST 1
#define HAVE_ATTRIBUTE_MALLOC 1
#define HAVE_ATTRIBUTE_MODE 1
#define HAVE_ATTRIBUTE_NORETURN 1
#define HAVE_CLOCK 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_DECL_FGETC 1
#define HAVE_DECL_FSCANF 1
#define HAVE_DECL_OPTARG 1
#define HAVE_DECL_SYS_ERRLIST 0
#define HAVE_DECL_SYS_NERR 0
#define HAVE_DECL_UNGETC 1
#define HAVE_DECL_VFPRINTF 1
#define HAVE_DLFCN_H 1
#define HAVE_DOUBLE_IEEE_BIG_ENDIAN 1
#define HAVE_FCNTL_H 1
#define HAVE_FLOAT_H 1
#define HAVE_GETPAGESIZE 1
#define HAVE_GETRUSAGE 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_INTMAX_T 1
#define HAVE_INTPTR_T 1
#define HAVE_INTTYPES_H 1
#define HAVE_LANGINFO_H 1
#define HAVE_LIMB_BIG_ENDIAN 1
#define HAVE_LOCALECONV 1
#define HAVE_LOCALE_H 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_LONG_LONG 1
#define HAVE_MEMORY_H 1
#define HAVE_MEMSET 1
#define HAVE_MMAP 1
#define HAVE_MPROTECT 1
#define HAVE_NATIVE_mpn_add_n 1
#define HAVE_NATIVE_mpn_add_nc 1
#define HAVE_NATIVE_mpn_addlsh1_n 1
#define HAVE_NATIVE_mpn_addlsh2_n 1
#define HAVE_NATIVE_mpn_copyd 1
#define HAVE_NATIVE_mpn_copyi 1
#define HAVE_NATIVE_mpn_gcd_1 1
#define HAVE_NATIVE_mpn_lshift 1
#define HAVE_NATIVE_mpn_lshiftc 1
#define HAVE_NATIVE_mpn_mul_1 1
#define HAVE_NATIVE_mpn_rsblsh1_n 1
#define HAVE_NATIVE_mpn_rsblsh2_n 1
#define HAVE_NATIVE_mpn_rshift 1
#define HAVE_NATIVE_mpn_sub_n 1
#define HAVE_NATIVE_mpn_sub_nc 1
#define HAVE_NATIVE_mpn_sublsh1_n 1
#define HAVE_NATIVE_mpn_sublsh2_n 1
#define HAVE_NL_LANGINFO 1
#define HAVE_NL_TYPES_H 1
#define HAVE_POPEN 1
#define HAVE_PROCESSOR_INFO 1
#define HAVE_PTRDIFF_T 1
#define HAVE_QUAD_T 1
#define HAVE_RAISE 1
#define HAVE_SIGACTION 1
#define HAVE_SIGALTSTACK 1
#define HAVE_SIGSTACK 1
#define HAVE_SPEED_CYCLECOUNTER 2
#define HAVE_STACK_T 1
#define HAVE_STDARG 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRCHR 1
#define HAVE_STRERROR 1
#define HAVE_STRINGIZE 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_SYSCONF 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_PROCESSOR_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_SYSINFO_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TIMES 1
#define HAVE_UINT_LEAST32_T 1
#define HAVE_UNISTD_H 1
#define HAVE_VSNPRINTF 1
#define LSYM_PREFIX ".L"
#define LT_OBJDIR ".libs/"
#define PACKAGE "gmp"
#define PACKAGE_BUGREPORT "gmp-bugs at gmplib.org, see
http://gmplib.org/manual/Reporting-Bugs.html"
#define PACKAGE_NAME "GNU MP"
#define PACKAGE_STRING "GNU MP 5.1.1"
#define PACKAGE_TARNAME "gmp"
#define PACKAGE_URL "http://www.gnu.org/software/gmp/"
#define PACKAGE_VERSION "5.1.1"
#define RETSIGTYPE void
#define SIZEOF_MP_LIMB_T 8
#define SIZEOF_UNSIGNED 4
#define SIZEOF_UNSIGNED_LONG 8
#define SIZEOF_UNSIGNED_SHORT 2
#define SIZEOF_VOID_P 8
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
#define TUNE_SQR_TOOM2_MAX SQR_TOOM2_MAX_GENERIC
#define VERSION "5.1.1"
#define WANT_FFT 1
#define WANT_TMP_REENTRANT 1
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
#  define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# endif
#endif
#define YYTEXT_POINTER 1
#ifndef __cplusplus
#endif
#define restrict __restrict__
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__
#endif


More information about the gmp-bugs mailing list