[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:51:48 PDT 2026


================
@@ -4,7 +4,7 @@
 define <2 x double> @maxpd(<2 x double> %x, <2 x double> %y) {
 ; CHECK-LABEL: maxpd:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    vmaxpd %xmm1, %xmm0, %xmm0
+; CHECK-NEXT:    vmaxpd %xmm0, %xmm1, %xmm0
----------------
nikic wrote:

I *think* this is correct? If I understand correctly, the AT&T syntax here is vmaxpd src2, src1, dst (WTF?) so this is actually a MAX(xmm1, xmm0) operation. So if we have xmm0=0.0, xmm1=-0.0 then this will return 0.0, while the previous order returned -0.0. The 0.0 return matches the IR.

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


More information about the llvm-commits mailing list