Making it obvious to the compiler how to generate a dual-MAC in
authorJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Wed, 26 Mar 2008 07:03:22 +0000 (18:03 +1100)
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Wed, 26 Mar 2008 07:03:22 +0000 (18:03 +1100)
mix_pitch_and_residual()

libcelt/vq.c

index 9092c62..cdba91e 100644 (file)
@@ -66,13 +66,14 @@ static void mix_pitch_and_residual(int * restrict iy, celt_norm_t * restrict X,
       y[i] = SHL16(iy[i],yshift);
    
    Ryp = 0;
-   for (i=0;i<N;i++)
-      Ryp = MAC16_16(Ryp,y[i],P[i]);
-
    Ryy = 0;
+   /* If this doesn't generate a dual MAC (on supported archs), fire the compiler guy */
    for (i=0;i<N;i++)
-      Ryy = MAC16_16(Ryy, y[i],y[i]);
-
+   {
+      Ryp = MAC16_16(Ryp, y[i], P[i]);
+      Ryy = MAC16_16(Ryy, y[i], y[i]);
+   }
+   
    /* g = (sqrt(Ryp^2 + Ryy - Rpp*Ryy)-Ryp)/Ryy */
    g = MULT16_32_Q15(
             celt_sqrt(MULT16_16(ROUND16(Ryp,14),ROUND16(Ryp,14)) + Ryy -