------- Additional Comments From ajrobb at bigfoot dot com 2005-03-02 16:53 ------- Subject: Re: optimising muldiv() type operations
Hi, Thanks for getting back. Your code below still performs a separate multiply by 47 before 'dividing' by 40. My enhancement request is to combine these two operations making the 2nd-4th (and 8th) lines below redundant. Well done though for spotting it should have been unsigned (signed division is horrible as it is not defined/portable). pinskia at gcc dot gnu dot org wrote: >------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-02 >16:35 ------- >With unsigned instead of signed, I get the following code with the mainline: > movl 4(%esp), %eax > leal (%eax,%eax,2), %edx > sall $4, %edx > subl %eax, %edx > movl $-858993459, %eax > mull %edx > shrl $5, %edx > movl %edx, %eax > ret > >Is this okay, If so then there is no bug here really. > > > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20283