[Bug tree-optimization/32698] [4.3 regression] inefficient pointer expression
zippel at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jul 9 15:28:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list