c - ARM neon 指令生成

标签 c gcc assembly arm neon

我想通过一个简单的 linpack.c 程序为 ARM 生成 neon 指令,该程序可从 Roy 获取。 我在arm-linux-gnueabi-gcc中使用了多个标志,例如,

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

据我所知,neon和VFP指令都是以V开头,比如VADD。但我看不到任何此类指令是转储的。我还使用了 -mfpu=vfp、-funsafe-math-optimizations 和静态 (-s) 标志,但我仍然看不到任何 neon 指令。 要么我没有识别 neon 指令,要么没有使用正确的 gcc 标志,要么没有明确使用生成 neon 指令的 c 代码!!

编辑: 使用命令编译第一条注释中提到的代码,

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

asm 是

.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

最佳答案

我用过-O3标志,它有助于解决问题。我得到了vadd, vmul,等等说明

关于c - ARM neon 指令生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32265000/

相关文章:

c - 为什么在这个例子中 strptime() 没有正确设置 tm_wday?

汇编语言在函数调用时打印字符两次,但直接执行时不会打印两次

c - Xilinx Microblaze C 和组装

c - atoi返回值

c - 使用 glib 从配置文本中读取值

c - while 循环之外的语句不运行

assembly - 有什么方法可以用汇编语言对乐高NXT 积木进行编程吗?

c - 为什么包含使用完整路径的 header 会导致更好的错误消息?

使用变量参数时 GCC 编译错误

c++ - 如何仅在本地 header 上运行预处理器?