[PATCH] D111077: [LV] Support converting FP add to integer reductions.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 10:06:18 PDT 2021


fhahn created this revision.
fhahn added reviewers: scanon, spatel, dmgreen, Ayal, gilr, kmclaughlin.
Herald added subscribers: rogfer01, hiraditya.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.

Floating point reductions that start at an integer value and only get
incremented by another positive integer value can be performed on
integers. The result then needs to be clamped by the maximum value value
with mantissa 1.0 (with the maximum exponent) times the step.

This approach has been suggested by @scanon.

One thing I am not sure about is if there is an API to get the
corresponding integer value of a APFloat, if it is an integer. The patch
does same manual matching against explicitly constructed APFloats.

Another thing to note is that the patch uses float->signed int/signed
int->float conversions. Should conversions to unsigned be used?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111077

Files:
  llvm/include/llvm/Analysis/IVDescriptors.h
  llvm/lib/Analysis/IVDescriptors.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/fadd-reduction-as-int.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111077.376935.patch
Type: text/x-patch
Size: 49110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211004/7e88aadb/attachment-0001.bin>


More information about the llvm-commits mailing list