diff mbox

[RFA] Patch to allow SPU port to build with current trunk

Message ID dd2e3eed-45c8-00db-3380-a9b9aa163502@redhat.com
State New
Headers show

Commit Message

Jeff Law Oct. 25, 2016, 2:59 p.m. UTC
The fallthru warnings triggered a couple times in the SPU port.  I'm not 
at all familiar with the chip or the port, but based on the little 
reading I've done and experience with GCC, I believe this patch is correct.


First, there's a missing fallthru comment in spu_sched_reorder for 
TYPE_LOAD/TYPE_STORE cases.  If I'm reading the SPU docs properly a 
load/store insn is handled by pipe_1 and we're also trying to model some 
aspects of the load-store unit.  So we should be setting pipe_ls and pipe_1:

          case TYPE_LOAD:
           case TYPE_STORE:
             pipe_ls = i;
           case TYPE_LNOP:
           case TYPE_SHUF:
           case TYPE_BR:
           case TYPE_MULTI1:
           case TYPE_HBR:
             pipe_1 = i;
             break;

This looks like intentional fallthru and should just have an appropriate 
comment to silence the warning.


spu_legitimate_address looks far more interesting and I think it's buggy 
as written:


     case SUBREG:
       x = XEXP (x, 0);
       if (REG_P (x))
         return 0;

     case REG:
       return INT_REG_OK_FOR_BASE_P (x, reg_ok_strict);

I think the test is inverted.  We want to consider (subreg (reg)) a 
valid memory address and reject all other (subreg (...)) expressions. 
But this code does the opposite.



OK for the trunk?

Jeff
* config/spu/spu.c (spu_sched_reorder): Add missing fallthru comment.
	(spu_legitimate_address_p): Fix logic error and add missing fallthru
	comment.
diff mbox

Patch

diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 5b59b72..820924e 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2894,6 +2894,7 @@  spu_sched_reorder (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED,
 	  case TYPE_LOAD:
 	  case TYPE_STORE:
 	    pipe_ls = i;
+	    /* FALLTHRU */
 	  case TYPE_LNOP:
 	  case TYPE_SHUF:
 	  case TYPE_BR:
@@ -3532,8 +3533,9 @@  spu_legitimate_address_p (machine_mode mode,
 
     case SUBREG:
       x = XEXP (x, 0);
-      if (REG_P (x))
+      if (!REG_P (x))
 	return 0;
+      /* FALLTHRU */
 
     case REG:
       return INT_REG_OK_FOR_BASE_P (x, reg_ok_strict);