split out mul add x into separate instruction
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Apr 2022 20:58:04 +0000 (21:58 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Apr 2022 20:58:04 +0000 (21:58 +0100)
or at least looking like it

openpower/sv/bitmanip/mulmnu.c

index 2acdc08ec20c4dfdbae5ad9351cd86135cc8d005..a38afc4bece9040fc32b79e3d2363c1cee1a9973 100644 (file)
@@ -24,8 +24,15 @@ void mulmnu(unsigned short w[], unsigned short u[],
 
    for (j = 0; j < n; j++) {
       k = 0;
+      unsigned short phi[2000];
+      unsigned short plo[2000];
       for (i = 0; i < m; i++) {
-         t = u[i]*v[j] + w[i + j] + k;
+         unsigned product = u[i]*v[j] + w[i + j];
+         phi[i] = product>>16;
+         plo[i] = product;
+      }
+      for (i = 0; i < m; i++) {
+         t = (phi[i]<<16) | plo[i]  + k;
          w[i + j] = t;          // (I.e., t & 0xFFFF).
          k = t >> 16;
       }