This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: code quality pesimization with function returning changes
> Stuff like
>
> if (p)
> return a + b;
> else
> return c + d;
>
> can get translated as
>
> (set pc (if_then_else p pc (label 1)))
>
> (set (reg:SI tmp) (plus:SI a b))
>
> (set (reg:DI r0) (sign_extend:DI (reg:SI tmp)))
>
> (set pc (label 2))
>
> (code_label 1)
>
> (set (reg:SI tmp2) (plus:SI c d))
>
> (set (reg:DI r0) (sign_extend:DI (reg:SI tmp2)))
>
> (code_label 2)
>
> Before we had cant_combine_p, we'd happily collapse the PLUS and the
> SIGN_EXTEND into a single instruction. Now, we see R0 and prevent the
> combination. Which in turn prevents noce_try_cmove_arith from building
Hmm, alternativly, can't we simply change expand_expr to ignore target
in case it is hard register?
That way we will still use hard register as return value, but
the sign_extend will be emitted as sign_extend to register followed by
move.
I am not sure what alternative will result in better code...
Honza
>
> (set (reg:DI tmp) (sign_extend:DI (plus:SI a b)))
>
> (set (reg:DI r0) (sign_extend:DI (plus:SI c d)))
>
> (set (reg:DI r0) (if_then_else:DI p tmp r0))
>
> With the return value in a pseudo, we don't have this problem.
>
>
> r~