PULP Community
how can i occur fmadd instruction? - Printable Version

+- PULP Community (https://pulp-platform.org/community)
+-- Forum: PULP's Community forum (https://pulp-platform.org/community/forumdisplay.php?fid=1)
+--- Forum: PULP General questions (https://pulp-platform.org/community/forumdisplay.php?fid=2)
+--- Thread: how can i occur fmadd instruction? (/showthread.php?tid=350)



how can i occur fmadd instruction? - sungyong - 07-29-2024

how can i occur the fmadd instruction with c code?

in regression examples
      for (t=0; t<T; t++) {
        for (i=2; i<N-1; i++) {
          for (j=2; j<N-1; j++) {
            b[i][j]= 0.2f*(a[i][j]+a[i][j-1]+a[i][1+j]+a[1+i][j]+a[i-1][j]);
            printf("caculate finished # i=%d j=%d \n",i,j);
          }
        }
      }
This example occurs fadd instrctions. 
then, how can i occur fmadd instrctions? is there any special condition for it?


RE: how can i occur fmadd instruction? - kgf - 08-05-2024

I am not a compiler expert, but see this for LLVM:
https://discourse.llvm.org/t/risc-v-multiply-add-instructions-fmadd-etc-bit-exactness-and-correctness-of-optimizations/64194

It is quite possible that the compiler would need some help, they seem to be better when the operation is in fact: (rs1×rs2)+rs3 and not more complex. The compiler flags play sometime an important role as well.