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

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 21:05:26 PDT 2023


skatkov added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:30299
   // to ensure the correct zero is returned.
-  auto IsPreferredZero = [PreferredZero](SDValue Op) {
+  auto MatchesZero = [](SDValue Op, APInt PreferredZero) {
     Op = peekThroughBitcasts(Op);
----------------
goldstein.w.n wrote:
> nit: can you use a different variable name than `PreferredZero` as the value in the lambda doesn't always match whats in the outerscope.
Agreed. Thanks, Will use just Zero.


================
Comment at: llvm/test/CodeGen/X86/fminimum-fmaximum.ll:1140
 ; X86-NEXT:    retl
   %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> %x, <2 x double> <double 0., double 5.>)
   ret <2 x double> %r
----------------
e-kud wrote:
> I think this test shows that a predicate //is not preferred zero// should be more generic than // is opposite zero// (in context of constant vectors).
I will modify test to use constant 0.f and -0.f to cover both not a preferred zero and not an opposite zero.
The intention of the test is to check that even if any of operands is zero we need all of them zero of the same sign.


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

https://reviews.llvm.org/D150249



More information about the llvm-commits mailing list