}
[(set_attr "length" "4")])
-(define_insn_and_split "*shiftqi"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (shifts:QI
- (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "R,rn")))
- (clobber (match_scratch:QI 3 "=X,&r"))]
- ""
- "#"
- "&& reload_completed"
- [(parallel [(set (match_dup 0) (shifts:QI (match_dup 1) (match_dup 2)))
- (clobber (match_dup 3))
- (clobber (reg:CC CC_REG))])])
-
-(define_insn "*shiftqi_clobber_flags"
- [(set (match_operand:QI 0 "register_operand" "=r,r")
- (shifts:QI
- (match_operand:QI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "R,rn")))
- (clobber (match_scratch:QI 3 "=X,&r"))
- (clobber (reg:CC CC_REG))]
- ""
-{
- return output_a_shift (operands, <CODE>);
-}
- [(set (attr "length")
- (symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
-
(define_insn_and_split "*shiftqi_noscratch"
[(set (match_operand:QI 0 "register_operand" "=r,r")
(shifts:QI
[(set (attr "length")
(symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
-(define_insn_and_split "*shifthi"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (shifts:HI
- (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "S,rn")))
+(define_insn "*shiftqi_noscratch_set_flags"
+ [(set (reg:CCZN CC_REG)
+ (compare:CCZN
+ (shifts:QI
+ (match_operand:QI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "R,rn"))
+ (const_int 0)))
+ (set (match_operand:QI 0 "register_operand" "=r,r")
+ (shifts:QI (match_dup 1) (match_dup 2)))]
+ "(GET_CODE (operands[2]) == CONST_INT
+ && !h8300_shift_needs_scratch_p (INTVAL (operands[2]), QImode, <CODE>)
+ && compute_a_shift_cc (operands, <CODE>))"
+{
+ return output_a_shift (operands, <CODE>);
+}
+ [(set (attr "length")
+ (symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
+
+
+(define_insn_and_split "*shiftqi"
+ [(set (match_operand:QI 0 "register_operand" "=r,r")
+ (shifts:QI
+ (match_operand:QI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "R,rn")))
(clobber (match_scratch:QI 3 "=X,&r"))]
""
"#"
"&& reload_completed"
- [(parallel [(set (match_dup 0) (shifts:HI (match_dup 1) (match_dup 2)))
+ [(parallel [(set (match_dup 0) (shifts:QI (match_dup 1) (match_dup 2)))
(clobber (match_dup 3))
(clobber (reg:CC CC_REG))])])
-(define_insn "*shifthi_clobber_flags"
- [(set (match_operand:HI 0 "register_operand" "=r,r")
- (shifts:HI
- (match_operand:HI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "S,rn")))
+(define_insn "*shiftqi_clobber_flags"
+ [(set (match_operand:QI 0 "register_operand" "=r,r")
+ (shifts:QI
+ (match_operand:QI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "R,rn")))
(clobber (match_scratch:QI 3 "=X,&r"))
(clobber (reg:CC CC_REG))]
""
[(set (attr "length")
(symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
-(define_insn_and_split "*shiftsi"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (shifts:SI
- (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "T,rn")))
+(define_insn "*shifthi_noscratch_setzn"
+ [(set (reg:CCZN CC_REG)
+ (compare:CCZN
+ (shifts:HI (match_operand:HI 1 "register_operand" "0,0")
+ (match_operand:HI 2 "nonmemory_operand" "S,rn"))
+ (const_int 0)))
+ (set (match_operand:HI 0 "register_operand" "=r,r")
+ (shifts:HI (match_dup 1) (match_dup 2)))]
+ "(GET_CODE (operands[2]) == CONST_INT
+ && !h8300_shift_needs_scratch_p (INTVAL (operands[2]), HImode, <CODE>)
+ && compute_a_shift_cc (operands, <CODE>))"
+{
+ return output_a_shift (operands, <CODE>);
+}
+ [(set (attr "length")
+ (symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
+
+(define_insn_and_split "*shifthi"
+ [(set (match_operand:HI 0 "register_operand" "=r,r")
+ (shifts:HI
+ (match_operand:HI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "S,rn")))
(clobber (match_scratch:QI 3 "=X,&r"))]
""
"#"
"&& reload_completed"
- [(parallel [(set (match_dup 0) (shifts:SI (match_dup 1) (match_dup 2)))
+ [(parallel [(set (match_dup 0) (shifts:HI (match_dup 1) (match_dup 2)))
(clobber (match_dup 3))
(clobber (reg:CC CC_REG))])])
-(define_insn "*shiftsi_clobber_flags"
- [(set (match_operand:SI 0 "register_operand" "=r,r")
- (shifts:SI
- (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:QI 2 "nonmemory_operand" "T,rn")))
+(define_insn "*shifthi_clobber_flags"
+ [(set (match_operand:HI 0 "register_operand" "=r,r")
+ (shifts:HI
+ (match_operand:HI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "S,rn")))
(clobber (match_scratch:QI 3 "=X,&r"))
(clobber (reg:CC CC_REG))]
""
[(set (attr "length")
(symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
+(define_insn "*shiftsi_noscratch_cczn"
+ [(set (reg:CCZN CC_REG)
+ (compare:CCZN
+ (shifts:SI
+ (match_operand:SI 1 "register_operand" "0,0")
+ (match_operand:SI 2 "nonmemory_operand" "T,rn"))
+ (const_int 0)))
+ (set (match_operand:SI 0 "register_operand" "=r,r")
+ (shifts:SI (match_dup 1) (match_dup 2)))]
+ "(GET_CODE (operands[2]) == CONST_INT
+ && !h8300_shift_needs_scratch_p (INTVAL (operands[2]), SImode, <CODE>)
+ && compute_a_shift_cc (operands, <CODE>))"
+{
+ return output_a_shift (operands, <CODE>);
+}
+ [(set (attr "length")
+ (symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
+
;; Split a variable shift into a loop. If the register containing
;; the shift count dies, then we just use that register.
+
+(define_insn_and_split "*shiftsi"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (shifts:SI
+ (match_operand:SI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "T,rn")))
+ (clobber (match_scratch:QI 3 "=X,&r"))]
+ ""
+ "#"
+ "&& reload_completed"
+ [(parallel [(set (match_dup 0) (shifts:SI (match_dup 1) (match_dup 2)))
+ (clobber (match_dup 3))
+ (clobber (reg:CC CC_REG))])])
+
+(define_insn "*shiftsi_clobber_flags"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (shifts:SI
+ (match_operand:SI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "nonmemory_operand" "T,rn")))
+ (clobber (match_scratch:QI 3 "=X,&r"))
+ (clobber (reg:CC CC_REG))]
+ ""
+{
+ return output_a_shift (operands, <CODE>);
+}
+ [(set (attr "length")
+ (symbol_ref "compute_a_shift_length (operands, <CODE>)"))])
+
(define_split
[(set (match_operand 0 "register_operand" "")
(match_operator 2 "nshift_operator"