This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] i386.c: Fix for PR 10795.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 11 Jul 2003 12:37:00 -0400 (EDT)
- Subject: Re: [patch] i386.c: Fix for PR 10795.
- References: <20030708.230838.63119349.kazu@cs.umass.edu>
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