diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bffa9f4995..a568a022bdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2006-03-16 Jan-Benedict Glaw + + * rtl.h (CONST_INT_P): Define. + * config/vax/vax.c (print_operand_address): Use CONST_INT_P() + instead of GET_CODE(x) == CONST_INT. + (vax_rtx_costs): Likewise. + (vax_output_int_move): Likewise. + (vax_output_int_add): Likewise. + (legitimate_constant_address_p): Likewise. + (index_term_p): Likewise. + * config/vax/vax.h (PRINT_OPERAND): Likewise. + * config/vax/vax.md (and3): Likewise. + (ashrsi3): Likewise. + (extv): Likewise. + (movstricthi): Likewise. + (movstrictqi): Likewise. + (rotrsi3): Likewise. + (five unnamed insns): Likewise. + 2006-03-16 Geoffrey Keating * doc/tm.texi (SDB and DWARF): Add extra parameter to diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index cff421f7496..f005a2a4c0d 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -288,11 +288,11 @@ print_operand_address (FILE * file, rtx addr) { if (offset) { - if (GET_CODE (offset) == CONST_INT) + if (CONST_INT_P (offset)) offset = plus_constant (XEXP (addr, 0), INTVAL (offset)); else { - gcc_assert (GET_CODE (XEXP (addr, 0)) == CONST_INT); + gcc_assert (CONST_INT_P (XEXP (addr, 0))); offset = plus_constant (offset, INTVAL (XEXP (addr, 0))); } } @@ -317,11 +317,11 @@ print_operand_address (FILE * file, rtx addr) { if (offset) { - if (GET_CODE (offset) == CONST_INT) + if (CONST_INT_P (offset)) offset = plus_constant (XEXP (addr, 1), INTVAL (offset)); else { - gcc_assert (GET_CODE (XEXP (addr, 1)) == CONST_INT); + gcc_assert (CONST_INT_P (XEXP (addr, 1))); offset = plus_constant (offset, INTVAL (XEXP (addr, 1))); } } @@ -669,7 +669,7 @@ vax_rtx_costs (rtx x, int code, int outer_code, int *total) case ROTATE: case ROTATERT: *total = 6; /* 5 on VAX 2, 4 on VAX 9000 */ - if (GET_CODE (XEXP (x, 1)) == CONST_INT) + if (CONST_INT_P (XEXP (x, 1))) fmt = "e"; /* all constant rotate counts are short */ break; @@ -677,7 +677,7 @@ vax_rtx_costs (rtx x, int code, int outer_code, int *total) case MINUS: *total = (mode == DFmode) ? 13 : 8; /* 6/8 on VAX 9000, 16/15 on VAX 2 */ /* Small integer operands can use subl2 and addl2. */ - if ((GET_CODE (XEXP (x, 1)) == CONST_INT) + if ((CONST_INT_P (XEXP (x, 1))) && (unsigned HOST_WIDE_INT)(INTVAL (XEXP (x, 1)) + 63) < 127) fmt = "e"; break; @@ -690,7 +690,7 @@ vax_rtx_costs (rtx x, int code, int outer_code, int *total) case AND: /* AND is special because the first operand is complemented. */ *total = 3; - if (GET_CODE (XEXP (x, 0)) == CONST_INT) + if (CONST_INT_P (XEXP (x, 0))) { if ((unsigned HOST_WIDE_INT)~INTVAL (XEXP (x, 0)) > 63) *total = 4; @@ -917,7 +917,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands, } if (operands[1] == const0_rtx) return "clrl %0"; - if (GET_CODE (operands[1]) == CONST_INT + if (CONST_INT_P (operands[1]) && (unsigned) INTVAL (operands[1]) >= 64) { int i = INTVAL (operands[1]); @@ -937,7 +937,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands, return "movl %1,%0"; case HImode: - if (GET_CODE (operands[1]) == CONST_INT) + if (CONST_INT_P (operands[1])) { int i = INTVAL (operands[1]); if (i == 0) @@ -952,7 +952,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands, return "movw %1,%0"; case QImode: - if (GET_CODE (operands[1]) == CONST_INT) + if (CONST_INT_P (operands[1])) { int i = INTVAL (operands[1]); if (i == 0) @@ -994,10 +994,10 @@ vax_output_int_add (rtx insn ATTRIBUTE_UNUSED, rtx *operands, return "incl %0"; if (operands[2] == constm1_rtx) return "decl %0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) (- INTVAL (operands[2])) < 64) return "subl2 $%n2,%0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) INTVAL (operands[2]) >= 64 && REG_P (operands[1]) && ((INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768) @@ -1009,18 +1009,18 @@ vax_output_int_add (rtx insn ATTRIBUTE_UNUSED, rtx *operands, if (rtx_equal_p (operands[0], operands[2])) return "addl2 %1,%0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768 && REG_P (operands[1]) && push_operand (operands[0], SImode)) return "pushab %c2(%1)"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) (- INTVAL (operands[2])) < 64) return "subl3 $%n2,%1,%0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) INTVAL (operands[2]) >= 64 && REG_P (operands[1]) && ((INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768) @@ -1040,14 +1040,14 @@ vax_output_int_add (rtx insn ATTRIBUTE_UNUSED, rtx *operands, return "incw %0"; if (operands[2] == constm1_rtx) return "decw %0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) (- INTVAL (operands[2])) < 64) return "subw2 $%n2,%0"; return "addw2 %2,%0"; } if (rtx_equal_p (operands[0], operands[2])) return "addw2 %1,%0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) (- INTVAL (operands[2])) < 64) return "subw3 $%n2,%1,%0"; return "addw3 %1,%2,%0"; @@ -1059,14 +1059,14 @@ vax_output_int_add (rtx insn ATTRIBUTE_UNUSED, rtx *operands, return "incb %0"; if (operands[2] == constm1_rtx) return "decb %0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) (- INTVAL (operands[2])) < 64) return "subb2 $%n2,%0"; return "addb2 %2,%0"; } if (rtx_equal_p (operands[0], operands[2])) return "addb2 %1,%0"; - if (GET_CODE (operands[2]) == CONST_INT + if (CONST_INT_P (operands[2]) && (unsigned) (- INTVAL (operands[2])) < 64) return "subb3 $%n2,%1,%0"; return "addb3 %1,%2,%0"; @@ -1103,7 +1103,7 @@ int legitimate_constant_address_p (rtx x) { return (GET_CODE (x) == LABEL_REF || GET_CODE (x) == SYMBOL_REF - || GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST + || CONST_INT_P (x) || GET_CODE (x) == CONST || GET_CODE (x) == HIGH); } @@ -1217,12 +1217,12 @@ index_term_p (rtx prod, enum machine_mode mode, int strict) xfoo0 = XEXP (prod, 0); xfoo1 = XEXP (prod, 1); - if (GET_CODE (xfoo0) == CONST_INT + if (CONST_INT_P (xfoo0) && INTVAL (xfoo0) == (int)GET_MODE_SIZE (mode) && INDEX_REGISTER_P (xfoo1, strict)) return 1; - if (GET_CODE (xfoo1) == CONST_INT + if (CONST_INT_P (xfoo1) && INTVAL (xfoo1) == (int)GET_MODE_SIZE (mode) && INDEX_REGISTER_P (xfoo0, strict)) return 1; diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index 68f88c11d36..90dd8e046bf 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -872,24 +872,24 @@ VAX operand formatting codes: fputs (REGISTER_PREFIX, FILE); \ else if (CODE == 'C') \ fputs (rev_cond_name (X), FILE); \ - else if (CODE == 'D' && GET_CODE (X) == CONST_INT && INTVAL (X) < 0) \ + else if (CODE == 'D' && CONST_INT_P (X) && INTVAL (X) < 0) \ fprintf (FILE, "$" NEG_HWI_PRINT_HEX16, INTVAL (X)); \ - else if (CODE == 'P' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'P' && CONST_INT_P (X)) \ fprintf (FILE, "$" HOST_WIDE_INT_PRINT_DEC, INTVAL (X) + 1); \ - else if (CODE == 'N' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'N' && CONST_INT_P (X)) \ fprintf (FILE, "$" HOST_WIDE_INT_PRINT_DEC, ~ INTVAL (X)); \ /* rotl instruction cannot deal with negative arguments. */ \ - else if (CODE == 'R' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'R' && CONST_INT_P (X)) \ fprintf (FILE, "$" HOST_WIDE_INT_PRINT_DEC, 32 - INTVAL (X)); \ - else if (CODE == 'H' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'H' && CONST_INT_P (X)) \ fprintf (FILE, "$%d", (int) (0xffff & ~ INTVAL (X))); \ - else if (CODE == 'h' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'h' && CONST_INT_P (X)) \ fprintf (FILE, "$%d", (short) - INTVAL (x)); \ - else if (CODE == 'B' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'B' && CONST_INT_P (X)) \ fprintf (FILE, "$%d", (int) (0xff & ~ INTVAL (X))); \ - else if (CODE == 'b' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'b' && CONST_INT_P (X)) \ fprintf (FILE, "$%d", (int) (0xff & - INTVAL (X))); \ - else if (CODE == 'M' && GET_CODE (X) == CONST_INT) \ + else if (CODE == 'M' && CONST_INT_P (X)) \ fprintf (FILE, "$%d", ~((1 << INTVAL (x)) - 1)); \ else if (REG_P (X)) \ fprintf (FILE, "%s", reg_names[REGNO (X)]); \ diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md index 04a813f00a8..dd448007452 100644 --- a/gcc/config/vax/vax.md +++ b/gcc/config/vax/vax.md @@ -152,7 +152,7 @@ "" "* { - if (GET_CODE (operands[1]) == CONST_INT) + if (CONST_INT_P (operands[1])) { int i = INTVAL (operands[1]); if (i == 0) @@ -173,7 +173,7 @@ "" "* { - if (GET_CODE (operands[1]) == CONST_INT) + if (CONST_INT_P (operands[1])) { int i = INTVAL (operands[1]); if (i == 0) @@ -528,14 +528,14 @@ rtx op1 = operands[1]; /* If there is a constant argument, complement that one. */ - if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT) + if (CONST_INT_P (operands[2]) && !CONST_INT_P (op1)) { operands[1] = operands[2]; operands[2] = op1; op1 = operands[1]; } - if (GET_CODE (op1) == CONST_INT) + if (CONST_INT_P (op1)) operands[1] = GEN_INT (~INTVAL (op1)); else operands[1] = expand_unop (mode, one_cmpl_optab, op1, 0, 1); @@ -621,7 +621,7 @@ "" " { - if (GET_CODE (operands[2]) != CONST_INT) + if (!CONST_INT_P (operands[2])) operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2])); }") @@ -649,7 +649,7 @@ if (operands[2] == const1_rtx && rtx_equal_p (operands[0], operands[1])) return \"addl2 %0,%0\"; if (REG_P (operands[1]) - && GET_CODE (operands[2]) == CONST_INT) + && CONST_INT_P (operands[2])) { int i = INTVAL (operands[2]); if (i == 1) @@ -715,7 +715,7 @@ "" " { - if (GET_CODE (operands[2]) != CONST_INT) + if (!CONST_INT_P (operands[2])) operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2])); }") @@ -871,7 +871,8 @@ "" "* { - if (GET_CODE (operands[3]) != CONST_INT || GET_CODE (operands[2]) != CONST_INT + if (!CONST_INT_P (operands[3]) + || !CONST_INT_P (operands[2]) || !REG_P (operands[0]) || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16)) return \"extv %3,%2,%1,%0\"; @@ -888,7 +889,8 @@ "" "* { - if (GET_CODE (operands[3]) != CONST_INT || GET_CODE (operands[2]) != CONST_INT + if (!CONST_INT_P (operands[3]) + || !CONST_INT_P (operands[2]) || !REG_P (operands[0])) return \"extzv %3,%2,%1,%0\"; if (INTVAL (operands[2]) == 8) @@ -934,8 +936,9 @@ "" "* { - if (!REG_P (operands[0]) || GET_CODE (operands[2]) != CONST_INT - || GET_CODE (operands[3]) != CONST_INT + if (!REG_P (operands[0]) + || !CONST_INT_P (operands[2]) + || !CONST_INT_P (operands[3]) || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16) || INTVAL (operands[2]) + INTVAL (operands[3]) > 32 || side_effects_p (operands[1]) @@ -963,8 +966,9 @@ "" "* { - if (!REG_P (operands[0]) || GET_CODE (operands[2]) != CONST_INT - || GET_CODE (operands[3]) != CONST_INT + if (!REG_P (operands[0]) + || !CONST_INT_P (operands[2]) + || !CONST_INT_P (operands[3]) || INTVAL (operands[2]) + INTVAL (operands[3]) > 32 || side_effects_p (operands[1]) || (MEM_P (operands[1]) @@ -1151,7 +1155,7 @@ (set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))] - "!TARGET_UNIX_ASM && GET_CODE (operands[1]) == CONST_INT" + "!TARGET_UNIX_ASM && CONST_INT_P (operands[1])" "jaoblss %P1,%0,%l2") (define_insn "" @@ -1178,7 +1182,7 @@ (set (match_dup 0) (plus:SI (match_dup 0) (const_int 1)))] - "!TARGET_UNIX_ASM && GET_CODE (operands[1]) == CONST_INT" + "!TARGET_UNIX_ASM && CONST_INT_P (operands[1])" "jaobleq %P1,%0,%l2") ;; Something like a sob insn, but compares against -1. diff --git a/gcc/rtl.h b/gcc/rtl.h index 22ecd16f77c..cad48cbc6f9 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -361,6 +361,9 @@ struct rtvec_def GTY(()) { /* Predicate yielding nonzero iff X is an rtx for a memory location. */ #define MEM_P(X) (GET_CODE (X) == MEM) +/* Prediacte yielding nonzero iff X is an rtx for a constant integer. */ +#define CONST_INT_P(X) (GET_CODE (X) == CONST_INT) + /* Predicate yielding nonzero iff X is a label insn. */ #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)