Commit e40024ff by Kazu Hirata Committed by Kazu Hirata

lib1funcs.asm (divnorm): Store the sign in bit 3 of S2L.

	* config/h8300/lib1funcs.asm (divnorm): Store the sign in bit
	3 of S2L.
	(modnorm): Likewise.
	(exitdiv): Look at bit 3 of S2L only.

From-SVN: r73635
parent 4cd0866d
2003-11-15 Kazu Hirata <kazu@cs.umass.edu> 2003-11-15 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/lib1funcs.asm (divnorm): Store the sign in bit
3 of S2L.
(modnorm): Likewise.
(exitdiv): Look at bit 3 of S2L only.
2003-11-15 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.h (DO_GLOBAL_CTORS_BODY): Fix warnings. * config/h8300/h8300.h (DO_GLOBAL_CTORS_BODY): Fix warnings.
(DO_GLOBAL_DTORS_BODY): Likewise. (DO_GLOBAL_DTORS_BODY): Likewise.
......
...@@ -323,8 +323,8 @@ setbit: inc A0L ; do insert bit ...@@ -323,8 +323,8 @@ setbit: inc A0L ; do insert bit
#ifdef __H8300__ #ifdef __H8300__
divnorm: divnorm:
mov.b #0,S2L ; keep the sign in S2
mov.b A0H,A0H ; is the numerator -ve mov.b A0H,A0H ; is the numerator -ve
stc ccr,S2L ; keep the sign in bit 3 of S2L
bge postive bge postive
; negate arg ; negate arg
...@@ -337,8 +337,6 @@ divnorm: ...@@ -337,8 +337,6 @@ divnorm:
addx #0,A1H addx #0,A1H
addx #0,A0L addx #0,A0L
addx #0,A0H addx #0,A0H
mov.b #1,S2L ; the sign will be -ve
postive: postive:
mov.b A2H,A2H ; is the denominator -ve mov.b A2H,A2H ; is the denominator -ve
bge postive2 bge postive2
...@@ -350,15 +348,15 @@ postive: ...@@ -350,15 +348,15 @@ postive:
addx #0,A3H addx #0,A3H
addx #0,A2L addx #0,A2L
addx #0,A2H addx #0,A2H
xor #1,S2L ; toggle result sign xor.b #0x08,S2L ; toggle the result sign
postive2: postive2:
rts rts
;; Basically the same, except that the sign of the divisor determines ;; Basically the same, except that the sign of the divisor determines
;; the sign. ;; the sign.
modnorm: modnorm:
mov.b #0,S2L ; keep the sign in S2
mov.b A0H,A0H ; is the numerator -ve mov.b A0H,A0H ; is the numerator -ve
stc ccr,S2L ; keep the sign in bit 3 of S2L
bge mpostive bge mpostive
; negate arg ; negate arg
...@@ -371,8 +369,6 @@ modnorm: ...@@ -371,8 +369,6 @@ modnorm:
addx #0,A1H addx #0,A1H
addx #0,A0L addx #0,A0L
addx #0,A0H addx #0,A0H
mov.b #1,S2L ; the sign will be -ve
mpostive: mpostive:
mov.b A2H,A2H ; is the denominator -ve mov.b A2H,A2H ; is the denominator -ve
bge mpostive2 bge mpostive2
...@@ -390,19 +386,18 @@ mpostive2: ...@@ -390,19 +386,18 @@ mpostive2:
#else /* __H8300H__ */ #else /* __H8300H__ */
divnorm: divnorm:
mov.b #0,S2L ; keep the sign in S2
mov.l A0P,A0P ; is the numerator -ve mov.l A0P,A0P ; is the numerator -ve
stc ccr,S2L ; keep the sign in bit 3 of S2L
bge postive bge postive
neg.l A0P ; negate arg neg.l A0P ; negate arg
mov.b #1,S2L ; the sign will be -ve
postive: postive:
mov.l A1P,A1P ; is the denominator -ve mov.l A1P,A1P ; is the denominator -ve
bge postive2 bge postive2
neg.l A1P ; negate arg neg.l A1P ; negate arg
xor.b #1,S2L ; toggle result sign xor.b #0x08,S2L ; toggle the result sign
postive2: postive2:
rts rts
...@@ -410,12 +405,11 @@ postive2: ...@@ -410,12 +405,11 @@ postive2:
;; Basically the same, except that the sign of the divisor determines ;; Basically the same, except that the sign of the divisor determines
;; the sign. ;; the sign.
modnorm: modnorm:
mov.b #0,S2L ; keep the sign in S2
mov.l A0P,A0P ; is the numerator -ve mov.l A0P,A0P ; is the numerator -ve
stc ccr,S2L ; keep the sign in bit 3 of S2L
bge mpostive bge mpostive
neg.l A0P ; negate arg neg.l A0P ; negate arg
mov.b #1,S2L ; the sign will be -ve
mpostive: mpostive:
mov.l A1P,A1P ; is the denominator -ve mov.l A1P,A1P ; is the denominator -ve
...@@ -493,7 +487,7 @@ ___divsi3: ...@@ -493,7 +487,7 @@ ___divsi3:
; examine what the sign should be ; examine what the sign should be
exitdiv: exitdiv:
or S2L,S2L btst #3,S2L
beq reti beq reti
; should be -ve ; should be -ve
......
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