&& INTVAL (operands[3]) > 32
&& INTVAL (operands[3]) + INTVAL (operands[4]) == 64))
&& ix86_match_ccmode (insn,
- /* *testdi_1 requires CCZmode if the mask has bit
+ /* If zero_extract mode precision is the same
+ as len, the SF of the zero_extract
+ comparison will be the most significant
+ extracted bit, but this could be matched
+ after splitting only for pos 0 len all bits
+ trivial extractions. Require CCZmode. */
+ (GET_MODE_PRECISION (<MODE>mode)
+ == INTVAL (operands[3]))
+ /* Otherwise, require CCZmode if we'd use a mask
+ with the most significant bit set and can't
+ widen it to wider mode. *testdi_1 also
+ requires CCZmode if the mask has bit
31 set and all bits above it clear. */
- GET_MODE (operands[2]) == DImode
- && INTVAL (operands[3]) + INTVAL (operands[4]) == 32
+ || (INTVAL (operands[3]) + INTVAL (operands[4])
+ >= 32)
+ /* We can't widen also if val is not a REG. */
+ || (INTVAL (operands[3]) + INTVAL (operands[4])
+ == GET_MODE_PRECISION (GET_MODE (operands[2]))
+ && !register_operand (operands[2],
+ GET_MODE (operands[2])))
+ /* And we shouldn't widen if
+ TARGET_PARTIAL_REG_STALL. */
+ || (TARGET_PARTIAL_REG_STALL
+ && (INTVAL (operands[3]) + INTVAL (operands[4])
+ >= (paradoxical_subreg_p (operands[2])
+ && (GET_MODE_CLASS
+ (GET_MODE (SUBREG_REG (operands[2])))
+ == MODE_INT)
+ ? GET_MODE_PRECISION
+ (GET_MODE (SUBREG_REG (operands[2])))
+ : GET_MODE_PRECISION
+ (GET_MODE (operands[2])))))
? CCZmode : CCNOmode)"
"#"
"&& 1"
/* Narrow paradoxical subregs to prevent partial register stalls. */
if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode)
- && GET_MODE_CLASS (submode) == MODE_INT)
+ && GET_MODE_CLASS (submode) == MODE_INT
+ && (GET_MODE (operands[0]) == CCZmode
+ || pos + len < GET_MODE_PRECISION (submode)
+ || REG_P (SUBREG_REG (val))))
{
val = SUBREG_REG (val);
mode = submode;
}
/* Small HImode tests can be converted to QImode. */
- if (register_operand (val, HImode) && pos + len <= 8)
+ if (pos + len <= 8
+ && register_operand (val, HImode))
{
- val = gen_lowpart (QImode, val);
- mode = QImode;
+ rtx nval = gen_lowpart (QImode, val);
+ if (!MEM_P (nval)
+ || GET_MODE (operands[0]) == CCZmode
+ || pos + len < 8)
+ {
+ val = nval;
+ mode = QImode;
+ }
}
gcc_assert (pos + len <= GET_MODE_PRECISION (mode));
+ /* If the mask is going to have the sign bit set in the mode
+ we want to do the comparison in and user isn't interested just
+ in the zero flag, then we must widen the target mode. */
+ if (pos + len == GET_MODE_PRECISION (mode)
+ && GET_MODE (operands[0]) != CCZmode)
+ {
+ gcc_assert (pos + len < 32 && !MEM_P (val));
+ mode = SImode;
+ val = gen_lowpart (mode, val);
+ }
+
wide_int mask
= wi::shifted_mask (pos, len, false, GET_MODE_PRECISION (mode));