[PATCH] D150249: [X86] Improve handling on zero constant for fminimum/fmaximum lowering

Evgenii Kudriashov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 08:44:59 PDT 2023


e-kud accepted this revision.
e-kud added a comment.
This revision is now accepted and ready to land.

Great! Thanks. LGTM.



================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:30300
   // to ensure the correct zero is returned.
-  auto IsPreferredZero = [PreferredZero](SDValue Op) {
+  auto MatchesZero = [](SDValue Op, APInt Zero) {
     Op = peekThroughBitcasts(Op);
----------------
It seems a little bit confusing for me that we generally do different things for vectors and scalars. Consider inputs `5.` and `<5., 5.>`: for the first we return false, for the second -- true. But I can't think of better naming explaining this behavior difference, or splitting into different lambdas.

In fact, there is no much difference whether we return true or false because non zero cases are covered by `isKnownNeverZeroFloat` calls.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150249/new/

https://reviews.llvm.org/D150249



More information about the llvm-commits mailing list