Commit 7405dc37 by Nick Clifton Committed by Nick Clifton

Before performing any restorative additions...

Before performing any restorative additions, test for bottom bits of IP being
set, rather than relying upon the RORs not matching.

From-SVN: r35888
parent d60eab50
2000-08-22 Nick Clifton <nickc@redhat.com>
* config/arm/lib1funcs.asm (__umodsi3): Before performing any
restorative additions, test for bottom bits of IP being set,
rather than relying upon the RORs not matching.
(__modsi3): Ditto.
2000-08-22 David Edelsohn <edelsohn@gnu.org> 2000-08-22 David Edelsohn <edelsohn@gnu.org>
* aix.h (ASM_DECLARE_FUNCTION_NAME): Call named_section() or * aix.h (ASM_DECLARE_FUNCTION_NAME): Call named_section() or
......
@ libgcc1 routines for ARM cpu. @ libgcc1 routines for ARM cpu.
@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk) @ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
/* Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. /* Copyright 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify it This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
...@@ -400,16 +400,24 @@ Over6: ...@@ -400,16 +400,24 @@ Over6:
@ Any subtractions that we should not have done will be recorded in @ Any subtractions that we should not have done will be recorded in
@ the top three bits of "overdone". Exactly which were not needed @ the top three bits of "overdone". Exactly which were not needed
@ are governed by the position of the bit, stored in ip. @ are governed by the position of the bit, stored in ip.
@ If we terminated early, because dividend became zero,
@ then none of the below will match, since the bit in ip will not be
@ in the bottom nibble.
mov work, #0xe mov work, #0xe
lsl work, #28 lsl work, #28
and overdone, work and overdone, work
bne Over7 bne Over7
pop { work } pop { work }
RET @ No fixups needed RET @ No fixups needed
@ If we terminated early, because dividend became zero, then the
@ bit in ip will not be in the bottom nibble, and we should not
@ perform the additions below. We must test for this though
@ (rather relying upon the TSTs to prevent the additions) since
@ the bit in ip could be in the top two bits which might then match
@ with one of the smaller RORs.
mov curbit, ip
mov work, #0x7
tst curbit, work
beq Over10
Over7: Over7:
mov curbit, ip mov curbit, ip
mov work, #3 mov work, #3
...@@ -490,10 +498,14 @@ Loop3: ...@@ -490,10 +498,14 @@ Loop3:
@ Any subtractions that we should not have done will be recorded in @ Any subtractions that we should not have done will be recorded in
@ the top three bits of "overdone". Exactly which were not needed @ the top three bits of "overdone". Exactly which were not needed
@ are governed by the position of the bit, stored in ip. @ are governed by the position of the bit, stored in ip.
@ If we terminated early, because dividend became zero,
@ then none of the below will match, since the bit in ip will not be
@ in the bottom nibble.
ands overdone, overdone, #0xe0000000 ands overdone, overdone, #0xe0000000
@ If we terminated early, because dividend became zero, then the
@ bit in ip will not be in the bottom nibble, and we should not
@ perform the additions below. We must test for this though
@ (rather relying upon the TSTs to prevent the additions) since
@ the bit in ip could be in the top two bits which might then match
@ with one of the smaller RORs.
tstNE ip, #0x7
RETc(eq) @ No fixups needed RETc(eq) @ No fixups needed
tst overdone, ip, ror #3 tst overdone, ip, ror #3
addne dividend, dividend, divisor, lsr #3 addne dividend, dividend, divisor, lsr #3
...@@ -503,7 +515,7 @@ Loop3: ...@@ -503,7 +515,7 @@ Loop3:
addne dividend, dividend, divisor, lsr #1 addne dividend, dividend, divisor, lsr #1
RET RET
#endif /* arm version */ #endif /* ARM version. */
FUNC_END umodsi3 FUNC_END umodsi3
...@@ -797,14 +809,22 @@ Over7: ...@@ -797,14 +809,22 @@ Over7:
@ Any subtractions that we should not have done will be recorded in @ Any subtractions that we should not have done will be recorded in
@ the top three bits of "overdone". Exactly which were not needed @ the top three bits of "overdone". Exactly which were not needed
@ are governed by the position of the bit, stored in ip. @ are governed by the position of the bit, stored in ip.
@ If we terminated early, because dividend became zero,
@ then none of the below will match, since the bit in ip will not be
@ in the bottom nibble.
mov work, #0xe mov work, #0xe
lsl work, #28 lsl work, #28
and overdone, work and overdone, work
beq Lgot_result beq Lgot_result
@ If we terminated early, because dividend became zero, then the
@ bit in ip will not be in the bottom nibble, and we should not
@ perform the additions below. We must test for this though
@ (rather relying upon the TSTs to prevent the additions) since
@ the bit in ip could be in the top two bits which might then match
@ with one of the smaller RORs.
mov curbit, ip
mov work, #0x7
tst curbit, work
beq Lgot_result
mov curbit, ip mov curbit, ip
mov work, #3 mov work, #3
ror curbit, work ror curbit, work
...@@ -896,10 +916,14 @@ Loop3: ...@@ -896,10 +916,14 @@ Loop3:
@ Any subtractions that we should not have done will be recorded in @ Any subtractions that we should not have done will be recorded in
@ the top three bits of "overdone". Exactly which were not needed @ the top three bits of "overdone". Exactly which were not needed
@ are governed by the position of the bit, stored in ip. @ are governed by the position of the bit, stored in ip.
@ If we terminated early, because dividend became zero,
@ then none of the below will match, since the bit in ip will not be
@ in the bottom nibble.
ands overdone, overdone, #0xe0000000 ands overdone, overdone, #0xe0000000
@ If we terminated early, because dividend became zero, then the
@ bit in ip will not be in the bottom nibble, and we should not
@ perform the additions below. We must test for this though
@ (rather relying upon the TSTs to prevent the additions) since
@ the bit in ip could be in the top two bits which might then match
@ with one of the smaller RORs.
tstNE ip, #0x7
beq Lgot_result beq Lgot_result
tst overdone, ip, ror #3 tst overdone, ip, ror #3
addne dividend, dividend, divisor, lsr #3 addne dividend, dividend, divisor, lsr #3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment