[PATCH] [ARM] Emit Tag_ABI_FP_denormal correctly in fast-math mode.

Charlie Turner charlie.turner at arm.com
Thu Nov 27 06:52:38 PST 2014


The default ARM floating-point mode does not support IEEE 754 mode exactly. Of relevance to this patch is that input denormals are flushed to zero. The way in which they're flushed to zero depends on the architecture,

  * For VFPv2, it is implementation defined as to whether the sign of zero is
    preserved.
  * For VFPv3 and above, the sign of zero is always preserved when a denormal
    is flushed to zero.

When hardware FP support has been disabled, the strategy taken by this patch is to assume the software support will mirror the behaviour of the hardware support for the target *if it existed*. That is, for architectures which can only have VFPv2, it is assumed the software will flush to positive zero. For later architectures it is assumed the software will flush to zero preserving sign.

The reason the current behaviour is wrong is because IEEE 754 support is enabled by default when using `-ffast-math`. In such a mode we should indicate we're flushing denormals according to the rules explained above.

As an aside in the test file, the reason I have chosen to have a <CPU NAME>-FAST check prefix for each CPU name, rather than to create a just a couple extra prefixes for denormals and tack them onto each command-line check is that there will be more tests for build attributes in fast maths mode, so these check prefixes won't be checking just one attribute for very long.

http://reviews.llvm.org/D6439

Files:
  include/llvm/Support/ARMBuildAttributes.h
  lib/Target/ARM/ARMAsmPrinter.cpp
  test/CodeGen/ARM/build-attributes.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6439.16694.patch
Type: text/x-patch
Size: 31812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141127/83716dc7/attachment.bin>


More information about the llvm-commits mailing list