This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Add TARGET_EXPAND_COMPOUND_OPERATION
On Mon, Jun 28, 2010 at 3:05 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> However, combiner never exposes this to x86 backend. ?I added
>> a TARGET_EXPAND_COMPOUND_OPERATION hook to allow x86 backend to
>> optimize it. ?For
>>
>> ---
>> typedef struct
>> {
>> ? unsigned char c1;
>> ? unsigned char c2;
>> ? unsigned char c3;
>> ? unsigned char c4;
>> } foo_t;
>>
>> int
>> foo (foo_t x)
>> {
>> ? ?return x.c2 > 4;
>> }
>
> I think that disabling the canonicalization done by expand_compound_operation
> can disable certain forms of combining that are beneficial to x86 even for
> this kind of patterns.
>
> The combiner already knows that it needs to re-create the compound forms when
> it is trying to simplify a comparison, see simplify_comparison. ?The problem
> with your testcase is that make_compound_operation fails to do so.
>
> Lightly tested patch attached.
>
>
> ? ? ? ?* combine.c (make_compound_operation) <SUBREG>: Do not return the
> ? ? ? ?result of force_to_mode if it partially re-expanded the compound.
>
It works on my testcases. I will do a full bootstrap and test on
Linux/x86-64.
Thanks.
--
H.J.