[PATCH] D149812: [X86] Avoid usage constant -1 for fminimum/fmaximum lowering
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 21:13:15 PDT 2023
skatkov created this revision.
skatkov added reviewers: RKSimon, pengfei, goldstein.w.n, e-kud.
Herald added a subscriber: hiraditya.
Herald added a project: All.
skatkov requested review of this revision.
Herald added a project: LLVM.
Instead of equality comparison of value to preferred zero we can check just
the sign of value and if sign is set we should put this value as second operand for minimum
and first operand for maximum.
In this case FMIN/FMAX will choose the right result for 0.f and -0.f comparison.
This allows us:
1. avoid loading of big 64-bit constant for fminimum.
2. for double on non-64-nit platform we need to check only high part of value.
3. test against zero to check sign takes less size of instruction
Additionally, if we know that any of value is guaranteed to be non-zero
we should not care about 0.f and -0.f comparison.
https://reviews.llvm.org/D149812
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/avx512fp16-fminimum-fmaximum.ll
llvm/test/CodeGen/X86/extractelement-fp.ll
llvm/test/CodeGen/X86/fminimum-fmaximum.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149812.519346.patch
Type: text/x-patch
Size: 27193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230504/45e64cd2/attachment.bin>
More information about the llvm-commits
mailing list