Note that there are some explanatory texts on larger screens.

plurals
  1. POUse C variables in ARM Neon assembly
    primarykey
    data
    text
    <p>I've a problem using C/C++ variables inside ARM NEON assembly code written in:</p> <pre><code>__asm__ __volatile() </code></pre> <p>I've read about the following possibilities, which should move values from ARM to NEON registers. Each of the following possibilities cause a Fatal Signal in my Android application:</p> <pre><code>VDUP.32 d0, %[variable] VMOV.32 d0[0], %[variable] </code></pre> <p>the input argument list includes:</p> <pre><code>[variable] "r" (variable) </code></pre> <p>The only way I have success is using a load:</p> <pre><code>int variable = 0; int *address = &amp;variable; .... VLD1.32 d0[0], [%[address]] : [address] "+r" (address) </code></pre> <p>But I think a load is not the best for performance if I don't need to modify the variable, and I also need to understand how to move data from ARM to NEON registers for other purposes.</p> <p><strong>EDIT</strong>: added example as requested, both possibility 1 and 2 result in a "fatal signal". I know in this example NEON assembly simply should modify first 2 elements of "array[4]".</p> <pre><code>int c = 10; int *array4; array4 = new int[64]; for(int i = 0; i &lt; 64; i++){ array4[i] = 100*i; } __asm__ __volatile ("VLD1.32 d0, [%[array4]] \n\t" "VMOV.32 d1[0], %[c] \n\t" //this is possibility 1 "VDUP.32 d2, %[c] \n\t" //this is possibility 2 "VMUL.S32 d0, d0, d2 \n\t" "VST1.32 d0, [%[output_array1]] \n\t" : [output_array1] "=r" (output_array1) : [c] "r" (c), [array4] "r" (array4) : "d0", "d1", "d2"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload