This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

使用arm gcc 编译代码,sqrt 没有生成 vsqrt 指令而是调用的sqrt函数

现在用cortex a9,和arm-eabi-gcc 编译一段数学运算,其中有乘除和sqrt,编译选项 -mfpu=vfpv3 -mfloat-abi=softfp,看了反汇编,已经有 vmul,vdiv 这些浮点指令了,但是 sqrt 却是调用的 sqrt 函数,没有生成 vsqrt 指令。然后-O1 优化之后,才生成了 vsqrt 指令。这是怎么回事?

为什么乘除的浮点指令都生成了,而sqrt 却只能在打开优化才能生成vsqrt?

另外,arm gcc 的 -O1 选项都打开那些优化了?

  • -mfloat-abi=softfp

    • soft: full software floating-point support
    • softfp: Allows use of floating-point instructions but maintains compatibility with the soft-float ABI
    • hard: Uses floating-point instructions and the floating-point ABI.

    试试hard?