How to use VFP instructions on ARM

Dorit Nuzman DORIT@il.ibm.com
Thu Jan 17 02:14:00 GMT 2008


> Hi,
>
> Please forgive this post but I've tried the archives & google and
amunable to
> find much info on gcc & ARM's VFP instruction set. I have a few
questions:
>
> 1) How is the VFP coprocessor utilised by GCC when compiling
> with -mfpu=vfp -mfloat-abi=softfp? Will GCC emit vfp instructions for
doing
> regular (scalor) floating point operations? I.e. will "float a =3.14; a
*=
> 20.0;" be done by the coprocessor?
>
> 2) How should I use the VFP instructions in my own code? I beleive there
are
> GCC macros for using SSE instructions, is there anything similar forARM
VFP?
> (A quick traul through my GCC sources say no, but I may have missed
> something.) If not, can I use inline assembly instead and are the
mnemonics
> and syntax the same as described in the ARM Architecture Reference
Manual?
>
> 3) Does the GCC -ftree-vectorize work with VFP?
>

I don't know, but I guess you could try compiling a testcase with a simple
loop using
-mfpu=vfp -mfloat-abi=softfp -ftree-vectorize -ftree-vectorizer-verbose=#
and see what it says (it will report if it wasn't able to vectorize, and
why).

(The bare minimum to enable vectorization for the target is to define
UNITS_PER_SIMD_WORD to the size in bytes of the vector registers available
under TARGET_VFP in the arm port. I'm not so familiar with this port; the
closest thing I see in arm/arm.h is this:

/* Use the option -mvectorize-with-neon-quad to override the use of
doubleword
   registers when autovectorizing for Neon, at least until multiple vector
   widths are supported properly by the middle-end.  */
#define UNITS_PER_SIMD_WORD \
  (TARGET_NEON ? (TARGET_NEON_VECTORIZE_QUAD ? 16 : 8) : UNITS_PER_WORD)
)

dorit

> 4) Is there a better place to look for this information? :-)
>
>
>
> Cheers,
>
> Tom
>
>
>



More information about the Gcc-help mailing list