(set_attr "mode" "QI")])
;; Combine likes to form bit extractions for some tests. Humor it.
-(define_insn "*testqi_ext_3"
- [(set (reg FLAGS_REG)
- (compare (zero_extract:SWI248
- (match_operand 0 "nonimmediate_operand" "rm")
- (match_operand 1 "const_int_operand" "n")
- (match_operand 2 "const_int_operand" "n"))
- (const_int 0)))]
- "ix86_match_ccmode (insn, CCNOmode)
- && ((TARGET_64BIT && GET_MODE (operands[0]) == DImode)
- || GET_MODE (operands[0]) == SImode
- || GET_MODE (operands[0]) == HImode
- || GET_MODE (operands[0]) == QImode)
- /* Ensure that resulting mask is zero or sign extended operand. */
- && INTVAL (operands[2]) >= 0
- && ((INTVAL (operands[1]) > 0
- && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32)
- || (<MODE>mode == DImode
- && INTVAL (operands[1]) > 32
- && INTVAL (operands[1]) + INTVAL (operands[2]) == 64))"
- "#")
-
-(define_split
+(define_insn_and_split "*testqi_ext_3"
[(set (match_operand 0 "flags_reg_operand")
(match_operator 1 "compare_operator"
- [(zero_extract
- (match_operand 2 "nonimmediate_operand")
- (match_operand 3 "const_int_operand")
- (match_operand 4 "const_int_operand"))
+ [(zero_extract:SWI248
+ (match_operand 2 "nonimmediate_operand" "rm")
+ (match_operand 3 "const_int_operand" "n")
+ (match_operand 4 "const_int_operand" "n"))
(const_int 0)]))]
- "ix86_match_ccmode (insn, CCNOmode)"
+ "ix86_match_ccmode (insn, CCNOmode)
+ && ((TARGET_64BIT && GET_MODE (operands[2]) == DImode)
+ || GET_MODE (operands[2]) == SImode
+ || GET_MODE (operands[2]) == HImode
+ || GET_MODE (operands[2]) == QImode)
+ /* Ensure that resulting mask is zero or sign extended operand. */
+ && INTVAL (operands[4]) >= 0
+ && ((INTVAL (operands[3]) > 0
+ && INTVAL (operands[3]) + INTVAL (operands[4]) <= 32)
+ || (<MODE>mode == DImode
+ && INTVAL (operands[3]) > 32
+ && INTVAL (operands[3]) + INTVAL (operands[4]) == 64))"
+ "#"
+ "&& 1"
[(set (match_dup 0) (match_op_dup 1 [(match_dup 2) (const_int 0)]))]
{
rtx val = operands[2];
HOST_WIDE_INT len = INTVAL (operands[3]);
HOST_WIDE_INT pos = INTVAL (operands[4]);
- HOST_WIDE_INT mask;
machine_mode mode, submode;
mode = GET_MODE (val);
val = gen_lowpart (QImode, val);
}
- if (len == HOST_BITS_PER_WIDE_INT)
- mask = -1;
- else
- mask = (HOST_WIDE_INT_1 << len) - 1;
- mask <<= pos;
+ wide_int mask
+ = wi::shifted_mask (pos, len, false, GET_MODE_PRECISION (mode));
- operands[2] = gen_rtx_AND (mode, val, gen_int_mode (mask, mode));
+ operands[2] = gen_rtx_AND (mode, val, immed_wide_int_const (mask, mode));
})
;; Convert HImode/SImode test instructions with immediate to QImode ones.