This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/20283] optimising muldiv() type operations
- From: "ajrobb at bigfoot dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Mar 2005 16:53:05 -0000
- Subject: [Bug middle-end/20283] optimising muldiv() type operations
- References: <20050302142542.20283.ajrobb@bigfoot.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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