title: In-Assembly example for NEON Cortex-A8
body: <p>I am trying to compile and example sing assembly codes for NEON for cortex A8 to use this binary on BeagleBone Black board (BBB). I use <strong>eclipse</strong> tool GCC compiler and Assembler listed below,</p>
  
  <blockquote>
    <p>GCC : arm-linux-gnueabi-gcc </p>
    
    <p>ASSEMBLER :  arm-linux-gnueabi-as</p>
  </blockquote>
  
  <p>The following error occurs in an example and for every example I use I find similar errors </p>
  
  <pre><code>Description Path    Resource    Location    Type
  SP not allowed in register list -- `ldmia r12,{r4-r11,r13,lr}'      EXAMPLE_NEON    line 61, external location: /tmp/ccTXrczs.s C/C++ Problem
  </code></pre>
  
  <p>the code i used</p>
  
  <p>/************************<br>
       * neon.c 
       *
       ************************/</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
  __attribute__((aligned (16)))
  unsigned short int data1[8];
  unsigned short int data2[8];
  unsigned short int out[8];
  
  void* neontest_save_buffer[16];
  
  
  void
  neontest(unsigned short int *a, unsigned short int *b,
                  unsigned short int* q)
  {
    __asm__(
  "   movw        r12, #:lower16:neontest_save_buffer\n\t"
  "   movt        r12, #:upper16:neontest_save_buffer\n\t"
  "   stmia       r12, {r4-r11, r13, lr}        @ save registers\n\t"
  "   vld1.16     {q1}, [r0:128]\n\t"
  "   vld1.16     {q2}, [r1:128]\n\t"
  "   vadd.i16    q0, q1, q2\n\t"
  "   vst1.32     {q0}, [r2:128]\n\t"
  "   movw        r12, #:lower16:neontest_save_buffer\n\t"
  "   movt        r12, #:upper16:neontest_save_buffer\n\t"
  "   ldmia       r12, {r4-r11, r13, lr}        @ reload all registers and return\n\t"
  "finish:\n\t"
      );
  
  }
  
  int
  main(void)
  {
      int i;
  
      for (i=0; i&lt;8; i++)
      {
          data1[i]=i*10;
          data2[i]=5;
          out[i]=0;
      }
  
      neontest(data1, data2, out);
  
      printf("output is: ");
      for (i=0; i&lt;7; i++)
      {
          printf("%d, ", out[i]);
      }
      printf("%d\n", out[i]);
  
    return(0);
  }
  </code></pre>