From f49e46d831f6f30c42e1580c33fa50abe1f5c7fa Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 14 Jul 2008 00:22:35 +0000 Subject: [PATCH] re PR target/35492 (ICE building kernel sk_stream_wait_connect output_operand: invalid operand for 'p' modifier) PR target/35492. * config/cris/cris.h (CRIS_CONST_OK_FOR_LETTER_P): Renamed from CONST_OK_FOR_LETTER_P. All port-local users changed. (CONST_OK_FOR_CONSTRAINT_P): Define; implement Kc as old K, implement Kp matching power-of-two. (CONSTRAINT_LEN): Define to match. * config/cris/cris.md: Replace all use of constraint K with Kc. ("*btst*): Use Kp for operand 0 of last alternative. From-SVN: r137765 --- gcc/ChangeLog | 11 +++++++ gcc/config/cris/cris.c | 11 ++++--- gcc/config/cris/cris.h | 12 +++++++- gcc/config/cris/cris.md | 82 ++++++++++++++++++++++++------------------------- 4 files changed, 69 insertions(+), 47 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7e84b6..aab3307 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2008-07-14 Hans-Peter Nilsson + + PR target/35492. + * config/cris/cris.h (CRIS_CONST_OK_FOR_LETTER_P): Renamed from + CONST_OK_FOR_LETTER_P. All port-local users changed. + (CONST_OK_FOR_CONSTRAINT_P): Define; implement Kc as old K, + implement Kp matching power-of-two. + (CONSTRAINT_LEN): Define to match. + * config/cris/cris.md: Replace all use of constraint K with Kc. + ("*btst*): Use Kp for operand 0 of last alternative. + 2008-07-13 John David Anglin PR testsuite/36440 diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 3a0eb2d..a77f200 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -684,7 +684,7 @@ cris_print_operand (FILE *file, rtx x, int code) /* Print the unsigned supplied integer as if it were signed and < 0, i.e print 255 or 65535 as -1, 254, 65534 as -2, etc. */ if (!CONST_INT_P (x) - || ! CONST_OK_FOR_LETTER_P (INTVAL (x), 'O')) + || !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (x), 'O')) LOSE_AND_RETURN ("invalid operand for 'b' modifier", x); fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)| (INTVAL (x) <= 255 ? ~255 : ~65535)); @@ -1503,8 +1503,8 @@ cris_normal_notice_update_cc (rtx exp, rtx insn) > CRIS_LAST_GENERAL_REGISTER)) || (TARGET_V32 && GET_CODE (SET_SRC (exp)) == CONST_INT - && CONST_OK_FOR_LETTER_P (INTVAL (SET_SRC (exp)), - 'I'))) + && CRIS_CONST_OK_FOR_LETTER_P (INTVAL (SET_SRC (exp)), + 'I'))) { /* There's no CC0 change for this case. Just check for overlap. */ @@ -1831,7 +1831,7 @@ cris_rtx_costs (rtx x, int code, int outer_code, int *total) if (CONST_INT_P (XEXP (x, 1)) /* Two constants may actually happen before optimization. */ && !CONST_INT_P (XEXP (x, 0)) - && !CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x, 1)), 'I')) + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x, 1)), 'I')) { *total = (rtx_cost (XEXP (x, 0), outer_code) + 2 + 2 * GET_MODE_NUNITS (GET_MODE (XEXP (x, 0)))); @@ -1905,7 +1905,8 @@ cris_address_cost (rtx x) /* A BDAP -32768 .. 32767 is like BDAP quick, but with 2 extra bytes. */ - if (CONST_INT_P (tem2) && CONST_OK_FOR_LETTER_P (INTVAL (tem2), 'L')) + if (CONST_INT_P (tem2) + && CRIS_CONST_OK_FOR_LETTER_P (INTVAL (tem2), 'L')) return (2 + 2) / 2; /* A BDAP with some other constant is 2 bytes extra. */ diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 915c314..b8a66e9 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -668,7 +668,7 @@ enum reg_class /* We are now out of letters; we could use ten more. This forces us to use C-code in the 'md' file. FIXME: Use some EXTRA_CONSTRAINTS. */ -#define CONST_OK_FOR_LETTER_P(VALUE, C) \ +#define CRIS_CONST_OK_FOR_LETTER_P(VALUE, C) \ ( \ /* MOVEQ, CMPQ, ANDQ, ORQ. */ \ (C) == 'I' ? (VALUE) >= -32 && (VALUE) <= 31 : \ @@ -691,6 +691,16 @@ enum reg_class (C) == 'P' ? (VALUE) >= -32768 && (VALUE) <= 65535 : \ 0) +#define CONST_OK_FOR_CONSTRAINT_P(VALUE, C, S) \ + ( \ + ((C) != 'K' || (S)[1] == 'c') \ + ? CRIS_CONST_OK_FOR_LETTER_P (VALUE, C) : \ + ((C) == 'K' && (S)[1] == 'p') \ + ? exact_log2 (VALUE) >= 0 : \ + 0) + +#define CONSTRAINT_LEN(C, S) ((C) == 'K' ? 2 : DEFAULT_CONSTRAINT_LEN (C, S)) + /* It is really simple to make up a 0.0; it is the same as int-0 in IEEE754. */ #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \ diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 9e3ec02..12e4431 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -347,7 +347,7 @@ (define_insn "*cmpdi_non_v32" [(set (cc0) (compare (match_operand:DI 0 "nonimmediate_operand" "r,r,r,r,r,r,o") - (match_operand:DI 1 "general_operand" "K,I,P,n,r,o,r")))] + (match_operand:DI 1 "general_operand" "Kc,I,P,n,r,o,r")))] "!TARGET_V32" "@ cmpq %1,%M0\;ax\;cmpq 0,%H0 @@ -361,7 +361,7 @@ (define_insn "*cmpdi_v32" [(set (cc0) (compare (match_operand:DI 0 "register_operand" "r,r,r,r,r") - (match_operand:DI 1 "nonmemory_operand" "K,I,P,n,r")))] + (match_operand:DI 1 "nonmemory_operand" "Kc,I,P,n,r")))] "TARGET_V32" "@ cmpq %1,%M0\;ax\;cmpq 0,%H0 @@ -458,9 +458,9 @@ (define_insn "*btst" [(set (cc0) (zero_extract - (match_operand:SI 0 "nonmemory_operand" "r,r,r,r,r,r,n") - (match_operand:SI 1 "const_int_operand" "K,n,K,n,K,n,n") - (match_operand:SI 2 "nonmemory_operand" "M,M,K,n,r,r,r")))] + (match_operand:SI 0 "nonmemory_operand" "r, r,r, r,r, r,Kp") + (match_operand:SI 1 "const_int_operand" "Kc,n,Kc,n,Kc,n,n") + (match_operand:SI 2 "nonmemory_operand" "M, M,Kc,n,r, r,r")))] ;; Either it is a single bit, or consecutive ones starting at 0. ;; The btst ones depend on stuff in NOTICE_UPDATE_CC. "CONST_INT_P (operands[1]) @@ -690,8 +690,8 @@ && (!CONST_INT_P (operands[2]) || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return "#"; if (which_alternative == 4) return "move [%3=%2%S1],%0"; @@ -717,8 +717,8 @@ && (!CONST_INT_P (operands[2]) || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return "#"; if (which_alternative < 3) return "move.%s0 [%3=%1%S2],%0"; @@ -836,8 +836,8 @@ && (!CONST_INT_P (operands[1]) || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return "#"; if (which_alternative == 1 || which_alternative == 5) return "#"; @@ -870,8 +870,8 @@ && (!CONST_INT_P (operands[1]) || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return "#"; if (which_alternative == 1 || which_alternative == 7 @@ -943,8 +943,8 @@ && (!CONST_INT_P (operands[1]) || INTVAL (operands[1]) > 127 || INTVAL (operands[1]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J'))) return "#"; if (which_alternative == 4) return "clear [%2=%1%S0]"; @@ -1286,8 +1286,8 @@ && (!CONST_INT_P (operands[2]) || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return "#"; if (which_alternative == 4) return "mov%e4.%m4 [%3=%2%S1],%0"; @@ -1310,8 +1310,8 @@ && (!CONST_INT_P (operands[2]) || INTVAL (operands[2]) > 127 || INTVAL (operands[2]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J'))) return "#"; if (which_alternative == 4) return "mov%e4 [%3=%2%S1],%0"; @@ -1647,8 +1647,8 @@ && (!CONST_INT_P (operands[3]) || INTVAL (operands[3]) > 127 || INTVAL (operands[3]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) return "#"; if (which_alternative == 4) return "%x5.%s0 [%4=%3%S2],%0"; @@ -1705,8 +1705,8 @@ && (!CONST_INT_P (operands[3]) || INTVAL (operands[3]) > 127 || INTVAL (operands[3]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) return "#"; if (which_alternative == 4) return "%x5 [%4=%3%S2],%0"; @@ -2137,8 +2137,8 @@ && (!CONST_INT_P (operands[3]) || INTVAL (operands[3]) > 127 || INTVAL (operands[3]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) return "#"; if (which_alternative == 4) return "%x5%E6.%m6 [%4=%3%S2],%0"; @@ -2166,8 +2166,8 @@ && (!CONST_INT_P (operands[3]) || INTVAL (operands[3]) > 127 || INTVAL (operands[3]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) return "#"; if (which_alternative == 4) return "%x5%E6 [%4=%3%S2],%0"; @@ -2246,8 +2246,8 @@ && (!CONST_INT_P (operands[3]) || INTVAL (operands[3]) > 127 || INTVAL (operands[3]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) return "#"; if (which_alternative == 4) return "add%e5.b [%4=%3%S2],%0"; @@ -2274,8 +2274,8 @@ && (!CONST_INT_P (operands[3]) || INTVAL (operands[3]) > 127 || INTVAL (operands[3]) < -128 - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') - || CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N') + || CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J'))) return "#"; if (which_alternative == 4) return \"%x6%E5.%m5 [%4=%3%S2],%0\"; @@ -3238,7 +3238,7 @@ (define_insn "si3" [(set (match_operand:SI 0 "register_operand" "=r") (shift:SI (match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "nonmemory_operand" "Kr")))] + (match_operand:SI 2 "nonmemory_operand" "Kcr")))] "" { if (REG_S_P (operands[2])) @@ -3318,7 +3318,7 @@ (define_insn "ashl3" [(set (match_operand:BW 0 "register_operand" "=r,r") (ashift:BW (match_operand:BW 1 "register_operand" "0,0") - (match_operand:BW 2 "nonmemory_operand" "r,K")))] + (match_operand:BW 2 "nonmemory_operand" "r,Kc")))] "" { return @@ -4668,8 +4668,8 @@ "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD && REGNO (operands[3]) != REGNO (operands[0]) && (BASE_P (operands[1]) || BASE_P (operands[2])) - && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J') - && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128) && TARGET_SIDE_EFFECT_PREFIXES" [(parallel @@ -4704,8 +4704,8 @@ "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD && REGNO (operands[4]) != REGNO (operands[0]) && (BASE_P (operands[1]) || BASE_P (operands[2])) - && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J') - && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128) && TARGET_SIDE_EFFECT_PREFIXES" [(parallel @@ -4742,8 +4742,8 @@ ;; Change to GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD? "GET_MODE (operands[3]) != DImode && REGNO (operands[0]) != REGNO (operands[3]) - && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J') - && ! CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'J') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'N') && INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) <= 127 && TARGET_SIDE_EFFECT_PREFIXES" @@ -4934,7 +4934,7 @@ ;; don't do this for a mem-volatile access. "REGNO (operands[2]) == REGNO (operands[0]) && INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0 - && !CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'I') + && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'I') && !side_effects_p (operands[1])" ;; FIXME: CC0 valid except for M (i.e. CC_NOT_NEGATIVE). [(set (match_dup 0) (match_dup 4)) @@ -4942,7 +4942,7 @@ { enum machine_mode zmode = INTVAL (operands[3]) <= 255 ? QImode : HImode; enum machine_mode amode - = CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'O') ? SImode : zmode; + = CRIS_CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'O') ? SImode : zmode; rtx op1 = (REG_S_P (operands[1]) ? gen_rtx_REG (zmode, REGNO (operands[1])) -- 2.7.4