From: Torbjorn Granlund <t...@gmplib.org>
Date: Sun, 14 Apr 2013 17:55:31 +0200

> I think we need to consider backing out some of the changes, to restore
> GMP's function on sparc to non-GNU/Linux systems (and perhaps to
> obsolete GNU/Linux systems).  We need to keep in mind the symbol
> reference code was tried and tested, and worked on a broad range of
> system.

Sure, let's revert v9/sqr_diagonal.asm and sparc64/gcd_1.asm back to
their previous state for now, and try to work from that.  Here's a
patch.

2013-04-14  David S. Miller  <da...@davemloft.net>

        * mpn/sparc32/v9/sqr_diagonal.asm: Revert LEA and INT32 changes.
        * mpn/sparc64/gcd_1.asm: Likewise.

diff -r 37082d27ed59 mpn/sparc32/v9/sqr_diagonal.asm
--- a/mpn/sparc32/v9/sqr_diagonal.asm   Sat Apr 13 23:40:21 2013 +0200
+++ b/mpn/sparc32/v9/sqr_diagonal.asm   Sun Apr 14 12:11:28 2013 -0700
@@ -73,14 +73,20 @@
 define(`fanop',`fitod %f12,%f10')      dnl  A quasi nop running in the FA pipe
 
 ASM_START()
-       LEA_THUNK(l7)
+
        TEXT
-       INT32(noll, 0)
+       ALIGN(4)
+.Lnoll:
+       .word   0
+
 PROLOGUE(mpn_sqr_diagonal)
        save    %sp,-256,%sp
 
-       LEA(L(noll),l0,l7)
-       ld      [%l0], %f8
+ifdef(`PIC',
+`.Lpc: rd      %pc,%o7
+       ld      [%o7+.Lnoll-.Lpc],%f8',
+`      sethi   %hi(.Lnoll),%g1
+       ld      [%g1+%lo(.Lnoll)],%f8')
 
        sethi   %hi(0xffff0000),%g5
        add     %i1,-8,%i1
diff -r 37082d27ed59 mpn/sparc64/gcd_1.asm
--- a/mpn/sparc64/gcd_1.asm     Sat Apr 13 23:40:21 2013 +0200
+++ b/mpn/sparc64/gcd_1.asm     Sun Apr 14 12:11:28 2013 -0700
@@ -58,8 +58,6 @@
 ASM_START()
        REGISTER(%g2,#scratch)
        REGISTER(%g3,#scratch)
-       LEA_THUNK(l7)
-       TEXT
 PROLOGUE(mpn_gcd_1)
        save    %sp, -192, %sp
        ldx     [up+0], %g1             C U low limb
@@ -95,7 +93,22 @@
         mov    0, %o3
 
 L(noreduce):
-       LEA(ctz_table,i5,l7)
+
+ifdef(`PIC',`
+       sethi   %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+       call    L(LGETPC0)
+       add     %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+       sethi   %hi(ctz_table), %g1
+       or      %g1, %lo(ctz_table), %g1
+       ldx     [%l7+%g1], %i5
+',`
+       sethi   %hh(ctz_table), %l7
+       or      %l7, %hm(ctz_table), %l7
+       sllx    %l7, 32, %l7
+       sethi   %lm(ctz_table), %g1
+       add     %l7, %g1, %l7
+       or      %l7, %lo(ctz_table), %i5
+')
 
        cmp     %o0, 0
        bnz     %xcc, L(mid)
@@ -122,4 +135,10 @@
 L(shift_alot):
        b       L(mid)
         and    %o0, MASK, %g3          C
+
+ifdef(`PIC',`
+L(LGETPC0):
+       retl
+       add     %o7, %l7, %l7
+')
 EPILOGUE()
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
http://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to