This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] i386.c: Fix for PR 10795.


Hi,

> Attached is a patch to have ix86_expand_int_compare check the
> predicate of op0 and force_reg it if necessary.
> 
> During the first if conversion, ix86_expand_int_movcc() tries to use a
> carry flag by calling ix86_expand_carry_flag_compare().  Since
> ix86_expand_carry_flag_compare() prefers LTU to GTU, it swaps
> operands.  The danger is that it swaps operands even when operands do
> not meet operand predicates.  Consider

Sorry, this patch had a completely wrong description, which went with
another patch that I was working on and then scrapped.

Since ix86_expand_carry_flag_compare() prefers LTU to GTU, it swaps
the comparison operands when it sees GTU.  The danger is that it swaps
the operands even when the operands do not satisfy the operand
predicates.  Note that operands[0] and operands[1] have different
predicates, nonimmediate_operand and general_operand, respectively.

The patch fixes the problem by simply telling
ix86_expand_carry_flag_compare() to return false if swapping operands
would violate predicates.

Kazu Hirata


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]