gitee.com/quant1x/num@v0.3.2/asm/c2goasm/test/cpp/MultiplyAndAddMain.cpp (about)

     1  #include <stdio.h>
     2  
     3  void MultiplyAndAdd(float* arg1, float* arg2, float* arg3, float* result);
     4  
     5  int main() {
     6      int i;
     7      float f1[8], f2[8], f3[8], f4[8];
     8      for (i = 0; i < 8; i++) f1[i] = float(i);
     9      for (i = 0; i < 8; i++) f2[i] = float(i*2);
    10      for (i = 0; i < 8; i++) f3[i] = float(i*3);
    11      for (i = 0; i < 8; i++) f4[i] = 0.0;
    12  
    13      MultiplyAndAdd(f1, f2, f3, f4);	
    14  
    15      for (i = 0; i < 8; i++) {
    16          printf("result[%d] = %f (%f*%f + %f)\n", i, f4[i], f1[i], f2[i], f3[i]);
    17      }
    18  
    19      return 0;
    20  }