On Jun 8, 2012, at 4:11 PM, Mike Stump wrote:
> On Apr 17, 2012, at 2:08 PM, Bernd Schmidt wrote:
>> This patch enables GET_MODE_WIDER_MODE for MODE_PARTIAL_INT (by setting
>> the wider mode to the one the partial mode is based on), which is useful
>> for the port I'm working on: I can avoid defining operations on the
>> partial modes.
> 
> I think this breaks my port, in emit-rtl.c:
> 
> B       for (mode = GET_CLASS_NARROWEST_MODE (MODE_PARTIAL_INT);
>             mode != VOIDmode;
>             mode = GET_MODE_WIDER_MODE (mode))
>  =>      const_tiny_rtx[i][(int) mode] = GEN_INT (i);
> 
> Doesn't work, as that does expects to step through all partial int modes.  
> The problem is, we went from P1QI -> P1SI, and now we go from P1QI to QI.  
> The problem is this, we never initialize P1SI anymore, and later, when 
> initializing vector constants, things like V2P1SI dies, as P1SI was never 
> built:
> 
>    /* We need to call this function after we set the scalar const_tiny_rtx    
>                            
>       entries.  */
>    gcc_assert (const_tiny_rtx[constant][(int) inner]);
> 
> So, maybe we want to go through all modes, and just ask, are you a 
> MODE_PARTIAL_INT, and initialize them that way?  Thoughts?

The below patch allows my port to at least initialize once more...  Thoughts?  
Ok?

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index af804df..8ff74c8 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -5704,9 +5704,9 @@ init_emit_once (void)
           mode = GET_MODE_WIDER_MODE (mode))
        const_tiny_rtx[i][(int) mode] = GEN_INT (i);
 
-      for (mode = GET_CLASS_NARROWEST_MODE (MODE_PARTIAL_INT);
-          mode != VOIDmode;
-          mode = GET_MODE_WIDER_MODE (mode))
+      for (mode = MIN_MODE_PARTIAL_INT;
+          mode <= MAX_MODE_PARTIAL_INT;
+          mode = (enum machine_mode)((int)(mode) + 1))
        const_tiny_rtx[i][(int) mode] = GEN_INT (i);
     }
 
@@ -5717,9 +5717,9 @@ init_emit_once (void)
        mode = GET_MODE_WIDER_MODE (mode))
     const_tiny_rtx[3][(int) mode] = constm1_rtx;
 
-  for (mode = GET_CLASS_NARROWEST_MODE (MODE_PARTIAL_INT);
-       mode != VOIDmode;
-       mode = GET_MODE_WIDER_MODE (mode))
+  for (mode = MIN_MODE_PARTIAL_INT;
+       mode <= MAX_MODE_PARTIAL_INT;
+       mode = (enum machine_mode)((int)(mode) + 1))
     const_tiny_rtx[3][(int) mode] = constm1_rtx;
       
   for (mode = GET_CLASS_NARROWEST_MODE (MODE_COMPLEX_INT);

Reply via email to