* sysdeps/alpha/div_libc.h (_ITOFS, _ITOFT, _FTOIT, _ITOFT2): New. * sysdeps/alpha/divl.S, sysdeps/alpha/divq.S, sysdeps/alpha/divqu.S, sysdeps/alpha/reml.S, sysdeps/alpha/remq.S, sysdeps/alpha/remqu.S: Use them.

2004-05-06  Richard Henderson  <rth@redhat.com>

	* sysdeps/alpha/div_libc.h (_ITOFS, _ITOFT, _FTOIT, _ITOFT2): New.
	* sysdeps/alpha/divl.S, sysdeps/alpha/divq.S, sysdeps/alpha/divqu.S,
	sysdeps/alpha/reml.S, sysdeps/alpha/remq.S, sysdeps/alpha/remqu.S:
	Use them.
This commit is contained in:
Richard Henderson 2004-05-06 22:01:01 +00:00
parent 58d87ee171
commit 165634aa4c
8 changed files with 88 additions and 73 deletions

View File

@ -1,3 +1,10 @@
2004-05-06 Richard Henderson <rth@redhat.com>
* sysdeps/alpha/div_libc.h (_ITOFS, _ITOFT, _FTOIT, _ITOFT2): New.
* sysdeps/alpha/divl.S, sysdeps/alpha/divq.S, sysdeps/alpha/divqu.S,
sysdeps/alpha/reml.S, sysdeps/alpha/remq.S, sysdeps/alpha/remqu.S:
Use them.
2004-05-06 Ulrich Drepper <drepper@redhat.com>
* math/tgmath.h (__TGMATH_UNARY_REAL_IMAG_RET_REAL):Define.

View File

@ -111,3 +111,48 @@ DIVBYZERO:
cfi_endproc
.size DIVBYZERO, .-DIVBYZERO
.endm
/* Like the ev6 instructions, but fall back to stack use on prior machines. */
.arch ev6
.macro _ITOFS gr, fr, slot
#ifdef __alpha_fix__
itofs \gr, \fr
#else
stl \gr, \slot($sp)
lds \fr, \slot($sp)
#endif
.endm
.macro _ITOFT gr, fr, slot
#ifdef __alpha_fix__
itoft \gr, \fr
#else
stq \gr, \slot($sp)
ldt \fr, \slot($sp)
#endif
.endm
.macro _FTOIT fr, gr, slot
#ifdef __alpha_fix__
ftoit \fr, \gr
#else
stt \fr, \slot($sp)
ldq \gr, \slot($sp)
#endif
.endm
/* Similarly, but move two registers. Schedules better for pre-ev6. */
.macro _ITOFT2 gr1, fr1, slot1, gr2, fr2, slot2
#ifdef __alpha_fix__
itoft \gr1, \fr1
itoft \gr2, \fr2
#else
stq \gr1, \slot1($sp)
stq \gr2, \slot2($sp)
ldt \fr1, \slot1($sp)
ldt \fr2, \slot2($sp)
#endif
.endm

View File

@ -48,25 +48,20 @@ __divl:
EXTEND (X, RV)
EXTEND (Y, AT)
stq RV, 16(sp)
stq AT, 24(sp)
ldt $f0, 16(sp)
ldt $f1, 24(sp)
_ITOFT2 RV, $f0, 16, AT, $f1, 24
cvtqt $f0, $f0
cvtqt $f1, $f1
divt/c $f0, $f1, $f0
cvttq/c $f0, $f0
stt $f0, 16(sp)
ldt $f0, 0(sp)
_FTOIT $f0, RV, 16
ldt $f0, 0(sp)
ldt $f1, 8(sp)
ldl RV, 16(sp)
lda sp, FRAME(sp)
cfi_restore ($f0)
cfi_restore ($f1)
cfi_def_cfa_offset (0)
sextl RV, RV
ret $31, (RA), 1
cfi_endproc

View File

