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]
Other format: [Raw text]

Re: [PATCH/RFA] genattrtab: Put a unsigned cast for unsignedcomparisons


On Sat, 26 Jun 2004, Kaz Kojima wrote:
> diff -upr ORIG/gcc/gcc/genattrtab.c LOCAL/gcc/gcc/genattrtab.c
> --- ORIG/gcc/gcc/genattrtab.c	2004-05-14 10:06:21.000000000 +0900
> +++ LOCAL/gcc/gcc/genattrtab.c	2004-06-25 13:45:59.000000000 +0900
> @@ -4579,6 +4579,15 @@ write_test_expr (rtx exp, int flags)
>      case PLUS:   case MINUS:  case MULT:     case DIV:      case MOD:
>      case AND:    case IOR:    case XOR:
>      case ASHIFT: case LSHIFTRT: case ASHIFTRT:
> +      switch (code)
> +	{
> +	case GEU: case GTU: case LEU: case LTU:
> +	  printf ("(unsigned) ");
> +	  break;
> +	default:
> +	  break;
> +	}
> +
>        write_test_expr (XEXP (exp, 0), flags | comparison_operator);
>        switch (code)
>  	{

Hi Kaz,

You can simplify this patch a bit by moving the existing GEU, GTU, LEU
and LTU cases to the top of the switch statement, calling printf there
and then falling through.

Something like:

    switch (code)
      {
      /* Binary operators.  */
+     case GEU:  case GTU:
+     case LEU:  case LTU:
+       printf ("(unsigned) ");
+
+       /* Fall through.  */
+
      case EQ: case NE:
!     case GE: case GT:
!     case LE: case LT:
        comparison_operator = 1;

      case PLUS:   case MINUS:  case MULT:     case DIV:      case MOD:


Just a thought.

Roger
--


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