This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] AVR __mulhi3 fix
- To: gcc-patches at gcc dot gnu dot org, avr-gcc-list at avr dot jpk dot co dot nz
- Subject: [patch] AVR __mulhi3 fix
- From: Marek Michalkiewicz <marekm at amelek dot gda dot pl>
- Date: Wed, 28 Mar 2001 19:15:12 +0200 (CEST)
- CC: denisc at overta dot ru, lee at blegroup dot demon dot co dot uk, marekm at linux dot org dot pl
I've just applied this, for now to the 3.1 tree - fixes an old but
serious bug (513 * 1 = 1) so I'm afraid it should go into 3.0 as well...
2001-03-28 Marek Michalkiewicz <marekm@linux.org.pl>
* config/avr/libgcc.S (__mulhi3): Correct tests to exit the loop
when multiplier or multiplicand is zero.
Index: config/avr/libgcc.S
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/avr/libgcc.S,v
retrieving revision 1.11
diff -c -3 -p -r1.11 libgcc.S
*** libgcc.S 2001/01/21 07:08:46 1.11
--- libgcc.S 2001/03/28 17:00:46
*************** __mulhi3_skip1:
*** 137,147 ****
add r_arg2L,r_arg2L ; shift multiplicand
adc r_arg2H,r_arg2H
! cpc r_arg2L,__zero_reg__
breq __mulhi3_exit ; while multiplicand != 0
lsr r_arg1H ; gets LSB of multiplier
ror r_arg1L
cpc r_arg1H,__zero_reg__
brne __mulhi3_loop ; exit if multiplier = 0
__mulhi3_exit:
--- 137,149 ----
add r_arg2L,r_arg2L ; shift multiplicand
adc r_arg2H,r_arg2H
! cp r_arg2L,__zero_reg__
! cpc r_arg2H,__zero_reg__
breq __mulhi3_exit ; while multiplicand != 0
lsr r_arg1H ; gets LSB of multiplier
ror r_arg1L
+ cp r_arg1L,__zero_reg__
cpc r_arg1H,__zero_reg__
brne __mulhi3_loop ; exit if multiplier = 0
__mulhi3_exit: