aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-01-25 17:51:51 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-01-25 17:51:51 +0000
commitcff555dccdb73f52ab49ccf65e7f23263248ee86 (patch)
tree22bc75f588f0a64706c1b78b24433cb1927c255c
parent30f58b01a438ce9b02693331ee76995352c28db8 (diff)
downloadgcc-cff555dccdb73f52ab49ccf65e7f23263248ee86.zip
gcc-cff555dccdb73f52ab49ccf65e7f23263248ee86.tar.gz
gcc-cff555dccdb73f52ab49ccf65e7f23263248ee86.tar.bz2
lib1funcs.asm (divnorm, modnorm): Optimize by using ccr.
* config/h8300/lib1funcs.asm (divnorm, modnorm): Optimize by using ccr. From-SVN: r76573
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/h8300/lib1funcs.asm13
2 files changed, 11 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9372889..b3be4d2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2004-01-25 Kazu Hirata <kazu@cs.umass.edu>
+ * config/h8300/lib1funcs.asm (divnorm, modnorm): Optimize by
+ using ccr.
+
+2004-01-25 Kazu Hirata <kazu@cs.umass.edu>
+
* config/i860/i860-protos.h: Remove the prototype for
i860_saveregs.
* config/i860/i860.c (i860_saveregs): Make it static.
diff --git a/gcc/config/h8300/lib1funcs.asm b/gcc/config/h8300/lib1funcs.asm
index 9365627..985ec36 100644
--- a/gcc/config/h8300/lib1funcs.asm
+++ b/gcc/config/h8300/lib1funcs.asm
@@ -2,7 +2,8 @@
;; Contributed by Steve Chamberlain <sac@cygnus.com>
;; Optimizations by Toshiyasu Morita <toshiyasu.morita@renesas.com>
-/* Copyright (C) 1994, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
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
@@ -174,30 +175,28 @@ ___ucmpsi2:
.section .text
.align 2
divnorm:
- mov.b #0x0,A2L
or A0H,A0H ; is divisor > 0
+ stc ccr,A2L
bge _lab1
not A0H ; no - then make it +ve
not A0L
adds #1,A0
- xor #0x1,A2L ; and remember that in A2L
_lab1: or A1H,A1H ; look at dividend
bge _lab2
not A1H ; it is -ve, make it positive
not A1L
adds #1,A1
- xor #0x1,A2L; and toggle sign of result
+ xor #0x8,A2L; and toggle sign of result
_lab2: rts
;; Basically the same, except that the sign of the divisor determines
;; the sign.
modnorm:
- mov.b #0x0,A2L
or A0H,A0H ; is divisor > 0
+ stc ccr,A2L
bge _lab7
not A0H ; no - then make it +ve
not A0L
adds #1,A0
- xor #0x1,A2L ; and remember that in A2L
_lab7: or A1H,A1H ; look at dividend
bge _lab8
not A1H ; it is -ve, make it positive
@@ -211,7 +210,7 @@ _lab8: rts
___divhi3:
bsr divnorm
bsr ___udivhi3
-negans: or A2L,A2L ; should answer be negative ?
+negans: btst #3,A2L ; should answer be negative ?
beq _lab4
not A0H ; yes, so make it so
not A0L