This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Rename/export combine_insn_cost as insn_rtx_cost
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 17 Jul 2004 00:04:52 -0700
- Subject: Re: [PATCH] Rename/export combine_insn_cost as insn_rtx_cost
- References: <Pine.LNX.4.44.0407162220030.17577-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> writes:
> On Fri, 16 Jul 2004, Zack Weinberg wrote:
>> Unfortunately, p6 *is* call-clobbered on ia64.
>
> I've just thought of an even cleverer work-around.
>
> Instead we transform
>
> if (cond)
> {
> call foo();
> r1 = r35;
> }
>
> into the equivalent.
>
> if (cond)
> call foo ();
> else
> r35 = r1;
> r1 = r35;
>
> which we'd expand as
>
> (!cond).r35 = r1
> (cond).call foo()
> r1 = r35
>
> i.e. we attempt to compensate for any instructions after a conditional
> instruction that clobbers the condition codes, by inserting additional
> code in the else clause (using the negated/inverted conditional earlier).
Cute.
In this example, there's not even need to use the else - r35 is the
register where r1 was saved on function entry, and an extra copy from
r35 to r1 is harmless. So we could emit something like
cmp4.ne.unc p6,p7 = r0,r32
(p6) br.call.dpnt.many b0 = foo#
;;
mov r1 = r35
with complete safety. Your trick, however, might be better for cases
where there's more code after the call.
zw