aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>2000-07-30 08:12:12 +0000
committerMichael Hayes <m.hayes@gcc.gnu.org>2000-07-30 08:12:12 +0000
commit0ea1f6b69f728ae6b87b8d0c5fc0cfbcd8b21da7 (patch)
tree6948737ff40bd44eec2ac057bff6c63e386db935
parent00c9e663546bf07c2886e99b4c691727ea08020a (diff)
downloadgcc-0ea1f6b69f728ae6b87b8d0c5fc0cfbcd8b21da7.zip
gcc-0ea1f6b69f728ae6b87b8d0c5fc0cfbcd8b21da7.tar.gz
gcc-0ea1f6b69f728ae6b87b8d0c5fc0cfbcd8b21da7.tar.bz2
* config/c4x/libgcc.S: (divqf3): Improve accuracy.
From-SVN: r35335
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/c4x/libgcc.S25
2 files changed, 19 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0aeec92..a061e29 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2000-07-30 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
+
+ * config/c4x/libgcc.S: (divqf3): Improve accuracy.
+
2000-07-27 Mark Mitchell <mark@codesourcery.com>
Put phi nodes after NOTE_INSN_BASIC_BLOCK.
diff --git a/gcc/config/c4x/libgcc.S b/gcc/config/c4x/libgcc.S
index 576844d..06b1a75 100644
--- a/gcc/config/c4x/libgcc.S
+++ b/gcc/config/c4x/libgcc.S
@@ -133,24 +133,29 @@ ___divqf3:
mpyf r1, r0 ; r0 = r[2] * (2.0 - r[2] * v) = r[3]
; End of 3rd iteration
- or 080h, r0 ; add 1 lsb to result. needed when complemeting
- ; 1.0 / 2.0
- rnd r0
+ rnd r0 ; Minimize error in x[3]'s LSBs
; Use modified last iteration
; r[4] = (r[3] * (1.0 - (v * r[3]))) + r[3]
mpyf3 r0, r3, r1 ; r1 = r[3] * v
subrf 1.0, r1 ; r1 = 1.0 - r[3] * v
mpyf r0, r1 ; r1 = r[3] * (1.0 - r[3] * v)
+ addf r1, r0 ; r0 = r[3] * (1.0 - r[3] * v) + r[3] = r[4]
+
+ rnd r0 ; Minimize error in x[4]'s LSBs
bud ar1 ; Delayed branch
- addf r1, r0 ; r0 = r[3] * (1.0 - r[3] * v) + r[3] = r[4]
- .if .REGPARM == 0
- mpyf *-ar0(1), r0 ; Multiply by the dividend
- .else
- mpyf r2, r0 ; Multiply by the dividend
- .endif
- rnd r0
+
+ .if .REGPARM == 0
+ ldfu *-ar0(1), r2 ; Dividend in mem has only 24 bits significance
+ .else
+ rnd r2 ; Minimize error in reg dividend's LSBs
+ ; since this may have 32 bit significance
+ .endif
+
+ mpyf r2, r0 ; Multiply by the dividend
+ rnd r0 ; Round result to 32 bits
+
; Branch occurs here
#endif