Hi,
I have being trying to persuade gcc to generate the ldp instruction without success. I have tried many combinations, below is an example.
--- cut here --- #define LDP(x,y,p) { \ struct vec { long x, y; } data; \ data = *(struct vec *)p; p += 2; \ x = data.x; y = data.y; \ }
long testp(long *p) { long x, y; LDP(x, y, p); return x+y; } --- cut here ---
$ gcc --version gcc (GCC) 4.9.1 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -S -O3 ldp.c $ cat ldp.s
.cpu generic+fp+simd .file "ldp.c" .text .align 2 .global testp .type testp, %function testp: ldr x1, [x0,8] ;; why not ldp????? ldr x0, [x0] add x0, x1, x0 ret .size testp, .-testp .ident "GCC: (GNU) 4.9.1"
What can I do do make it generate ldp?
Ed.