floating-pointvectorizationneoncortex-aarm-none-eabi-gcc

ARM Cortex-A9 NEON and VFP


I am using ARM Cortex-A9 (zynq7000) and I want to enable the neon SIMD but not to use it for floating points unless specified.

When compiled by arm-none-eabi-gcc with following fpu options (seperately) :

  1. mfpu=vfpv3 -mfloat-abi=softfp ,
  2. mfpu=neon-vfpv3 -mfloat-abi=softfp,
  3. mfpu=neon -mfloat-abi=softfp,

the binaries 1 & 2 are different. But 2&3 are the same (vectorization not enabled),   I am using -Og for optimization. ( -Og does not enable Vectorize options)

How can I make sure that all floating points are done in VFP, not the NEON when I use the option mfpu=neon-vfpv3?

According to the ARM Architecture Reference Manual, NEON and VFP support similar Instructions, which makes it difficult to distinguish the difference just by checking disassembly.

Moreover, I am planning to use  #pragma GCC ivdep for the loops and functions that I need to vectorize, and what would be the appropriate compiler flags to achieve this?


Solution

  • The compiler will never use any neon instruction unless auto vectorization is enabled or enforced via intrinsics.

    Even though neon and vfp instructions look similar, they even operate in a different mode each.

    There are a few instructions shared by vfp and neon on armv7 (mostly memory related), but they shouldn't be of any concern.

    Why don't you post the disassemblies?