From cff555dccdb73f52ab49ccf65e7f23263248ee86 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 25 Jan 2004 17:51:51 +0000 Subject: [PATCH] lib1funcs.asm (divnorm, modnorm): Optimize by using ccr. * config/h8300/lib1funcs.asm (divnorm, modnorm): Optimize by using ccr. From-SVN: r76573 --- gcc/ChangeLog | 5 +++++ gcc/config/h8300/lib1funcs.asm | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 937288934a2..b3be4d2bc50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-01-25 Kazu Hirata + + * config/h8300/lib1funcs.asm (divnorm, modnorm): Optimize by + using ccr. + 2004-01-25 Kazu Hirata * config/i860/i860-protos.h: Remove the prototype for diff --git a/gcc/config/h8300/lib1funcs.asm b/gcc/config/h8300/lib1funcs.asm index 93656275efe..985ec36e317 100644 --- a/gcc/config/h8300/lib1funcs.asm +++ b/gcc/config/h8300/lib1funcs.asm @@ -2,7 +2,8 @@ ;; Contributed by Steve Chamberlain ;; Optimizations by Toshiyasu Morita -/* 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