title: How to tell the compiler to unroll this loop
body: <p>I have the following loop that I am running on an ARM processor.</p>
  
  <pre><code>// pin here is pointer to some part of an array
  for (i = 0; i &lt; v-&gt;numelements; i++)
  {
      pe   = pptr[i];
      peParent = pe-&gt;parent;
  
      SPHERE  *ps = (SPHERE *)(pe-&gt;data);
  
      pin[0] = FLOAT2FIX(ps-&gt;rad2);
      pin[1] = *peParent-&gt;procs-&gt;pe_intersect == &amp;SphPeIntersect;
      fixifyVector( &amp;pin[2], ps-&gt;center ); // Is an inline function
  
      pin = pin + 5;
  }
  </code></pre>
  
  <p>By the slow performance of the loop, I can judge that the compiler was unable to unroll this loop, as when I manually do the unrolling, it becomes quite fast. I think the compiler is getting confused by the <code>pin</code> pointer. Can we use <code>restrict</code> keyword to help the compiler here, or is <code>restrict</code> only reserved for function parameters? In general how can we tell the compiler to unroll it and don't worry about the <code>pin</code> pointer.</p>