From e0c556d31f58b412eeab4098d728494d6db2b21e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 13 Apr 2001 05:48:20 +0000 Subject: [PATCH] pa.c (uint32_operand): Don't use long constant >= 2^32. * pa.c (uint32_operand): Don't use long constant >= 2^32. (emit_move_sequence): Use HOST_WIDE_INT constants. Don't worry about 32->64 bit sign extension if 32 bit HOST_WIDE_INTs. (compute_movstrsi_length): Make `align' unsigned to avoid warning. (output_64bit_and): Use plain `int's for shift counts. (output_64bit_ior): Likewise. (function_arg_partial_nregs): Use unsigned vars to avoid warnings. * pa.h (CONST_OK_FOR_LETTER_P): Use HOST_WIDE_INT constants for case `N', and simplify. From-SVN: r41328 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/pa/pa.c | 36 +++++++++++++++++++----------------- gcc/config/pa/pa.h | 20 ++++++++++---------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0fbc838e575..b4c43f570ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2001-04-13 Alan Modra + * pa.c (uint32_operand): Don't use long constant >= 2^32. + (emit_move_sequence): Use HOST_WIDE_INT constants. Don't worry + about 32->64 bit sign extension if 32 bit HOST_WIDE_INTs. + (compute_movstrsi_length): Make `align' unsigned to avoid warning. + (output_64bit_and): Use plain `int's for shift counts. + (output_64bit_ior): Likewise. + (function_arg_partial_nregs): Use unsigned vars to avoid warnings. + * pa.h (CONST_OK_FOR_LETTER_P): Use HOST_WIDE_INT constants for case + `N', and simplify. + * pa-hpux10.h (NEW_HP_ASSEMBLER): Define to 1. * pa-hpux11.h (NEW_HP_ASSEMBLER): Likewise. * pa.h (LEGITIMATE_CONSTANT_P) Collapse two defines depending on diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index c7d828e4cce..7afcaab4da6 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -568,7 +568,7 @@ uint32_operand (op, mode) #if HOST_BITS_PER_WIDE_INT > 32 /* All allowed constants will fit a CONST_INT. */ return (GET_CODE (op) == CONST_INT - && (INTVAL (op) >= 0 && INTVAL (op) < 0x100000000L)); + && (INTVAL (op) >= 0 && INTVAL (op) < (HOST_WIDE_INT) 1 << 32)); #else return (GET_CODE (op) == CONST_INT || (GET_CODE (op) == CONST_DOUBLE @@ -1595,16 +1595,18 @@ emit_move_sequence (operands, mode, scratch_reg) int need_zero_extend = 0; if (TARGET_64BIT && GET_CODE (operand1) == CONST_INT + && HOST_BITS_PER_WIDE_INT > 32 && GET_MODE_BITSIZE (GET_MODE (operand0)) > 32) { HOST_WIDE_INT val = INTVAL (operand1); - HOST_WIDE_INT nval = INTVAL (operand1); + HOST_WIDE_INT nval; /* If the value is the same after a 32->64bit sign extension, then we can use it as-is. Else we will need to sign extend the constant from 32->64bits then zero extend the result from 32->64bits. */ - nval = ((val & 0xffffffff) ^ (~0x7fffffff)) + 0x80000000; + nval = ((val & (((HOST_WIDE_INT) 2 << 31) - 1)) + ^ ((HOST_WIDE_INT) 1 << 31)) - ((HOST_WIDE_INT) 1 << 31); if (val != nval) { need_zero_extend = 1; @@ -2285,7 +2287,7 @@ compute_movstrsi_length (insn) rtx insn; { rtx pat = PATTERN (insn); - int align = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0)); + unsigned int align = INTVAL (XEXP (XVECEXP (pat, 0, 6), 0)); unsigned long n_bytes = INTVAL (XEXP (XVECEXP (pat, 0, 5), 0)); unsigned int n_insns = 0; @@ -2372,22 +2374,22 @@ output_64bit_and (operands) if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0) { unsigned HOST_WIDE_INT mask = INTVAL (operands[2]); - unsigned HOST_WIDE_INT ls0, ls1, ms0, p, len; + int ls0, ls1, ms0, p, len; for (ls0 = 0; ls0 < HOST_BITS_PER_WIDE_INT; ls0++) - if ((mask & ((unsigned HOST_WIDE_INT)1 << ls0)) == 0) + if ((mask & ((unsigned HOST_WIDE_INT) 1 << ls0)) == 0) break; for (ls1 = ls0; ls1 < HOST_BITS_PER_WIDE_INT; ls1++) - if ((mask & ((unsigned HOST_WIDE_INT)1 << ls1)) != 0) + if ((mask & ((unsigned HOST_WIDE_INT) 1 << ls1)) != 0) break; for (ms0 = ls1; ms0 < HOST_BITS_PER_WIDE_INT; ms0++) - if ((mask & ((unsigned HOST_WIDE_INT)1 << ms0)) == 0) + if ((mask & ((unsigned HOST_WIDE_INT) 1 << ms0)) == 0) break; if (ms0 != HOST_BITS_PER_WIDE_INT) - abort(); + abort (); if (ls1 == HOST_BITS_PER_WIDE_INT) { @@ -2452,22 +2454,22 @@ output_64bit_ior (operands) rtx *operands; { unsigned HOST_WIDE_INT mask = INTVAL (operands[2]); - unsigned HOST_WIDE_INT bs0, bs1, p, len; + int bs0, bs1, p, len; if (INTVAL (operands[2]) == 0) return "copy %1,%0"; for (bs0 = 0; bs0 < HOST_BITS_PER_WIDE_INT; bs0++) - if ((mask & ((unsigned HOST_WIDE_INT)1 << bs0)) != 0) + if ((mask & ((unsigned HOST_WIDE_INT) 1 << bs0)) != 0) break; for (bs1 = bs0; bs1 < HOST_BITS_PER_WIDE_INT; bs1++) - if ((mask & ((unsigned HOST_WIDE_INT)1 << bs1)) == 0) + if ((mask & ((unsigned HOST_WIDE_INT) 1 << bs1)) == 0) break; if (bs1 != HOST_BITS_PER_WIDE_INT && ((unsigned HOST_WIDE_INT) 1 << bs1) <= mask) - abort(); + abort (); p = 63 - bs0; len = bs1 - bs0; @@ -7113,13 +7115,13 @@ function_arg_partial_nregs (cum, mode, type, named) tree type; int named ATTRIBUTE_UNUSED; { - int max_arg_words = 8; - int offset = 0; + unsigned int max_arg_words = 8; + unsigned int offset = 0; - if (FUNCTION_ARG_SIZE(mode, type) > 1 && (cum->words & 1)) + if (FUNCTION_ARG_SIZE (mode, type) > 1 && (cum->words & 1)) offset = 1; - if (cum->words + offset + FUNCTION_ARG_SIZE(mode, type) <= max_arg_words) + if (cum->words + offset + FUNCTION_ARG_SIZE (mode, type) <= max_arg_words) /* Arg fits fully into registers. */ return 0; else if (cum->words + offset >= max_arg_words) diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 7548c1f4d36..3b9eaf027b7 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -546,16 +546,16 @@ extern void hppa_init_pic_save PARAMS ((void)); */ #define CONST_OK_FOR_LETTER_P(VALUE, C) \ - ((C) == 'I' ? VAL_11_BITS_P (VALUE) \ - : (C) == 'J' ? VAL_14_BITS_P (VALUE) \ - : (C) == 'K' ? zdepi_cint_p (VALUE) \ - : (C) == 'L' ? VAL_5_BITS_P (VALUE) \ - : (C) == 'M' ? (VALUE) == 0 \ - : (C) == 'N' ? (((VALUE) & (unsigned long)0x7ff) == 0 \ - && (VALUE) == ((((VALUE) & 0xffffffff) ^ (~0x7fffffff)) \ - + 0x80000000)) \ - : (C) == 'O' ? (((VALUE) & ((VALUE) + (long)1)) == 0) \ - : (C) == 'P' ? and_mask_p (VALUE) \ + ((C) == 'I' ? VAL_11_BITS_P (VALUE) \ + : (C) == 'J' ? VAL_14_BITS_P (VALUE) \ + : (C) == 'K' ? zdepi_cint_p (VALUE) \ + : (C) == 'L' ? VAL_5_BITS_P (VALUE) \ + : (C) == 'M' ? (VALUE) == 0 \ + : (C) == 'N' ? (((VALUE) & (((HOST_WIDE_INT) -1 << 31) | 0x7ff)) == 0 \ + || (((VALUE) & (((HOST_WIDE_INT) -1 << 31) | 0x7ff)) \ + == (HOST_WIDE_INT) -1 << 31)) \ + : (C) == 'O' ? (((VALUE) & ((VALUE) + 1)) == 0) \ + : (C) == 'P' ? and_mask_p (VALUE) \ : 0) /* Similar, but for floating or large integer constants, and defining letters -- 2.30.2