(3) If an insn of form (2) can usefully set the flags, there is
another pattern of the form
- [(set (reg) (operation)
- (set (reg:CCM) (compare:CCM (operation) (immediate)))]
-
+ [(set (reg:CCM) (compare:CCM (operation) (immediate)))
+ (set (reg) (operation)]
+
The mode CCM will be chosen as if by SELECT_CC_MODE.
Note that unlike NOTICE_UPDATE_CC, we do not handle memory operands.
static bool
try_eliminate_compare (struct comparison *cmp)
{
- rtx x, flags, in_a, in_b, cmp_src;
+ rtx flags, in_a, in_b, cmp_src;
/* We must have found an interesting "clobber" preceding the compare. */
if (cmp->prev_clobber == NULL)
Validate that PREV_CLOBBER itself does in fact refer to IN_A. Do
recall that we've already validated the shape of PREV_CLOBBER. */
rtx_insn *insn = cmp->prev_clobber;
- x = XVECEXP (PATTERN (insn), 0, 0);
+
+ rtx x = XVECEXP (PATTERN (insn), 0, 0);
if (rtx_equal_p (SET_DEST (x), in_a))
cmp_src = SET_SRC (x);
flags = gen_rtx_REG (cmp->orig_mode, targetm.flags_regnum);
/* Generate a new comparison for installation in the setter. */
- x = copy_rtx (cmp_src);
- x = gen_rtx_COMPARE (GET_MODE (flags), x, in_b);
- x = gen_rtx_SET (flags, x);
+ rtx y = copy_rtx (cmp_src);
+ y = gen_rtx_COMPARE (GET_MODE (flags), y, in_b);
+ y = gen_rtx_SET (flags, y);
+
+ /* Canonicalize instruction to:
+ [(set (reg:CCM) (compare:CCM (operation) (immediate)))
+ (set (reg) (operation)] */
+ rtvec v = rtvec_alloc (2);
+ RTVEC_ELT (v, 0) = y;
+ RTVEC_ELT (v, 1) = x;
+
+ rtx pat = gen_rtx_PARALLEL (VOIDmode, v);
+
/* Succeed if the new instruction is valid. Note that we may have started
a change group within maybe_select_cc_mode, therefore we must continue. */
- validate_change (insn, &XVECEXP (PATTERN (insn), 0, 1), x, true);
+ validate_change (insn, &PATTERN (insn), pat, true);
+
if (!apply_change_group ())
return false;