title: Float point instructions on ARM assembly
body: <p>I'm trying to create an ARM benchmark that  loop  over  the following instructions (in assembly), alone and in combination:</p>
  
  <ul>
  <li>Integer additions</li>
  <li>Integer multiplications</li>
  <li>Float point additions</li>
  <li>Float point multiplications</li>
  </ul>
  
  <p>This is my code for integer operations:</p>
  
  <pre><code>int additions_int(int n) {
  
      int i, dummyValue = n;
  
      __asm (
          "MOV R0, #2\n"
          "MOV R1, #6\n"
      );
  
      for (i = 0; i &lt; n/LOOP_STEP; i++) {
  
          __asm (
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
              "ADD R0, R0, R1\n"
          );
      }
  
      return dummyValue;
  }
  
  
  int multiplications_int(int n) {
  
      int i, dummyValue=n;
  
      __asm (
          "MOV R0, #2\n"
          "MOV R1, #6\n"
      );
  
      for (i = 0; i &lt; n/LOOP_STEP; i++) {
  
          __asm (
  
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
              "MUL R0, R0, R1\n"
  
          );
  
      }
  
      return dummyValue;
  }
  </code></pre>
  
  <p>The problem is in the float point operations. I checked <a href="http://infocenter.arm.com/help/topic/com.arm.doc.uan0015b/Cortex_A57_Software_Optimization_Guide_external.pdf" rel="nofollow">this documentation</a>, and I've tryed to do something like this:</p>
  
  <pre><code>float multiplications_fp(int n) {
      int i;
      float fn=n, dummyValue = fn;
  
      for (i = 0; i &lt; n/LOOP_STEP; i++) {
          __asm (
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
              "VMUL.F32 R0, R0, R1\n"
          );
      }
  
      return dummyValue;
  }
  
  
  float additions_fp(int n) {
      int i;
      float fn=n, dummyValue = fn;
  
      for (i = 0; i &lt; n/LOOP_STEP; i++) {
          __asm (
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n"
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n" 
              "VADD.F32 R0, R0, R1\n"  
          );
      }
  
      return dummyValue;
  }
  </code></pre>
  
  <p>Compiling with:</p>
  
  <pre><code>arm-linux-gnueabi-gcc -static -march=armv7-a microbenchmark_arm.c -o microbenchmark_arm
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <pre><code>Error: selected processor does not support ARM mode `vmul.f32 R0,R0,R1'
  Error: selected processor does not support ARM mode `vadd.f32 R0,R0,R1'
  </code></pre>
  
  <p>Can anyone say me what I'm doing wrong?</p>
  
  <p>Can anyone show me an example of float point additions or multiplications for ARM Cortex-A architecture?</p>