This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Temporary Expression Replacement in SSA->normal.
- From: <tm_gccmail at kloo dot net>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Zack Weinberg <zack at codesourcery dot com>,gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Dec 2003 15:36:53 -0800 (PST)
- Subject: Re: [tree-ssa] Temporary Expression Replacement in SSA->normal.
On Fri, 28 Nov 2003, Roger Sayle wrote:
>
> where currently GCC mainline generates a multiplication instruction or a
> call to libgcc. Passing "x*3" to expand_expr generates significantly
> better code. Another example, is that "fold" canonicalizes many
> expressions assuming that the results will be visible during RTL
> expansion. Yet more examples, include Sethi-Ullman numbering where the
> evaluation order of operands can be choosen by expand_expr so as to
> minimize the number of live pseudos. No pass other than scheduling
> reorders instructions, and even that doesn't currently consider
> register pressure. And all of tree-ssa's problems with the built-in
> string functions just go away, if expand_builtin gets to see the
> constant arguments at RTL expansion time.
I can think of at least another pass that reorders instructions:
delayed branch filling.
> And yet another example is "(bool) x & c" where c is a power of two.
> If we're generating code for an assignment this is best expanded as
> "(x >> c2) & 1" which saves conditional branches or setcc instructions.
I don't think you should make general assumptions about target-dependent
optimizations such as this.
On the SH architecture, for processors <SH3 we only have rights shifts
of 1, 2, 8 and 16 bits. So therefore right shifting usually involves
a library call, which is very awkward and usually slow.
Toshi