0
votes

I want to generate neon instruction for ARM from a simple linpack.c program available from Roy I have used multiple flags with arm-linux-gnueabi-gcc such as,

arm-linux-gnueabi-gcc -S -mfpu=neon /home/junaid/code/c/linpack.c

As far as I know, the neon and VFP instruction start with a V such as VADD. But I can not seen any such instruction is the dump. I have also used -mfpu=vfp, -funsafe-math-optimizations and static (-s) flags but still I cant see any neon instruction. Either I am not recognizing the neon instructions, or not using proper gcc flags, or not explicitly using a c code that generates neon instructions!!

EDIT: Compiling the code mentioned in the first comment with the command,

arm-linux-gnueabi-gcc -S -mfpu-neon /home/junaid/code/c/test.c .

The asm is

.arch armv5t
    .fpu softvfp
    .eabi_attribute 20, 1
    .eabi_attribute 21, 1
    .eabi_attribute 23, 3
    .eabi_attribute 24, 1
    .eabi_attribute 25, 1
    .eabi_attribute 26, 2
    .eabi_attribute 30, 6
    .eabi_attribute 34, 0
    .eabi_attribute 18, 4
    .file   "test.c"
    .global __aeabi_fadd
    .text
    .align  2
    .global f
    .type   f, %function
f:
    @ args = 0, pretend = 0, frame = 8
    @ frame_needed = 1, uses_anonymous_args = 0
    stmfd   sp!, {fp, lr}
    add fp, sp, #4
    sub sp, sp, #8
    str r0, [fp, #-8]   @ float
    ldr r3, [fp, #-8]   @ float
    mov r0, r3
    mov r1, r3
    bl  __aeabi_fadd
    mov r3, r0
    mov r0, r3
    sub sp, fp, #4
    ldmfd   sp!, {fp, pc}
    .size   f, .-f
    .ident  "GCC: (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3"
    .section    .note.GNU-stack,"",%progbits
1
How about trying it on a one-line program (float f(float x){return 2*x;}) and showing us the asm?Marc Glisse
@marc I have edited the question based on your comment.junaids
Hmm, that is using soft-float... Maybe -mfloat-abi=hard -mfpu=neon?Marc Glisse
Try turning on optimization (eg with -O3).Ross Ridge
I still do not get any neon instruction after using hard-float and O2, O3 filters. However, I have found one example that does produce neon instrctions. Still using the complete command with all filters such as, arm-linux-gnueabi-gcc-4.6 -O2 -march=armv7-a -mtune=cortex-a9 -ftree-vectorize -mhard-float -mfloat-abi=softfp -mfpu=neon -ffast-math -mvectorize-with-neon-quad -S on linpack code does not generate. Therefore, I deduce that the C code in the below-mentioned link is actually enabling generation of neon instructions. gist.github.com/syohex/3023686junaids

1 Answers

2
votes

I used -O3 flag and it helped to solve the problem. I got vadd, vmul, etc instructions with it