This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

hppa-linux support 7


Assorted warning fixes.

	* 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.

Alan Modra
-- 
Linuxcare

diff -urpN -xCVS -x*~ -x.#* gcc-current/gcc/config/pa/pa.c gcc-new/gcc/config/pa/pa.c
--- gcc-current/gcc/config/pa/pa.c	Wed Apr  4 09:46:54 2001
+++ gcc-new/gcc/config/pa/pa.c	Wed Apr  4 10:07:37 2001
@@ -568,7 +569,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 +1615,18 @@ emit_move_sequence (operands, mode, scra
 	  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 +2307,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 +2394,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 +2474,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 +7139,13 @@ function_arg_partial_nregs (cum, mode, t
      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 -urpN -xCVS -x*~ -x.#* gcc-current/gcc/config/pa/pa.h gcc-new/gcc/config/pa/pa.h
--- gcc-current/gcc/config/pa/pa.h	Tue Apr  3 16:42:05 2001
+++ gcc-new/gcc/config/pa/pa.h	Sat Mar 31 22:11:39 2001
@@ -535,16 +546,16 @@ extern void hppa_init_pic_save PARAMS ((
    */
 
 #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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]