Neon Extend examples

These examples use inline assembler just to force a core to NEON copy-and-extend operation.

The left side show the outout without the patch.

   1 void
   2 sign_extend (int a)
   3 {
   4   long long b = a;
   5   asm volatile ("@ extended to %0" : : "w" (b));
   6 }

sign_extend:
    asrs    r3, r0, #31           | vdup.32 d16, r0
    mov     r2, r0                | vshr.s64        d16, d16, #32
    fmdrr   d16, r2, r3     @ int |

   1 void
   2 zero_extend (unsigned int a)
   3 {
   4   unsigned long long b = a;
   5   asm volatile ("@ extended to %0" : : "w" (b));
   6 }

zero_extend:
   mov     r2, r0                | vdup.32 d16, r0
   movs    r3, #0                | vshr.u64        d16, d16, #32
   fmdrr   d16, r2, r3     @ int |

AndrewStubbs/Sandbox/neon-extend (last modified 2012-05-22 14:10:22)