[llvm] [X86] Fix fcmp+select to min/max lowering (PR #185594)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 01:59:47 PDT 2026


================
@@ -365,8 +365,11 @@ define double @ult_x(double %x)  {
 define double @ugt_inverse_x(double %x)  {
 ; CHECK-LABEL: ugt_inverse_x:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorpd %xmm1, %xmm1
-; CHECK-NEXT:    minsd %xmm1, %xmm0
+; CHECK-NEXT:    xorpd %xmm2, %xmm2
+; CHECK-NEXT:    movapd %xmm0, %xmm1
+; CHECK-NEXT:    cmpnlesd %xmm2, %xmm1
+; CHECK-NEXT:    andnpd %xmm0, %xmm1
+; CHECK-NEXT:    movapd %xmm1, %xmm0
----------------
nikic wrote:

Worth noting that this just undoes the change from #184590. The ValueTracking select pattern matching has some special casing for zero operands that I think is not compatible with backend assumptions. (This PR is part of removing the ValueTracking based minnum/maxnum formating in the SDAGBuilder entirely, so I haven't looked closely into the specifics.)

https://github.com/llvm/llvm-project/pull/185594


More information about the llvm-commits mailing list