https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115836

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #6)
> Proposed patch.
Here is the problem:

The compiler enters emit_store_flag_1 with:

op0=(subreg:SF (reg:SI 424 [ _676 ]) 0)
op1=(reg:SF 1308)

First, the function does:

  if (unsignedp)
    code = unsigned_condition (code);
  scode = swap_condition (code);

and later:

  if (swap_commutative_operands_p (op0, op1))
    {
      std::swap (op0, op1);
      code = swap_condition (code);
    }

The order of the above two parts is wrong. We have SUBREG as op0, so
commutative_operand_precedence swaps operands due to:

      /* SUBREGs of objects should come second.  */

But: both - "code" and "scode" in the first part are not updated for the swap!

The solution is obvious: put the secnod part in front of the first part and
that is what the patch does.

Reply via email to