This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/32698] [4.3 regression] inefficient pointer expression
- From: "zippel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2007 15:27:57 -0000
- Subject: [Bug tree-optimization/32698] [4.3 regression] inefficient pointer expression
- References: <bug-32698-14001@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from zippel at gcc dot gnu dot org 2007-07-09 15:27 -------
(In reply to comment #5)
> as you suggest creates worse assembly (look at the extra shift)
>
> foo:
> pushl %ebp
> movl %esp, %ebp
> movl 12(%ebp), %ecx
> movl 8(%ebp), %edx
> popl %ebp
> sall $2, %ecx
> movl 8(%ecx,%edx), %eax
> addl 4(%ecx,%edx), %eax
> addl 12(%ecx,%edx), %eax
> ret
The cost of this is dependent on the target, so IMO the shift could be
propagated back into the address at RTL level.
> so there is no form that is clearly better to canonicalize to.
Your example is rather artificial and depends on that (i + x) * y is completely
eliminated. My main point is still that such expression are far more difficult
to translate into proper address operations.
To generate addresses targeting a form of (i * x) + y is clearly better.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32698