From: green Date: Wed, 9 Sep 2009 22:29:13 +0000 (+0000) Subject: * config/moxie/moxie.md (*movsi, *movhi, *movqi): Use xor to load X-Git-Tag: upstream/4.9.2~33846 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96e0c169a3620cb26f8e004de9ca2e4f529919a1;p=platform%2Fupstream%2Flinaro-gcc.git * config/moxie/moxie.md (*movsi, *movhi, *movqi): Use xor to load the constant 0 when appropriate. * config/moxie/constraints.md: Add constraint O. * config/moxie/moxie.c (moxie_setup_incoming_varargs): Adjust to pass up to 6 32-bit argument values in registers. (moxie_function_arg): Ditto. (moxie_arg_partial_bytes): Ditto. * config/moxie/moxie.h (FUNCTION_ARG_ADVANCE): Ditto. (REG_PARM_STACK_SPACE): Ditto. (FUNCTION_ARG_REGNO_P): Ditto. * config/moxie/moxie.c (moxie_expand_prologue): Use dec instruction to allocate stack space. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151579 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43f4870..f9cea3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2009-09-09 Anthony Green + + * config/moxie/moxie.md (*movsi, *movhi, *movqi): Use xor to load + the constant 0 when appropriate. + * config/moxie/constraints.md: Add constraint O. + + * config/moxie/moxie.c (moxie_setup_incoming_varargs): Adjust + to pass up to 6 32-bit argument values in registers. + (moxie_function_arg): Ditto. + (moxie_arg_partial_bytes): Ditto. + * config/moxie/moxie.h (FUNCTION_ARG_ADVANCE): Ditto. + (REG_PARM_STACK_SPACE): Ditto. + (FUNCTION_ARG_REGNO_P): Ditto. + + * config/moxie/moxie.c (moxie_expand_prologue): Use dec + instruction to allocate stack space. + 2009-09-09 Segher Boessenkool * config/rs6000/rs6000.md (bswapdi2_64bit): Fix diff --git a/gcc/config/moxie/constraints.md b/gcc/config/moxie/constraints.md index 038be5d..f767268 100644 --- a/gcc/config/moxie/constraints.md +++ b/gcc/config/moxie/constraints.md @@ -40,6 +40,11 @@ (match_test "REG_P (XEXP (op, 0)) && REGNO_OK_FOR_BASE_P (REGNO (XEXP (op, 0)))"))) +(define_constraint "O" + "The constant zero" + (and (match_code "const_int") + (match_test "ival == 0"))) + (define_constraint "I" "An 8-bit constant (0..255)" (and (match_code "const_int") @@ -49,4 +54,3 @@ "A constant -(0..255)" (and (match_code "const_int") (match_test "ival >= -255 && ival <= 0"))) - diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c index 39a5c10..8b2d8b2 100644 --- a/gcc/config/moxie/moxie.c +++ b/gcc/config/moxie/moxie.c @@ -273,25 +273,22 @@ moxie_expand_prologue (void) if (cfun->machine->size_for_adjusting_sp > 0) { - if (cfun->machine->size_for_adjusting_sp <= 255) + int i = cfun->machine->size_for_adjusting_sp; + while (i > 255) { insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (cfun->machine->size_for_adjusting_sp))); + GEN_INT (255))); RTX_FRAME_RELATED_P (insn) = 1; + i -= 255; } - else + if (i > 0) { - insn = - emit_insn (gen_movsi - (gen_rtx_REG (Pmode, MOXIE_R5), - GEN_INT (-cfun->machine->size_for_adjusting_sp))); - RTX_FRAME_RELATED_P (insn) = 1; - insn = emit_insn (gen_addsi3 (stack_pointer_rtx, + insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, - gen_rtx_REG (Pmode, MOXIE_R5))); + GEN_INT (i))); RTX_FRAME_RELATED_P (insn) = 1; - } + } } } @@ -359,14 +356,14 @@ moxie_setup_incoming_varargs (CUMULATIVE_ARGS *cum, int *pretend_size, int no_rtl) { int regno; - int regs = 7 - *cum; + int regs = 8 - *cum; *pretend_size = regs < 0 ? 0 : GET_MODE_SIZE (SImode) * regs; if (no_rtl) return; - for (regno = *cum; regno < 7; regno++) + for (regno = *cum; regno < 8; regno++) { rtx reg = gen_rtx_REG (SImode, regno); rtx slot = gen_rtx_PLUS (Pmode, @@ -395,7 +392,7 @@ rtx moxie_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED) { - if (cum < 7) + if (cum < 8) return gen_rtx_REG (mode, cum); else return NULL_RTX; @@ -420,7 +417,7 @@ moxie_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, else size = GET_MODE_SIZE (mode); - return size > 4*5; + return size > 4*6; } /* Some function arguments will only partially fit in the registers @@ -434,7 +431,7 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum, { int bytes_left, size; - if (*cum >= 7) + if (*cum >= 8) return 0; if (moxie_pass_by_reference (cum, mode, type, named)) @@ -448,7 +445,7 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum, else size = GET_MODE_SIZE (mode); - bytes_left = (4 * 5) - ((*cum - 2) * 4); + bytes_left = (4 * 6) - ((*cum - 2) * 4); if (size > bytes_left) return bytes_left; diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h index f50a6b2..21792da 100644 --- a/gcc/config/moxie/moxie.h +++ b/gcc/config/moxie/moxie.h @@ -182,7 +182,7 @@ enum reg_class /* A C expression whose value is a register class containing hard register REGNO. */ -#define REGNO_REG_CLASS(R) ((R < MOXIE_PC) ? GENERAL_REGS : \ +#define REGNO_REG_CLASS(R) ((R < MOXIE_PC) ? GENERAL_REGS : \ (R == MOXIE_CC ? CC_REGS : SPECIAL_REGS)) /* A C expression for the number of consecutive hard registers, @@ -263,7 +263,7 @@ enum reg_class : (unsigned) int_size_in_bytes (TYPE)) #define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \ - (CUM = (CUM < MOXIE_R5 ? \ + (CUM = (CUM < MOXIE_R6 ? \ CUM + ((3 + MOXIE_FUNCTION_ARG_SIZE(MODE,TYPE))/4) : CUM )) /* How Scalar Function Values Are Returned */ @@ -299,7 +299,7 @@ enum reg_class /* Define this if it is the responsibility of the caller to allocate the area reserved for arguments passed in registers. */ -#define REG_PARM_STACK_SPACE(FNDECL) (5 * UNITS_PER_WORD) +#define REG_PARM_STACK_SPACE(FNDECL) (6 * UNITS_PER_WORD) /* Offset from the argument pointer register to the first argument's address. On some machines it may depend on the data type of the @@ -463,7 +463,7 @@ do \ /* A C expression that is nonzero if REGNO is the number of a hard register in which function arguments are sometimes passed. */ -#define FUNCTION_ARG_REGNO_P(r) (r >= MOXIE_R0 && r <= MOXIE_R4) +#define FUNCTION_ARG_REGNO_P(r) (r >= MOXIE_R0 && r <= MOXIE_R5) /* A C expression that is nonzero if REGNO is the number of a hard register in which the values of called function may come back. */ diff --git a/gcc/config/moxie/moxie.md b/gcc/config/moxie/moxie.md index 02072f4..a8e6887 100644 --- a/gcc/config/moxie/moxie.md +++ b/gcc/config/moxie/moxie.md @@ -223,11 +223,12 @@ }") (define_insn "*movsi" - [(set (match_operand:SI 0 "general_operand" "=r,r,W,A,r,r,B,r") - (match_operand:SI 1 "moxie_general_movsrc_operand" "r,i,r,r,W,A,r,B"))] + [(set (match_operand:SI 0 "general_operand" "=r,r,r,W,A,r,r,B,r") + (match_operand:SI 1 "moxie_general_movsrc_operand" "O,r,i,r,r,W,A,r,B"))] "register_operand (operands[0], SImode) || register_operand (operands[1], SImode)" "@ + xor %0, %0 mov %0, %1 ldi.l %0, %1 st.l %0, %1 @@ -236,7 +237,7 @@ lda.l %0, %1 sto.l %0, %1 ldo.l %0, %1" - [(set_attr "length" "2,6,2,6,2,6,6,6")]) + [(set_attr "length" "2,2,6,2,6,2,6,6,6")]) (define_expand "movqi" [(set (match_operand:QI 0 "general_operand" "") @@ -250,11 +251,12 @@ }") (define_insn "*movqi" - [(set (match_operand:QI 0 "general_operand" "=r,r,W,A,r,r,B,r") - (match_operand:QI 1 "moxie_general_movsrc_operand" "r,i,r,r,W,A,r,B"))] + [(set (match_operand:QI 0 "general_operand" "=r,r,r,W,A,r,r,B,r") + (match_operand:QI 1 "moxie_general_movsrc_operand" "O,r,i,r,r,W,A,r,B"))] "register_operand (operands[0], QImode) || register_operand (operands[1], QImode)" "@ + xor %0, %0 mov %0, %1 ldi.b %0, %1 st.b %0, %1 @@ -263,7 +265,7 @@ lda.b %0, %1 sto.b %0, %1 ldo.b %0, %1" - [(set_attr "length" "2,6,2,6,2,6,6,6")]) + [(set_attr "length" "2,2,6,2,6,2,6,6,6")]) (define_expand "movhi" [(set (match_operand:HI 0 "general_operand" "") @@ -277,11 +279,12 @@ }") (define_insn "*movhi" - [(set (match_operand:HI 0 "general_operand" "=r,r,W,A,r,r,B,r") - (match_operand:HI 1 "moxie_general_movsrc_operand" "r,i,r,r,W,A,r,B"))] + [(set (match_operand:HI 0 "general_operand" "=r,r,r,W,A,r,r,B,r") + (match_operand:HI 1 "moxie_general_movsrc_operand" "O,r,i,r,r,W,A,r,B"))] "(register_operand (operands[0], HImode) || register_operand (operands[1], HImode))" "@ + xor %0, %0 mov %0, %1 ldi.s %0, %1 st.s %0, %1 @@ -290,7 +293,7 @@ lda.s %0, %1 sto.s %0, %1 ldo.s %0, %1" - [(set_attr "length" "2,6,2,6,2,6,6,6")]) + [(set_attr "length" "2,2,6,2,6,2,6,6,6")]) ;; ------------------------------------------------------------------------- ;; Compare instructions