@ -52,17 +52,13 @@ __divq:
that's done, we have at least 22 cycles until its results are
ready -- all the time in the world to figure out how we're
going to use the results. */
stq X, 16(sp)
stq Y, 24(sp)
beq Y, DIVBYZERO
stt $f0, 0(sp)
stt $f1, 8(sp)
beq Y, DIVBYZERO
cfi_rel_offset ($f0, 0)
cfi_rel_offset ($f1, 8)
ldt $f0, 16(sp)
ldt $f1, 24(sp)
_ITOFT2 X, $f0, 16, Y, $f1, 24
cvtqt $f0, $f0
cvtqt $f1, $f1
divt/c $f0, $f1, $f0
@ -77,9 +73,8 @@ __divq:
/* If we get here, we're expecting exact results from the division.
Do nothing else besides convert and clean up. */
cvttq/c $f0, $f0
stt $f0, 16(sp)
_FTOIT $f0, RV, 16
ldq RV, 16(sp)
ldt $f0, 0(sp)
cfi_restore ($f1)
cfi_remember_state
@ -117,8 +112,8 @@ $x_big:
$fix_sign_in_ret1:
cvttq/c $f0, $f0
stt $f0, 8(sp)
ldq Q, 8(sp)
_FTOIT $f0, Q, 8
.align 3
$fix_sign_in_ret2:
mulq Q, Y, QY
stq t4, 8(sp)
@ -234,10 +229,8 @@ $fix_sign_in:
blbc t5, $fix_sign_in_ret1
cvttq/c $f0, $f0
stt $f0, 8(sp)
ldq Q, 8(sp)
unop
_FTOIT $f0, Q, 8
.align 3
negq Q, Q
br $fix_sign_in_ret2

View File

@ -52,23 +52,20 @@ __divqu:
that's done, we have at least 22 cycles until its results are
ready -- all the time in the world to figure out how we're
going to use the results. */
stq X, 16(sp)
stq Y, 24(sp)
beq Y, DIVBYZERO
stt $f0, 0(sp)
stt $f1, 8(sp)
beq Y, DIVBYZERO
cfi_rel_offset ($f0, 0)
cfi_rel_offset ($f1, 8)
ldt $f0, 16(sp)
ldt $f1, 24(sp)
_ITOFT2 X, $f0, 16, Y, $f1, 24
cvtqt $f0, $f0
cvtqt $f1, $f1
blt X, $x_is_neg
divt/c $f0, $f1, $f0
/* Check to see if Y was mis-converted as signed value. */
.align 4
ldt $f1, 8(sp)
unop
nop
@ -81,9 +78,7 @@ __divqu:
/* If we get here, we're expecting exact results from the division.
Do nothing else besides convert and clean up. */
cvttq/c $f0, $f0
stt $f0, 16(sp)
ldq RV, 16(sp)
_FTOIT $f0, RV, 16
ldt $f0, 0(sp)
cfi_remember_state
cfi_restore ($f0)
@ -101,9 +96,9 @@ $x_is_neg:
ldah AT, 0x5f80 /* 2**64 as float. */
stt $f2, 24(sp)
cfi_rel_offset ($f2, 24)
stl AT, 16(sp)
lds $f2, 16(sp)
_ITOFS AT, $f2, 16
.align 4
addt $f0, $f2, $f0
unop
divt/c $f0, $f1, $f0
@ -140,10 +135,10 @@ $x_big:
#define QY t3 /* Q*Y */
cvttq/c $f0, $f0
stt $f0, 8(sp)
ldq Q, 8(sp)
_FTOIT $f0, Q, 8
mulq Q, Y, QY
.align 4
stq t4, 8(sp)
unop
ldt $f0, 0(sp)

View File

@ -50,18 +50,12 @@ __reml:
EXTEND (X, RV)
EXTEND (Y, AT)
stq RV, 16(sp)
stq AT, 24(sp)
ldt $f0, 16(sp)
ldt $f1, 24(sp)
_ITOFT2 RV, $f0, 16, AT, $f1, 24
cvtqt $f0, $f0
cvtqt $f1, $f1
divt/c $f0, $f1, $f0
cvttq/c $f0, $f0
stt $f0, 16(sp)
ldq RV, 16(sp)
_FTOIT $f0, RV, 16
ldt $f0, 0(sp)
mull RV, Y, RV
@ -70,7 +64,6 @@ __reml:
cfi_restore ($f0)
cfi_restore ($f1)
cfi_def_cfa_offset (0)
subl X, RV, RV
ret $31, (RA), 1

