[PATCH] D18701: [ARM] Adding IEEE-754 SIMD detection to loop vectorizer

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 10:19:23 PDT 2016


rengolin created this revision.
rengolin added reviewers: hfinkel, aschwaighofer, jmolloy.
rengolin added subscribers: llvm-commits, grosser.
rengolin set the repository for this revision to rL LLVM.
Herald added subscribers: mzolotukhin, rengolin, aemerson.

Some SIMD implementations are not IEEE-754 compliant, for example ARM's NEON.

This patch teaches the loop vectorizer to only allow transformations of loops
that either contain no floating-point operations or have enough allowance
flags supporting lack of precision (ex. -ffast-math, Darwin).

For that, the target description now has a method which tells us if the
vectorizer is allowed to handle FP math without falling into unsafe
representations, plus a check on every FP instruction in the candidate loop
to check for the safety flags.

This commit makes LLVM behave like GCC with respect to ARM NEON support, but
it stops short of fixing the underlying problem: sub-normals. Neither GCC
nor LLVM have a flag for allowing sub-normal operations. Before this patch,
GCC only allows it using unsafe-math flags and LLVM allows it by default with
no way to turn it off (short of not using NEON at all).

As a first step, we push this change to make it safe and in sync with GCC.
The second step is to discuss a new sub-normal's flag on both communitues
and come up with a common solution. The third step is to improve the FastMath
flags in LLVM to encode sub-normals and use those flags to restrict NEON FP.

Fixes PR16275.


Repository:
  rL LLVM

http://reviews.llvm.org/D18701

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/Target/ARM/ARMTargetTransformInfo.h
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/ARM/arm-ieee-vectorize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18701.52391.patch
Type: text/x-patch
Size: 19251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160401/88c088fa/attachment.bin>


More information about the llvm-commits mailing list