[PATCH] D118126: Correct instcombine of fcmp+select.
Christian Sigg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 04:46:30 PST 2022
csigg created this revision.
Herald added subscribers: sanjoy.google, hiraditya.
csigg requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
1. Zero fcmp arguments were previously replaced with zero select arguments without considering or adjusting the predicate. However, without no-signed-zeros, only the following are equivalent:
>= +0 <=> > -0
<= -0 <=> < +0
-0 >= <=> +0 >
+0 <= <=> -0 <
2. Combining fcmp+select into fminnum is not permitted when the arguments might be two zeros of opposite sign. E.g., fminnum(-0, +0) can return any of the two operands and is therefore not equivalent to '-0 < +0 ? -0 : +0'. This was handled for >= and <= but marked as 'FIXME' for > and <.
3. fminimum does treat -0 as smaller than +0, so fcmp+select can be combined if the NaN-propagating bahaviour of fminimum is permitted. Previously, the handling of signed zeros applied to combining fcmp+select into both fminnum and fminimum.
The same applies for fmaxnum/fmaximum.
Hopefully 3) can make up for the performance lost by fixing 1) and 2).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118126
Files:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/CodeGen/AArch64/arm64-fmax-safe.ll
llvm/test/CodeGen/AArch64/arm64-fmax.ll
llvm/test/CodeGen/ARM/fp16-vminmaxnm-safe.ll
llvm/test/CodeGen/ARM/neon_minmax.ll
llvm/test/CodeGen/ARM/vminmaxnm-safe.ll
llvm/test/Transforms/InstCombine/minmax-fp.ll
llvm/unittests/Analysis/ValueTrackingTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118126.402853.patch
Type: text/x-patch
Size: 12947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220125/dc48f4be/attachment.bin>
More information about the llvm-commits
mailing list