diff options
author | Richard Henderson <rth@redhat.com> | 2004-05-06 22:01:01 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2004-05-06 22:01:01 +0000 |
commit | 165634aa4c7ed7b2fe8a47ff24166400a419d141 (patch) | |
tree | 769e3eb211ade1b2dce18d6dcb745b293b8f7aef /sysdeps | |
parent | 58d87ee17185dbd0b8f927c939343eaed34c8614 (diff) | |
download | glibc-165634aa4c7ed7b2fe8a47ff24166400a419d141.tar glibc-165634aa4c7ed7b2fe8a47ff24166400a419d141.tar.gz glibc-165634aa4c7ed7b2fe8a47ff24166400a419d141.tar.bz2 glibc-165634aa4c7ed7b2fe8a47ff24166400a419d141.zip |
* 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.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/alpha/div_libc.h | 45 | ||||
-rw-r--r-- | sysdeps/alpha/divl.S | 13 | ||||
-rw-r--r-- | sysdeps/alpha/divq.S | 21 | ||||
-rw-r--r-- | sysdeps/alpha/divqu.S | 21 | ||||
-rw-r--r-- | sysdeps/alpha/reml.S | 11 | ||||
-rw-r--r-- | sysdeps/alpha/remq.S | 22 | ||||
-rw-r--r-- | sysdeps/alpha/remqu.S | 21 |
7 files changed, 81 insertions, 73 deletions
diff --git a/sysdeps/alpha/div_libc.h b/sysdeps/alpha/div_libc.h index 98566435ce..27209bd9fa 100644 --- a/sysdeps/alpha/div_libc.h +++ b/sysdeps/alpha/div_libc.h @@ -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 diff --git a/sysdeps/alpha/divl.S b/sysdeps/alpha/divl.S index 33fa1187d9..90cd6862a7 100644 --- a/sysdeps/alpha/divl.S +++ b/sysdeps/alpha/divl.S @@ -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 diff --git a/sysdeps/alpha/divq.S b/sysdeps/alpha/divq.S index 464536db3d..4df79829f9 100644 --- a/sysdeps/alpha/divq.S +++ b/sysdeps/alpha/divq.S @@ -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 diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S index 6ff6c035e2..63b575faa7 100644 --- a/sysdeps/alpha/divqu.S +++ b/sysdeps/alpha/divqu.S @@ -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) diff --git a/sysdeps/alpha/reml.S b/sysdeps/alpha/reml.S index c4eb426c5a..1bbb978f66 100644 --- a/sysdeps/alpha/reml.S +++ b/sysdeps/alpha/reml.S @@ -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 diff --git a/sysdeps/alpha/remq.S b/sysdeps/alpha/remq.S index ce527d1055..a8795c8d24 100644 --- a/sysdeps/alpha/remq.S +++ b/sysdeps/alpha/remq.S @@ -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 diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S index fa2eb626c7..f8deebbbc1 100644 --- a/sysdeps/alpha/remqu.S +++ b/sysdeps/alpha/remqu.S @@ -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) |