View File

@ -52,17 +52,13 @@ __remq:
that's done, we have at least 22 cycles until its results are
ready -- all the time in the world to figure out how we're
going to use the results. */
stq X, 16(sp)
stq Y, 24(sp)
beq Y, DIVBYZERO
stt $f0, 0(sp)
stt $f1, 8(sp)
beq Y, DIVBYZERO
cfi_rel_offset ($f0, 0)
cfi_rel_offset ($f1, 8)
ldt $f0, 16(sp)
ldt $f1, 24(sp)
_ITOFT2 X, $f0, 16, Y, $f1, 24
cvtqt $f0, $f0
cvtqt $f1, $f1
divt/c $f0, $f1, $f0
@ -77,9 +73,7 @@ __remq:
/* If we get here, we're expecting exact results from the division.
Do nothing else besides convert, compute remainder, clean up. */
cvttq/c $f0, $f0
stt $f0, 16(sp)
ldq AT, 16(sp)
_FTOIT $f0, AT, 16
mulq AT, Y, AT
ldt $f0, 0(sp)
cfi_restore ($f1)
@ -87,7 +81,6 @@ __remq:
cfi_restore ($f0)
cfi_def_cfa_offset (0)
lda sp, FRAME(sp)
subq X, AT, RV
ret $31, (RA), 1
@ -120,8 +113,8 @@ $x_big:
$fix_sign_in_ret1:
cvttq/c $f0, $f0
stt $f0, 8(sp)
ldq Q, 8(sp)
_FTOIT $f0, Q, 8
.align 3
$fix_sign_in_ret2:
mulq Q, Y, QY
stq t4, 8(sp)
@ -233,9 +226,8 @@ $fix_sign_in:
bge t1, $fix_sign_in_ret1
cvttq/c $f0, $f0
stt $f0, 8(sp)
ldq Q, 8(sp)
_FTOIT $f0, Q, 8
.align 3
negq Q, Q
br $fix_sign_in_ret2

View File

@ -52,19 +52,16 @@ __remqu:
that's done, we have at least 22 cycles until its results are
ready -- all the time in the world to figure out how we're
going to use the results. */
stq X, 16(sp)
stq Y, 24(sp)
subq Y, 1, AT
stt $f0, 0(sp)
and Y, AT, AT
stt $f1, 8(sp)
beq AT, $powerof2
cfi_rel_offset ($f0, 0)
cfi_rel_offset ($f1, 8)
ldt $f0, 16(sp)
ldt $f1, 24(sp)
_ITOFT2 X, $f0, 16, Y, $f1, 24
cvtqt $f0, $f0
cvtqt $f1, $f1
@ -82,9 +79,8 @@ __remqu:
/* If we get here, we're expecting exact results from the division.
Do nothing else besides convert, compute remainder, clean up. */
cvttq/c $f0, $f0
stt $f0, 16(sp)
_FTOIT $f0, AT, 16
ldq AT, 16(sp)
mulq AT, Y, AT
ldt $f0, 0(sp)
lda sp, FRAME(sp)
@ -93,6 +89,7 @@ __remqu:
cfi_restore ($f1)
cfi_def_cfa_offset (0)
.align 4
subq X, AT, RV
ret $31, (RA), 1
@ -105,15 +102,13 @@ $x_is_neg:
ldah AT, 0x5f80 /* 2**64 as float. */
stt $f2, 24(sp)
cfi_rel_offset ($f2, 24)
stl AT, 16(sp)
lds $f2, 16(sp)
_ITOFS AT, $f2, 16
addt $f0, $f2, $f0
unop
divt/c $f0, $f1, $f0
unop
/* Ok, we've now the divide issued. Continue with other checks. */
.align 4
ldt $f1, 8(sp)
unop
ldt $f2, 24(sp)
@ -144,10 +139,10 @@ $x_big:
#define QY t3 /* Q*Y */
cvttq/c $f0, $f0
stt $f0, 8(sp)
ldq Q, 8(sp)
_FTOIT $f0, Q, 8
mulq Q, Y, QY
.align 4
stq t4, 8(sp)
unop
ldt $f0, 0(sp)