[llvm] Revert "[X86] combineCMov - fold CMOV(LOAD(PTR0),LOAD(PTR1)) -> LOAD(CMOV(PTR0,PTR1))" (PR #182545)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 09:29:47 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Simon Pilgrim (RKSimon)
<details>
<summary>Changes</summary>
Reverts llvm/llvm-project#<!-- -->182084 / e80e9405f91e35783d0cbc8f492af0684ec1a758
Investigating reports of regressions from the flang rocm teams
---
Patch is 41.14 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/182545.diff
8 Files Affected:
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (-31)
- (modified) llvm/test/CodeGen/X86/cmov-fp.ll (+444-172)
- (modified) llvm/test/CodeGen/X86/dagcombine-select.ll (+18-12)
- (modified) llvm/test/CodeGen/X86/fdiv-combine.ll (+6-4)
- (modified) llvm/test/CodeGen/X86/fp128-select.ll (+7-3)
- (modified) llvm/test/CodeGen/X86/hoist-and-by-const-from-shl-in-eqcmp-zero.ll (+7-4)
- (modified) llvm/test/CodeGen/X86/select_const.ll (+22-14)
- (modified) llvm/test/CodeGen/X86/sse-load-ret.ll (+20-5)
``````````diff
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1bf969db93ee0..447dcac0c5d9b 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -49944,37 +49944,6 @@ static SDValue combineCMov(SDNode *N, SelectionDAG &DAG,
}
}
- // Attempt to fold CMOV(LOAD(PTR0),LOAD(PTR1)) -> LOAD(CMOV(PTR0,PTR1))
- // TODO: Allow matching extloads?
- if (TrueOp.getResNo() == 0 && ISD::isNormalLoad(TrueOp.getNode()) &&
- FalseOp.getResNo() == 0 && ISD::isNormalLoad(FalseOp.getNode()) &&
- TrueOp.hasOneUse() && FalseOp.hasOneUse()) {
- auto *TrueLd = cast<LoadSDNode>(TrueOp);
- auto *FalseLd = cast<LoadSDNode>(FalseOp);
- // Ensure the loads and pointers are as similar as possible.
- EVT PtrVT = FalseLd->getBasePtr().getValueType();
- if (TrueLd->getChain() == FalseLd->getChain() &&
- TrueLd->getPointerInfo().getAddrSpace() ==
- FalseLd->getPointerInfo().getAddrSpace() &&
- TrueLd->getMemOperand()->getFlags() ==
- FalseLd->getMemOperand()->getFlags() &&
- TrueLd->isSimple() && FalseLd->isSimple() &&
- !TrueLd->isPredecessorOf(Cond.getNode()) &&
- !FalseLd->isPredecessorOf(Cond.getNode())) {
- SDValue Ops[] = {FalseLd->getBasePtr(), TrueLd->getBasePtr(),
- DAG.getTargetConstant(CC, DL, MVT::i8), Cond};
- SDValue NewPtr = DAG.getNode(X86ISD::CMOV, DL, PtrVT, Ops);
- SDValue NewLd = DAG.getLoad(
- VT, DL, FalseLd->getChain(), NewPtr,
- MachinePointerInfo(FalseLd->getPointerInfo().getAddrSpace()),
- std::min(FalseLd->getAlign(), TrueLd->getAlign()),
- FalseLd->getMemOperand()->getFlags());
- DAG.makeEquivalentMemoryOrdering(TrueLd, NewLd);
- DAG.makeEquivalentMemoryOrdering(FalseLd, NewLd);
- return NewLd;
- }
- }
-
// If this is a select between two integer constants, try to do some
// optimizations. Note that the operands are ordered the opposite of SELECT
// operands.
diff --git a/llvm/test/CodeGen/X86/cmov-fp.ll b/llvm/test/CodeGen/X86/cmov-fp.ll
index 8054436c1f015..77665d083b7e3 100644
--- a/llvm/test/CodeGen/X86/cmov-fp.ll
+++ b/llvm/test/CodeGen/X86/cmov-fp.ll
@@ -8,12 +8,23 @@
define double @test1(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test1:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmoval %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: ja .LBB0_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB0_3
+; SSE-NEXT: .LBB0_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB0_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test1:
@@ -49,12 +60,23 @@ define double @test1(i32 %a, i32 %b, double %x) nounwind {
define double @test2(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test2:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovael %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jae .LBB1_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB1_3
+; SSE-NEXT: .LBB1_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB1_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test2:
@@ -90,12 +112,23 @@ define double @test2(i32 %a, i32 %b, double %x) nounwind {
define double @test3(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test3:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovbl %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jb .LBB2_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB2_3
+; SSE-NEXT: .LBB2_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB2_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test3:
@@ -131,12 +164,23 @@ define double @test3(i32 %a, i32 %b, double %x) nounwind {
define double @test4(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test4:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovbel %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jbe .LBB3_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB3_3
+; SSE-NEXT: .LBB3_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB3_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test4:
@@ -172,12 +216,23 @@ define double @test4(i32 %a, i32 %b, double %x) nounwind {
define double @test5(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test5:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovgl %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jg .LBB4_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB4_3
+; SSE-NEXT: .LBB4_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB4_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test5:
@@ -215,12 +270,23 @@ define double @test5(i32 %a, i32 %b, double %x) nounwind {
define double @test6(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test6:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovgel %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jge .LBB5_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB5_3
+; SSE-NEXT: .LBB5_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB5_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test6:
@@ -258,12 +324,23 @@ define double @test6(i32 %a, i32 %b, double %x) nounwind {
define double @test7(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test7:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovll %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jl .LBB6_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB6_3
+; SSE-NEXT: .LBB6_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB6_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test7:
@@ -301,12 +378,23 @@ define double @test7(i32 %a, i32 %b, double %x) nounwind {
define double @test8(i32 %a, i32 %b, double %x) nounwind {
; SSE-LABEL: test8:
; SSE: # %bb.0:
-; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovlel %eax, %ecx
-; SSE-NEXT: fldl (%ecx)
+; SSE-NEXT: pushl %ebp
+; SSE-NEXT: movl %esp, %ebp
+; SSE-NEXT: andl $-8, %esp
+; SSE-NEXT: subl $8, %esp
+; SSE-NEXT: movl 8(%ebp), %eax
+; SSE-NEXT: cmpl 12(%ebp), %eax
+; SSE-NEXT: jle .LBB7_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE-NEXT: jmp .LBB7_3
+; SSE-NEXT: .LBB7_1:
+; SSE-NEXT: movsd {{.*#+}} xmm0 = [9.9E+1,0.0E+0]
+; SSE-NEXT: .LBB7_3:
+; SSE-NEXT: movsd %xmm0, (%esp)
+; SSE-NEXT: fldl (%esp)
+; SSE-NEXT: movl %ebp, %esp
+; SSE-NEXT: popl %ebp
; SSE-NEXT: retl
;
; NOSSE-LABEL: test8:
@@ -344,34 +432,62 @@ define double @test8(i32 %a, i32 %b, double %x) nounwind {
define float @test9(i32 %a, i32 %b, float %x) nounwind {
; SSE-LABEL: test9:
; SSE: # %bb.0:
+; SSE-NEXT: pushl %eax
; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmoval %eax, %ecx
-; SSE-NEXT: flds (%ecx)
+; SSE-NEXT: ja .LBB8_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE-NEXT: jmp .LBB8_3
+; SSE-NEXT: .LBB8_1:
+; SSE-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; SSE-NEXT: .LBB8_3:
+; SSE-NEXT: movss %xmm0, (%esp)
+; SSE-NEXT: flds (%esp)
+; SSE-NEXT: popl %eax
; SSE-NEXT: retl
;
-; NOSSE-LABEL: test9:
-; NOSSE: # %bb.0:
-; NOSSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; NOSSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; NOSSE-NEXT: cmoval %eax, %ecx
-; NOSSE-NEXT: flds (%ecx)
-; NOSSE-NEXT: retl
+; NOSSE2-LABEL: test9:
+; NOSSE2: # %bb.0:
+; NOSSE2-NEXT: pushl %eax
+; NOSSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: ja .LBB8_1
+; NOSSE2-NEXT: # %bb.2:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; NOSSE2-NEXT: jmp .LBB8_3
+; NOSSE2-NEXT: .LBB8_1:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; NOSSE2-NEXT: .LBB8_3:
+; NOSSE2-NEXT: movss %xmm0, (%esp)
+; NOSSE2-NEXT: flds (%esp)
+; NOSSE2-NEXT: popl %eax
+; NOSSE2-NEXT: retl
+;
+; NOSSE1-LABEL: test9:
+; NOSSE1: # %bb.0:
+; NOSSE1-NEXT: flds {{[0-9]+}}(%esp)
+; NOSSE1-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE1-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE1-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
+; NOSSE1-NEXT: fxch %st(1)
+; NOSSE1-NEXT: fcmovnbe %st(1), %st
+; NOSSE1-NEXT: fstp %st(1)
+; NOSSE1-NEXT: retl
;
; NOCMOV-LABEL: test9:
; NOCMOV: # %bb.0:
+; NOCMOV-NEXT: flds {{[0-9]+}}(%esp)
; NOCMOV-NEXT: movl {{[0-9]+}}(%esp), %eax
; NOCMOV-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOCMOV-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
+; NOCMOV-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
; NOCMOV-NEXT: ja .LBB8_2
; NOCMOV-NEXT: # %bb.1:
-; NOCMOV-NEXT: leal {{[0-9]+}}(%esp), %eax
+; NOCMOV-NEXT: fstp %st(0)
+; NOCMOV-NEXT: fldz
+; NOCMOV-NEXT: fxch %st(1)
; NOCMOV-NEXT: .LBB8_2:
-; NOCMOV-NEXT: flds (%eax)
+; NOCMOV-NEXT: fstp %st(1)
; NOCMOV-NEXT: retl
%cmp = icmp ugt i32 %a, %b
%sel = select i1 %cmp, float 99.0, float %x
@@ -381,34 +497,62 @@ define float @test9(i32 %a, i32 %b, float %x) nounwind {
define float @test10(i32 %a, i32 %b, float %x) nounwind {
; SSE-LABEL: test10:
; SSE: # %bb.0:
+; SSE-NEXT: pushl %eax
; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovael %eax, %ecx
-; SSE-NEXT: flds (%ecx)
+; SSE-NEXT: jae .LBB9_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE-NEXT: jmp .LBB9_3
+; SSE-NEXT: .LBB9_1:
+; SSE-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; SSE-NEXT: .LBB9_3:
+; SSE-NEXT: movss %xmm0, (%esp)
+; SSE-NEXT: flds (%esp)
+; SSE-NEXT: popl %eax
; SSE-NEXT: retl
;
-; NOSSE-LABEL: test10:
-; NOSSE: # %bb.0:
-; NOSSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; NOSSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; NOSSE-NEXT: cmovael %eax, %ecx
-; NOSSE-NEXT: flds (%ecx)
-; NOSSE-NEXT: retl
+; NOSSE2-LABEL: test10:
+; NOSSE2: # %bb.0:
+; NOSSE2-NEXT: pushl %eax
+; NOSSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: jae .LBB9_1
+; NOSSE2-NEXT: # %bb.2:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; NOSSE2-NEXT: jmp .LBB9_3
+; NOSSE2-NEXT: .LBB9_1:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; NOSSE2-NEXT: .LBB9_3:
+; NOSSE2-NEXT: movss %xmm0, (%esp)
+; NOSSE2-NEXT: flds (%esp)
+; NOSSE2-NEXT: popl %eax
+; NOSSE2-NEXT: retl
+;
+; NOSSE1-LABEL: test10:
+; NOSSE1: # %bb.0:
+; NOSSE1-NEXT: flds {{[0-9]+}}(%esp)
+; NOSSE1-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE1-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE1-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
+; NOSSE1-NEXT: fxch %st(1)
+; NOSSE1-NEXT: fcmovnb %st(1), %st
+; NOSSE1-NEXT: fstp %st(1)
+; NOSSE1-NEXT: retl
;
; NOCMOV-LABEL: test10:
; NOCMOV: # %bb.0:
+; NOCMOV-NEXT: flds {{[0-9]+}}(%esp)
; NOCMOV-NEXT: movl {{[0-9]+}}(%esp), %eax
; NOCMOV-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOCMOV-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
+; NOCMOV-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
; NOCMOV-NEXT: jae .LBB9_2
; NOCMOV-NEXT: # %bb.1:
-; NOCMOV-NEXT: leal {{[0-9]+}}(%esp), %eax
+; NOCMOV-NEXT: fstp %st(0)
+; NOCMOV-NEXT: fldz
+; NOCMOV-NEXT: fxch %st(1)
; NOCMOV-NEXT: .LBB9_2:
-; NOCMOV-NEXT: flds (%eax)
+; NOCMOV-NEXT: fstp %st(1)
; NOCMOV-NEXT: retl
%cmp = icmp uge i32 %a, %b
%sel = select i1 %cmp, float 99.0, float %x
@@ -418,34 +562,62 @@ define float @test10(i32 %a, i32 %b, float %x) nounwind {
define float @test11(i32 %a, i32 %b, float %x) nounwind {
; SSE-LABEL: test11:
; SSE: # %bb.0:
+; SSE-NEXT: pushl %eax
; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovbl %eax, %ecx
-; SSE-NEXT: flds (%ecx)
+; SSE-NEXT: jb .LBB10_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE-NEXT: jmp .LBB10_3
+; SSE-NEXT: .LBB10_1:
+; SSE-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; SSE-NEXT: .LBB10_3:
+; SSE-NEXT: movss %xmm0, (%esp)
+; SSE-NEXT: flds (%esp)
+; SSE-NEXT: popl %eax
; SSE-NEXT: retl
;
-; NOSSE-LABEL: test11:
-; NOSSE: # %bb.0:
-; NOSSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; NOSSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; NOSSE-NEXT: cmovbl %eax, %ecx
-; NOSSE-NEXT: flds (%ecx)
-; NOSSE-NEXT: retl
+; NOSSE2-LABEL: test11:
+; NOSSE2: # %bb.0:
+; NOSSE2-NEXT: pushl %eax
+; NOSSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: jb .LBB10_1
+; NOSSE2-NEXT: # %bb.2:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; NOSSE2-NEXT: jmp .LBB10_3
+; NOSSE2-NEXT: .LBB10_1:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; NOSSE2-NEXT: .LBB10_3:
+; NOSSE2-NEXT: movss %xmm0, (%esp)
+; NOSSE2-NEXT: flds (%esp)
+; NOSSE2-NEXT: popl %eax
+; NOSSE2-NEXT: retl
+;
+; NOSSE1-LABEL: test11:
+; NOSSE1: # %bb.0:
+; NOSSE1-NEXT: flds {{[0-9]+}}(%esp)
+; NOSSE1-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE1-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE1-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
+; NOSSE1-NEXT: fxch %st(1)
+; NOSSE1-NEXT: fcmovb %st(1), %st
+; NOSSE1-NEXT: fstp %st(1)
+; NOSSE1-NEXT: retl
;
; NOCMOV-LABEL: test11:
; NOCMOV: # %bb.0:
+; NOCMOV-NEXT: flds {{[0-9]+}}(%esp)
; NOCMOV-NEXT: movl {{[0-9]+}}(%esp), %eax
; NOCMOV-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOCMOV-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
+; NOCMOV-NEXT: flds {{\.?LCPI[0-9]+_[0-9]+}}
; NOCMOV-NEXT: jb .LBB10_2
; NOCMOV-NEXT: # %bb.1:
-; NOCMOV-NEXT: leal {{[0-9]+}}(%esp), %eax
+; NOCMOV-NEXT: fstp %st(0)
+; NOCMOV-NEXT: fldz
+; NOCMOV-NEXT: fxch %st(1)
; NOCMOV-NEXT: .LBB10_2:
-; NOCMOV-NEXT: flds (%eax)
+; NOCMOV-NEXT: fstp %st(1)
; NOCMOV-NEXT: retl
%cmp = icmp ult i32 %a, %b
%sel = select i1 %cmp, float 99.0, float %x
@@ -455,34 +627,62 @@ define float @test11(i32 %a, i32 %b, float %x) nounwind {
define float @test12(i32 %a, i32 %b, float %x) nounwind {
; SSE-LABEL: test12:
; SSE: # %bb.0:
+; SSE-NEXT: pushl %eax
; SSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
; SSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; SSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; SSE-NEXT: cmovbel %eax, %ecx
-; SSE-NEXT: flds (%ecx)
+; SSE-NEXT: jbe .LBB11_1
+; SSE-NEXT: # %bb.2:
+; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; SSE-NEXT: jmp .LBB11_3
+; SSE-NEXT: .LBB11_1:
+; SSE-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; SSE-NEXT: .LBB11_3:
+; SSE-NEXT: movss %xmm0, (%esp)
+; SSE-NEXT: flds (%esp)
+; SSE-NEXT: popl %eax
; SSE-NEXT: retl
;
-; NOSSE-LABEL: test12:
-; NOSSE: # %bb.0:
-; NOSSE-NEXT: movl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: cmpl {{[0-9]+}}(%esp), %eax
-; NOSSE-NEXT: movl ${{\.?LCPI[0-9]+_[0-9]+}}, %eax
-; NOSSE-NEXT: leal {{[0-9]+}}(%esp), %ecx
-; NOSSE-NEXT: cmovbel %eax, %ecx
-; NOSSE-NEXT: flds (%ecx)
-; NOSSE-NEXT: retl
+; NOSSE2-LABEL: test12:
+; NOSSE2: # %bb.0:
+; NOSSE2-NEXT: pushl %eax
+; NOSSE2-NEXT: movl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: cmpl {{[0-9]+}}(%esp), %eax
+; NOSSE2-NEXT: jbe .LBB11_1
+; NOSSE2-NEXT: # %bb.2:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; NOSSE2-NEXT: jmp .LBB11_3
+; NOSSE2-NEXT: .LBB11_1:
+; NOSSE2-NEXT: movss {{.*#+}} xmm0 = [9.9E+1,0.0E+0,0.0E+0,0.0E+0]
+; NOSSE2-NEXT: .LBB11_3:
+; NOSSE2-NEXT: movss %xmm0, (%esp)
+; NOSSE2-NEXT: flds (%esp)
+; NOSSE2-NEXT: popl %eax
+; NOSSE2-NEXT: retl
+;
+; NOSSE1-LABEL: test12:
+; NOSSE1: # %bb.0:
+; NOSSE1-NEXT: flds {{...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/182545
More information about the llvm-commits
mailing list