[all-commits] [llvm/llvm-project] 50cd2f: [X86] Avoid usage constant -1 for fminimum/fmaximu...
serguei-katkov via All-commits
all-commits at lists.llvm.org
Fri May 5 02:24:56 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 50cd2ff7bc5af557d23fb306dddaff794e22bb01
https://github.com/llvm/llvm-project/commit/50cd2ff7bc5af557d23fb306dddaff794e22bb01
Author: Serguei Katkov <serguei.katkov at azul.com>
Date: 2023-05-05 (Fri, 05 May 2023)
Changed paths:
M llvm/lib/Target/X86/X86ISelLowering.cpp
M llvm/test/CodeGen/X86/avx512fp16-fminimum-fmaximum.ll
M llvm/test/CodeGen/X86/extractelement-fp.ll
M llvm/test/CodeGen/X86/fminimum-fmaximum.ll
Log Message:
-----------
[X86] Avoid usage constant -1 for fminimum/fmaximum lowering
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-nib 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.
Reviewed By: e-kud
Differential Revision: https://reviews.llvm.org/D149812
More information about the All-commits
mailing list