[PATCH] m32r-elf fix target/10988
Kazuhiro Inaoka
inaoka.kazuhiro@renesas.com
Tue May 27 07:30:00 GMT 2003
This is a patch for PR target/10988.
2003-05-26 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
Fix for: PR target/10988
*** m32r-protos.h.orig Mon May 19 19:28:35 2003
--- m32r-protos.h Thu May 22 14:42:20 2003
*************** extern int large_insn_p PARAMS ((rt
*** 84,89 ****
--- 84,90 ----
extern int conditional_move_operand PARAMS ((rtx, Mmode));
extern int carry_compare_operand PARAMS ((rtx, Mmode));
extern int m32r_block_immediate_operand PARAMS ((rtx, Mmode));
+ extern int m32r_block_small_immediate_operand PARAMS ((rtx, Mmode));
extern int extend_operand PARAMS ((rtx, Mmode));
extern int reg_or_eq_int16_operand PARAMS ((rtx, Mmode));
extern int int8_operand PARAMS ((rtx, Mmode));
*** m32r.c.orig Mon May 19 19:28:35 2003
--- m32r.c Thu May 22 14:42:20 2003
*************** m32r_print_operand (file, x, code)
*** 2248,2254 ****
switch (code)
{
/* The 's' and 'p' codes are used by output_block_move() to
! indicate post-increment 's'tores and 'p're-increment loads. */
case 's':
if (GET_CODE (x) == REG)
fprintf (file, "@+%s", reg_names [REGNO (x)]);
--- 2248,2254 ----
switch (code)
{
/* The 's' and 'p' codes are used by output_block_move() to
! indicate pre-increment 's'tores and 'p'ost-increment loads. */
case 's':
if (GET_CODE (x) == REG)
fprintf (file, "@+%s", reg_names [REGNO (x)]);
*************** m32r_expand_block_move (operands)
*** 2833,2839 ****
}
if (leftover)
! emit_insn (gen_movstrsi_internal (dst_reg, src_reg, GEN_INT
(leftover)));
}
--- 2833,2850 ----
}
if (leftover)
! {
! HOST_WIDE_INT bytes = leftover;
! leftover = bytes % 4;
! bytes -= leftover;
! if (bytes)
! {
! emit_insn (gen_movstrsi_internal (dst_reg, src_reg, GEN_INT
(bytes)));
! emit_insn (gen_addsi3 (dst_reg, dst_reg, GEN_INT (4)));
! }
! if (leftover)
! emit_insn (gen_movstrsi_small_internal (dst_reg, src_reg,
GEN_INT (leftover)));
! }
}
*************** m32r_block_immediate_operand (op, mode)
*** 2970,2975 ****
--- 2981,2999 ----
{
if (GET_CODE (op) != CONST_INT
|| INTVAL (op) > MAX_MOVE_BYTES
+ || INTVAL (op) < 4)
+ return 0;
+
+ return 1;
+ }
+
+ int
+ m32r_block_small_immediate_operand (op, mode)
+ rtx op;
+ enum machine_mode mode ATTRIBUTE_UNUSED;
+ {
+ if (GET_CODE (op) != CONST_INT
+ || INTVAL (op) > 4
|| INTVAL (op) <= 0)
return 0;
*** m32r.h.orig Mon May 19 19:28:35 2003
--- m32r.h Thu May 22 14:42:20 2003
*************** enum m32r_function_type
*** 1973,1978 ****
--- 1973,1979 ----
{ "extend_operand", { REG, SUBREG, MEM }}, \
{ "small_insn_p", { INSN, CALL_INSN, JUMP_INSN }}, \
{ "m32r_block_immediate_operand",{ CONST_INT }}, \
+ { "m32r_block_small_immediate_operand",{ CONST_INT }}, \
{ "large_insn_p", { INSN, CALL_INSN, JUMP_INSN }}, \
{ "seth_add3_operand", { SYMBOL_REF, LABEL_REF, CONST }},
*** m32r.md.orig Thu May 15 16:56:23 2003
--- m32r.md Thu May 22 14:42:20 2003
***************
*** 1238,1243 ****
--- 1238,1254 ----
[(set_attr "type" "int2,int4")
(set_attr "length" "2,4")])
+ (define_insn "movstrsi_small_internal"
+ [(set (mem:BLK (match_operand:SI 0 "register_operand" "r")) ;;
destination
+ (mem:BLK (match_operand:SI 1 "register_operand" "r"))) ;; source
+ (use (match_operand:SI 2 "m32r_block_small_immediate_operand" "J"));; #
bytes to move
+ (clobber (match_scratch:SI 3 "=&r")) ;; temp 1
+ (clobber (match_scratch:SI 4 "=&r"))] ;; temp 2
+ ""
+ "* m32r_output_block_move (insn, operands); return \"\"; "
+ [(set_attr "type" "store8")
+ (set_attr "length" "20")]) ;; Maximum
+
;; reg == small constant comparisons are best handled by putting the
result
;; of the comparison in a tmp reg and then using beqz/bnez.
More information about the Gcc-patches
mailing list