[LLVMdev] NEON vector instructions and the fast math IR flags

Renato Golin renato.golin at linaro.org
Thu Jun 6 23:58:22 PDT 2013


On 7 June 2013 07:05, Owen Anderson <resistor at mac.com> wrote:

> Darwin uses NEON for floating point, but does *not* (and should not).
> globally enable fast math flags.  Use of NEON for FP needs to remain
> achievable without globally setting the fast math flags.  Fast math may
> imply reasonably imply NEON, but the opposite direction is not accurate.
>
> That said, I don't think anyone would object to making VFP codegen
> available under non-Darwin triples.  It's just a matter of making it happen.
>

Hi Owen,

ARMSubtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) has a
check to see if the target is Darwin or if UnsafeMath is enabled to set
the UseNEONForSinglePrecisionFP, but only for A5 and A8, where this was a
problem. Maybe I was too conservative on my fix.

Tobi,

The march=arm option would default to ARMv4, while mattr=+neon would force
NEON, but I'm not sure it would default to A8, which would be a weird
combination of ARM7TDMI+NEON.

There are two things to know at this point:

1. When the execution gets to resetSubtargetFeatures, what CPU has it
detected for your arguments. You may also have to look at ARM.td to see if
the CPU that it got detected has in its description the feature
"FeatureNEONForFP".

2. If the CPU is correct (Cortex-A*), and it's neither A5 nor A8, do we
still want to generate single-precision float on NEON when non-Darwin and
safe math? I don't think so. Possibly, that condition should be extended to
ignore the CPU you're using and *only* emit NEON SP-FP when either Darwin
or UnsafeMath are on.

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130607/5299507e/attachment.html>


More information about the llvm-dev mailing list