[llvm] [X86] Prefer carry to overflow flag when using multiplication (PR #221611)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 6 15:21:07 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: AZero13 (AZero13)

<details>
<summary>Changes</summary>

For all possible MUL/IMUL it will always output CF==OF, and CF is better folding.

---

Patch is 70.87 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/221611.diff


19 Files Affected:

- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+2-2) 
- (modified) llvm/test/CodeGen/X86/2009-06-06-ConcatVectors.ll (+1) 
- (modified) llvm/test/CodeGen/X86/apx/flags-copy-lowering.ll (+1-1) 
- (modified) llvm/test/CodeGen/X86/codegen-prepare-replacephi.mir (+1-1) 
- (modified) llvm/test/CodeGen/X86/codegen-prepare-replacephi2.mir (+1-1) 
- (modified) llvm/test/CodeGen/X86/overflow-intrinsic-setcc-fold.ll (+4-4) 
- (modified) llvm/test/CodeGen/X86/select-lea.ll (+12-12) 
- (modified) llvm/test/CodeGen/X86/smul-with-overflow.ll (+4-4) 
- (modified) llvm/test/CodeGen/X86/smul_fix_sat.ll (+9-9) 
- (modified) llvm/test/CodeGen/X86/smul_fix_sat_constants.ll (+1-1) 
- (modified) llvm/test/CodeGen/X86/umul-with-carry.ll (+1-1) 
- (modified) llvm/test/CodeGen/X86/umul-with-overflow.ll (+2-2) 
- (modified) llvm/test/CodeGen/X86/umul_fix_sat.ll (+11-11) 
- (modified) llvm/test/CodeGen/X86/umulo-128-legalisation-lowering.ll (+6-6) 
- (modified) llvm/test/CodeGen/X86/umulo-64-legalisation-lowering.ll (+2-2) 
- (modified) llvm/test/CodeGen/X86/vec_smulo.ll (+11-12) 
- (modified) llvm/test/CodeGen/X86/vec_umulo.ll (+35-36) 
- (modified) llvm/test/CodeGen/X86/vshift_scalar.ll (+1) 
- (modified) llvm/test/CodeGen/X86/xmulo.ll (+167-135) 


``````````diff
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 85ed922c9a779..610d8bc6641b6 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -25384,11 +25384,11 @@ getX86XALUOOp(X86::CondCode &Cond, SDValue Op, SelectionDAG &DAG) {
     break;
   case ISD::SMULO:
     BaseOp = X86ISD::SMUL;
-    Cond = X86::COND_O;
+    Cond = X86::COND_B; // X86 sets CF and OF to the same value during multiply.
     break;
   case ISD::UMULO:
     BaseOp = X86ISD::UMUL;
-    Cond = X86::COND_O;
+    Cond = X86::COND_B; // X86 sets CF and OF to the same value during multiply.
     break;
   }
 
diff --git a/llvm/test/CodeGen/X86/2009-06-06-ConcatVectors.ll b/llvm/test/CodeGen/X86/2009-06-06-ConcatVectors.ll
index e26a8608a4960..31d0ab02e734d 100644
--- a/llvm/test/CodeGen/X86/2009-06-06-ConcatVectors.ll
+++ b/llvm/test/CodeGen/X86/2009-06-06-ConcatVectors.ll
@@ -1,6 +1,7 @@
 ; RUN: llc < %s
 ; REQUIRES: default_triple
 
+target triple = "x86_64-unknown-linux-gnu"
 define <2 x i64> @_mm_movpi64_pi64(<1 x i64> %a, <1 x i64> %b) nounwind readnone {
 entry:
   %0 = shufflevector <1 x i64> %a, <1 x i64> %b, <2 x i32> <i32 0, i32 1>
diff --git a/llvm/test/CodeGen/X86/apx/flags-copy-lowering.ll b/llvm/test/CodeGen/X86/apx/flags-copy-lowering.ll
index 357126bff417d..a4766d570a253 100644
--- a/llvm/test/CodeGen/X86/apx/flags-copy-lowering.ll
+++ b/llvm/test/CodeGen/X86/apx/flags-copy-lowering.ll
@@ -10,7 +10,7 @@ define i32 @flag_copy_1(i32 %x, i32 %y, ptr %pz) nounwind {
 ; CHECK-NEXT:    mull %esi
 ; CHECK-NEXT:    movl (%rcx), %ecx
 ; CHECK-NEXT:    {nf} addl %eax, %ecx
-; CHECK-NEXT:    cmovol %ecx, %eax
+; CHECK-NEXT:    cmovbl %ecx, %eax
 ; CHECK-NEXT:    retq
   %o = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %x, i32 %y)
   %v1 = extractvalue { i32, i1 } %o, 1
diff --git a/llvm/test/CodeGen/X86/codegen-prepare-replacephi.mir b/llvm/test/CodeGen/X86/codegen-prepare-replacephi.mir
index 13f3f3ad4187f..178045d1d63ee 100644
--- a/llvm/test/CodeGen/X86/codegen-prepare-replacephi.mir
+++ b/llvm/test/CodeGen/X86/codegen-prepare-replacephi.mir
@@ -1,4 +1,4 @@
-# RUN: llc -run-pass=codegenprepare -o - %s | FileCheck %s
+# RUN: llc -run-pass=codegenprepare -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s
 
 # REQUIRES: default_triple
 
diff --git a/llvm/test/CodeGen/X86/codegen-prepare-replacephi2.mir b/llvm/test/CodeGen/X86/codegen-prepare-replacephi2.mir
index e93e04bfd443e..a73ff0ceffdf2 100644
--- a/llvm/test/CodeGen/X86/codegen-prepare-replacephi2.mir
+++ b/llvm/test/CodeGen/X86/codegen-prepare-replacephi2.mir
@@ -1,4 +1,4 @@
-# RUN: llc -run-pass=codegenprepare -o - %s | FileCheck %s
+# RUN: llc -run-pass=codegenprepare -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s
 
 # REQUIRES: default_triple
 
diff --git a/llvm/test/CodeGen/X86/overflow-intrinsic-setcc-fold.ll b/llvm/test/CodeGen/X86/overflow-intrinsic-setcc-fold.ll
index 1f26933e24bcf..f467bcc224b02 100644
--- a/llvm/test/CodeGen/X86/overflow-intrinsic-setcc-fold.ll
+++ b/llvm/test/CodeGen/X86/overflow-intrinsic-setcc-fold.ll
@@ -109,7 +109,7 @@ define i1 @smulo_not_i32(i32 %v1, i32 %v2) {
 ; CHECK-LABEL: smulo_not_i32:
 ; CHECK:       ## %bb.0: ## %entry
 ; CHECK-NEXT:    imull %esi, %edi
-; CHECK-NEXT:    setno %al
+; CHECK-NEXT:    setae %al
 ; CHECK-NEXT:    retq
 entry:
   %t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %v1, i32 %v2)
@@ -122,7 +122,7 @@ define i1 @smulo_not_i64(i64 %v1, i64 %v2) {
 ; CHECK-LABEL: smulo_not_i64:
 ; CHECK:       ## %bb.0: ## %entry
 ; CHECK-NEXT:    imulq %rsi, %rdi
-; CHECK-NEXT:    setno %al
+; CHECK-NEXT:    setae %al
 ; CHECK-NEXT:    retq
 entry:
   %t = call {i64, i1} @llvm.smul.with.overflow.i64(i64 %v1, i64 %v2)
@@ -136,7 +136,7 @@ define i1 @umulo_not_i32(i32 %v1, i32 %v2) {
 ; CHECK:       ## %bb.0: ## %entry
 ; CHECK-NEXT:    movl %edi, %eax
 ; CHECK-NEXT:    mull %esi
-; CHECK-NEXT:    setno %al
+; CHECK-NEXT:    setae %al
 ; CHECK-NEXT:    retq
 entry:
   %t = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %v1, i32 %v2)
@@ -150,7 +150,7 @@ define i1 @umulo_not_i64(i64 %v1, i64 %v2) {
 ; CHECK:       ## %bb.0: ## %entry
 ; CHECK-NEXT:    movq %rdi, %rax
 ; CHECK-NEXT:    mulq %rsi
-; CHECK-NEXT:    setno %al
+; CHECK-NEXT:    setae %al
 ; CHECK-NEXT:    retq
 entry:
   %t = call {i64, i1} @llvm.umul.with.overflow.i64(i64 %v1, i64 %v2)
diff --git a/llvm/test/CodeGen/X86/select-lea.ll b/llvm/test/CodeGen/X86/select-lea.ll
index c3435dad67974..62f6b8da6eb5e 100644
--- a/llvm/test/CodeGen/X86/select-lea.ll
+++ b/llvm/test/CodeGen/X86/select-lea.ll
@@ -333,7 +333,7 @@ define i32 @smul_add_imm(i32 %x, i32 %y) {
 ; X64-NEXT:    # kill: def $edi killed $edi def $rdi
 ; X64-NEXT:    imull %esi, %edi
 ; X64-NEXT:    leal 100(%rdi), %eax
-; X64-NEXT:    cmovnol %edi, %eax
+; X64-NEXT:    cmovael %edi, %eax
 ; X64-NEXT:    retq
 ;
 ; CMOV-LABEL: smul_add_imm:
@@ -341,14 +341,14 @@ define i32 @smul_add_imm(i32 %x, i32 %y) {
 ; CMOV-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; CMOV-NEXT:    imull {{[0-9]+}}(%esp), %ecx
 ; CMOV-NEXT:    leal 100(%ecx), %eax
-; CMOV-NEXT:    cmovnol %ecx, %eax
+; CMOV-NEXT:    cmovael %ecx, %eax
 ; CMOV-NEXT:    retl
 ;
 ; NOCMOV-LABEL: smul_add_imm:
 ; NOCMOV:       # %bb.0:
 ; NOCMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; NOCMOV-NEXT:    imull {{[0-9]+}}(%esp), %eax
-; NOCMOV-NEXT:    jno .LBB8_2
+; NOCMOV-NEXT:    jae .LBB8_2
 ; NOCMOV-NEXT:  # %bb.1:
 ; NOCMOV-NEXT:    addl $100, %eax
 ; NOCMOV-NEXT:  .LBB8_2:
@@ -368,7 +368,7 @@ define i32 @smul_add_load(i32 %x, i32 %y, ptr %pz) nounwind {
 ; X64-NEXT:    imull %esi, %eax
 ; X64-NEXT:    addl (%rdx), %eax
 ; X64-NEXT:    imull %esi, %edi
-; X64-NEXT:    cmovnol %edi, %eax
+; X64-NEXT:    cmovael %edi, %eax
 ; X64-NEXT:    retq
 ;
 ; CMOV-LABEL: smul_add_load:
@@ -381,7 +381,7 @@ define i32 @smul_add_load(i32 %x, i32 %y, ptr %pz) nounwind {
 ; CMOV-NEXT:    imull %edx, %esi
 ; CMOV-NEXT:    addl (%ecx), %esi
 ; CMOV-NEXT:    imull %edx, %eax
-; CMOV-NEXT:    cmovol %esi, %eax
+; CMOV-NEXT:    cmovbl %esi, %eax
 ; CMOV-NEXT:    popl %esi
 ; CMOV-NEXT:    retl
 ;
@@ -392,7 +392,7 @@ define i32 @smul_add_load(i32 %x, i32 %y, ptr %pz) nounwind {
 ; NOCMOV-NEXT:    movl %eax, %ecx
 ; NOCMOV-NEXT:    imull %edx, %ecx
 ; NOCMOV-NEXT:    imull %edx, %eax
-; NOCMOV-NEXT:    jno .LBB9_2
+; NOCMOV-NEXT:    jae .LBB9_2
 ; NOCMOV-NEXT:  # %bb.1:
 ; NOCMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; NOCMOV-NEXT:    addl (%eax), %ecx
@@ -415,7 +415,7 @@ define i32 @umul_add_imm(i32 %x, i32 %y) {
 ; X64-NEXT:    mull %esi
 ; X64-NEXT:    # kill: def $eax killed $eax def $rax
 ; X64-NEXT:    leal 100(%rax), %ecx
-; X64-NEXT:    cmovol %ecx, %eax
+; X64-NEXT:    cmovbl %ecx, %eax
 ; X64-NEXT:    # kill: def $eax killed $eax killed $rax
 ; X64-NEXT:    retq
 ;
@@ -424,14 +424,14 @@ define i32 @umul_add_imm(i32 %x, i32 %y) {
 ; CMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; CMOV-NEXT:    mull {{[0-9]+}}(%esp)
 ; CMOV-NEXT:    leal 100(%eax), %ecx
-; CMOV-NEXT:    cmovol %ecx, %eax
+; CMOV-NEXT:    cmovbl %ecx, %eax
 ; CMOV-NEXT:    retl
 ;
 ; NOCMOV-LABEL: umul_add_imm:
 ; NOCMOV:       # %bb.0:
 ; NOCMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; NOCMOV-NEXT:    mull {{[0-9]+}}(%esp)
-; NOCMOV-NEXT:    jno .LBB10_2
+; NOCMOV-NEXT:    jae .LBB10_2
 ; NOCMOV-NEXT:  # %bb.1:
 ; NOCMOV-NEXT:    addl $100, %eax
 ; NOCMOV-NEXT:  .LBB10_2:
@@ -450,7 +450,7 @@ define i32 @umul_add_load(i32 %x, i32 %y, ptr %pz) nounwind {
 ; X64-NEXT:    movq %rdx, %rcx
 ; X64-NEXT:    movl %edi, %eax
 ; X64-NEXT:    mull %esi
-; X64-NEXT:    seto %dl
+; X64-NEXT:    setb %dl
 ; X64-NEXT:    movl (%rcx), %ecx
 ; X64-NEXT:    addl %eax, %ecx
 ; X64-NEXT:    testb %dl, %dl
@@ -462,7 +462,7 @@ define i32 @umul_add_load(i32 %x, i32 %y, ptr %pz) nounwind {
 ; CMOV-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; CMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; CMOV-NEXT:    mull {{[0-9]+}}(%esp)
-; CMOV-NEXT:    seto %dl
+; CMOV-NEXT:    setb %dl
 ; CMOV-NEXT:    movl (%ecx), %ecx
 ; CMOV-NEXT:    addl %eax, %ecx
 ; CMOV-NEXT:    testb %dl, %dl
@@ -473,7 +473,7 @@ define i32 @umul_add_load(i32 %x, i32 %y, ptr %pz) nounwind {
 ; NOCMOV:       # %bb.0:
 ; NOCMOV-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; NOCMOV-NEXT:    mull {{[0-9]+}}(%esp)
-; NOCMOV-NEXT:    jno .LBB11_2
+; NOCMOV-NEXT:    jae .LBB11_2
 ; NOCMOV-NEXT:  # %bb.1:
 ; NOCMOV-NEXT:    movl {{[0-9]+}}(%esp), %ecx
 ; NOCMOV-NEXT:    addl (%ecx), %eax
diff --git a/llvm/test/CodeGen/X86/smul-with-overflow.ll b/llvm/test/CodeGen/X86/smul-with-overflow.ll
index df167338268c4..ca6c0c8092131 100644
--- a/llvm/test/CodeGen/X86/smul-with-overflow.ll
+++ b/llvm/test/CodeGen/X86/smul-with-overflow.ll
@@ -11,7 +11,7 @@ define i1 @test1(i32 %v1, i32 %v2) nounwind {
 ; X86-NEXT:    subl $12, %esp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    imull {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    jno .LBB0_1
+; X86-NEXT:    jae .LBB0_1
 ; X86-NEXT:  # %bb.2: # %overflow
 ; X86-NEXT:    movl $no, (%esp)
 ; X86-NEXT:    calll printf at PLT
@@ -31,7 +31,7 @@ define i1 @test1(i32 %v1, i32 %v2) nounwind {
 ; X64-NEXT:    pushq %rax
 ; X64-NEXT:    movl %edi, %eax
 ; X64-NEXT:    imull %esi, %eax
-; X64-NEXT:    jno .LBB0_1
+; X64-NEXT:    jae .LBB0_1
 ; X64-NEXT:  # %bb.2: # %overflow
 ; X64-NEXT:    movl $no, %edi
 ; X64-NEXT:    xorl %eax, %eax
@@ -68,7 +68,7 @@ define i1 @test2(i32 %v1, i32 %v2) nounwind {
 ; X86-NEXT:    subl $12, %esp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    imull {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    jno .LBB1_2
+; X86-NEXT:    jae .LBB1_2
 ; X86-NEXT:  # %bb.1: # %overflow
 ; X86-NEXT:    movl $no, (%esp)
 ; X86-NEXT:    calll printf at PLT
@@ -88,7 +88,7 @@ define i1 @test2(i32 %v1, i32 %v2) nounwind {
 ; X64-NEXT:    pushq %rax
 ; X64-NEXT:    movl %edi, %eax
 ; X64-NEXT:    imull %esi, %eax
-; X64-NEXT:    jno .LBB1_2
+; X64-NEXT:    jae .LBB1_2
 ; X64-NEXT:  # %bb.1: # %overflow
 ; X64-NEXT:    movl $no, %edi
 ; X64-NEXT:    xorl %eax, %eax
diff --git a/llvm/test/CodeGen/X86/smul_fix_sat.ll b/llvm/test/CodeGen/X86/smul_fix_sat.ll
index 69d5769709372..e713f33c6ceac 100644
--- a/llvm/test/CodeGen/X86/smul_fix_sat.ll
+++ b/llvm/test/CodeGen/X86/smul_fix_sat.ll
@@ -294,7 +294,7 @@ define i32 @func4(i32 %x, i32 %y) nounwind {
 ; X64-NEXT:    sets %al
 ; X64-NEXT:    addl $2147483647, %eax # imm = 0x7FFFFFFF
 ; X64-NEXT:    imull %esi, %edi
-; X64-NEXT:    cmovnol %edi, %eax
+; X64-NEXT:    cmovael %edi, %eax
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: func4:
@@ -308,7 +308,7 @@ define i32 @func4(i32 %x, i32 %y) nounwind {
 ; X86-NEXT:    sets %cl
 ; X86-NEXT:    addl $2147483647, %ecx # imm = 0x7FFFFFFF
 ; X86-NEXT:    imull %edx, %eax
-; X86-NEXT:    cmovol %ecx, %eax
+; X86-NEXT:    cmovbl %ecx, %eax
 ; X86-NEXT:    popl %esi
 ; X86-NEXT:    retl
   %tmp = call i32 @llvm.smul.fix.sat.i32(i32 %x, i32 %y, i32 0)
@@ -325,7 +325,7 @@ define i64 @func5(i64 %x, i64 %y) {
 ; X64-NEXT:    movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
 ; X64-NEXT:    addq %rcx, %rax
 ; X64-NEXT:    imulq %rsi, %rdi
-; X64-NEXT:    cmovnoq %rdi, %rax
+; X64-NEXT:    cmovaeq %rdi, %rax
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: func5:
@@ -424,7 +424,7 @@ define i4 @func6(i4 %x, i4 %y) nounwind {
 ; X64-NEXT:    # kill: def $al killed $al killed $eax
 ; X64-NEXT:    imulb %sil
 ; X64-NEXT:    movzbl %al, %eax
-; X64-NEXT:    cmovol %ecx, %eax
+; X64-NEXT:    cmovbl %ecx, %eax
 ; X64-NEXT:    sarb $4, %al
 ; X64-NEXT:    # kill: def $al killed $al killed $eax
 ; X64-NEXT:    retq
@@ -443,7 +443,7 @@ define i4 @func6(i4 %x, i4 %y) nounwind {
 ; X86-NEXT:    addl $127, %edx
 ; X86-NEXT:    imulb %cl
 ; X86-NEXT:    movzbl %al, %eax
-; X86-NEXT:    cmovol %edx, %eax
+; X86-NEXT:    cmovbl %edx, %eax
 ; X86-NEXT:    sarb $4, %al
 ; X86-NEXT:    # kill: def $al killed $al killed $eax
 ; X86-NEXT:    retl
@@ -503,7 +503,7 @@ define <4 x i32> @vec2(<4 x i32> %x, <4 x i32> %y) nounwind {
 ; X86-NEXT:    sets %al
 ; X86-NEXT:    addl $2147483647, %eax # imm = 0x7FFFFFFF
 ; X86-NEXT:    imull %edi, %ecx
-; X86-NEXT:    cmovol %eax, %ecx
+; X86-NEXT:    cmovbl %eax, %ecx
 ; X86-NEXT:    xorl %eax, %eax
 ; X86-NEXT:    movl %edx, %edi
 ; X86-NEXT:    xorl %ebx, %edi
@@ -511,7 +511,7 @@ define <4 x i32> @vec2(<4 x i32> %x, <4 x i32> %y) nounwind {
 ; X86-NEXT:    sets %al
 ; X86-NEXT:    addl $2147483647, %eax # imm = 0x7FFFFFFF
 ; X86-NEXT:    imull %ebx, %edx
-; X86-NEXT:    cmovol %eax, %edx
+; X86-NEXT:    cmovbl %eax, %edx
 ; X86-NEXT:    xorl %eax, %eax
 ; X86-NEXT:    movl %edi, %ebx
 ; X86-NEXT:    xorl %esi, %ebx
@@ -519,14 +519,14 @@ define <4 x i32> @vec2(<4 x i32> %x, <4 x i32> %y) nounwind {
 ; X86-NEXT:    sets %al
 ; X86-NEXT:    addl $2147483647, %eax # imm = 0x7FFFFFFF
 ; X86-NEXT:    imull %esi, %edi
-; X86-NEXT:    cmovol %eax, %edi
+; X86-NEXT:    cmovbl %eax, %edi
 ; X86-NEXT:    xorl %eax, %eax
 ; X86-NEXT:    movl %ebx, %esi
 ; X86-NEXT:    xorl %ebp, %esi
 ; X86-NEXT:    sets %al
 ; X86-NEXT:    addl $2147483647, %eax # imm = 0x7FFFFFFF
 ; X86-NEXT:    imull %ebp, %ebx
-; X86-NEXT:    cmovol %eax, %ebx
+; X86-NEXT:    cmovbl %eax, %ebx
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    movl %ebx, 12(%eax)
 ; X86-NEXT:    movl %edi, 8(%eax)
diff --git a/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll b/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll
index 7c1efa7c8b48a..5017838a4f265 100644
--- a/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll
+++ b/llvm/test/CodeGen/X86/smul_fix_sat_constants.ll
@@ -32,7 +32,7 @@ define i64 @func2() nounwind {
 ; X64-NEXT:    movl $3, %eax
 ; X64-NEXT:    imulq $2, %rax, %rcx
 ; X64-NEXT:    movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
-; X64-NEXT:    cmovnoq %rcx, %rax
+; X64-NEXT:    cmovaeq %rcx, %rax
 ; X64-NEXT:    retq
   %tmp = call i64 @llvm.smul.fix.sat.i64(i64 3, i64 2, i32 0)
   ret i64 %tmp
diff --git a/llvm/test/CodeGen/X86/umul-with-carry.ll b/llvm/test/CodeGen/X86/umul-with-carry.ll
index 787ce2fc57d73..4b253728b22f7 100644
--- a/llvm/test/CodeGen/X86/umul-with-carry.ll
+++ b/llvm/test/CodeGen/X86/umul-with-carry.ll
@@ -11,7 +11,7 @@ define i1 @func(i32 %v1, i32 %v2) nounwind {
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; CHECK-NEXT:    mull {{[0-9]+}}(%esp)
-; CHECK-NEXT:    jno .LBB0_1
+; CHECK-NEXT:    jae .LBB0_1
 ; CHECK-NEXT:  # %bb.2: # %carry
 ; CHECK-NEXT:    pushl $no
 ; CHECK-NEXT:    calll printf at PLT
diff --git a/llvm/test/CodeGen/X86/umul-with-overflow.ll b/llvm/test/CodeGen/X86/umul-with-overflow.ll
index ccabb360a990c..3796a2a2eacdf 100644
--- a/llvm/test/CodeGen/X86/umul-with-overflow.ll
+++ b/llvm/test/CodeGen/X86/umul-with-overflow.ll
@@ -9,7 +9,7 @@ define zeroext i1 @a(i32 %x)  nounwind {
 ; X86:       # %bb.0:
 ; X86-NEXT:    movl $3, %eax
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
-; X86-NEXT:    seto %al
+; X86-NEXT:    setb %al
 ; X86-NEXT:    retl
 ;
 ; X64-LABEL: a:
@@ -17,7 +17,7 @@ define zeroext i1 @a(i32 %x)  nounwind {
 ; X64-NEXT:    movl %edi, %eax
 ; X64-NEXT:    movl $3, %ecx
 ; X64-NEXT:    mull %ecx
-; X64-NEXT:    seto %al
+; X64-NEXT:    setb %al
 ; X64-NEXT:    retq
   %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3)
   %obil = extractvalue {i32, i1} %res, 1
diff --git a/llvm/test/CodeGen/X86/umul_fix_sat.ll b/llvm/test/CodeGen/X86/umul_fix_sat.ll
index 9aff6a392d65d..ef6b0010ab2c8 100644
--- a/llvm/test/CodeGen/X86/umul_fix_sat.ll
+++ b/llvm/test/CodeGen/X86/umul_fix_sat.ll
@@ -211,7 +211,7 @@ define i32 @func4(i32 %x, i32 %y) nounwind {
 ; X64-NEXT:    movl %edi, %eax
 ; X64-NEXT:    mull %esi
 ; X64-NEXT:    movl $-1, %ecx
-; X64-NEXT:    cmovol %ecx, %eax
+; X64-NEXT:    cmovbl %ecx, %eax
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: func4:
@@ -219,7 +219,7 @@ define i32 @func4(i32 %x, i32 %y) nounwind {
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl $-1, %ecx
-; X86-NEXT:    cmovol %ecx, %eax
+; X86-NEXT:    cmovbl %ecx, %eax
 ; X86-NEXT:    retl
   %tmp = call i32 @llvm.umul.fix.sat.i32(i32 %x, i32 %y, i32 0)
   ret i32 %tmp
@@ -231,7 +231,7 @@ define i64 @func5(i64 %x, i64 %y) {
 ; X64-NEXT:    movq %rdi, %rax
 ; X64-NEXT:    mulq %rsi
 ; X64-NEXT:    movq $-1, %rcx
-; X64-NEXT:    cmovoq %rcx, %rax
+; X64-NEXT:    cmovbq %rcx, %rax
 ; X64-NEXT:    retq
 ;
 ; X86-LABEL: func5:
@@ -258,10 +258,10 @@ define i64 @func5(i64 %x, i64 %y) {
 ; X86-NEXT:    andb %dl, %cl
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl %eax, %edi
-; X86-NEXT:    seto %bl
+; X86-NEXT:    setb %bl
 ; X86-NEXT:    movl %esi, %eax
 ; X86-NEXT:    mull %ebp
-; X86-NEXT:    seto %ch
+; X86-NEXT:    setb %ch
 ; X86-NEXT:    orb %bl, %ch
 ; X86-NEXT:    orb %cl, %ch
 ; X86-NEXT:    leal (%edi,%eax), %esi
@@ -296,7 +296,7 @@ define i4 @func6(i4 %x, i4 %y) nounwind {
 ; X64-NEXT:    mulb %sil
 ; X64-NEXT:    movzbl %al, %ecx
 ; X64-NEXT:    movl $255, %eax
-; X64-NEXT:    cmovnol %ecx, %eax
+; X64-NEXT:    cmovael %ecx, %eax
 ; X64-NEXT:    shrb $4, %al
 ; X64-NEXT:    # kill: def $al killed $al killed $eax
 ; X64-NEXT:    retq
@@ -310,7 +310,7 @@ define i4 @func6(i4 %x, i4 %y) nounwind {
 ; X86-NEXT:    mulb %cl
 ; X86-NEXT:    movzbl %al, %ecx
 ; X86-NEXT:    movl $255, %eax
-; X86-NEXT:    cmovnol %ecx, %eax
+; X86-NEXT:    cmovael %ecx, %eax
 ; X86-NEXT:    shrb $4, %al
 ; X86-NEXT:    # kill: def $al killed $al killed $eax
 ; X86-NEXT:    retl
@@ -337,18 +337,18 @@ define <4 x i32> @vec2(<4 x i32> %x, <4 x i32> %y) nounwind {
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl %eax, %esi
 ; X86-NEXT:    movl $-1, %edi
-; X86-NEXT:    cmovol %edi, %esi
+; X86-NEXT:    cmovbl %edi, %esi
 ; X86-NEXT:    movl %ebx, %eax
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl %eax, %ebx
-; X86-NEXT:    cmovol %edi, %ebx
+; X86-NEXT:    cmovbl %edi, %ebx
 ; X86-NEXT:    movl %ebp, %eax
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
 ; X86-NEXT:    movl %eax, %ebp
-; X86-NEXT:    cmovol %edi, %ebp
+; X86-NEXT:    cmovbl %edi, %ebp
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    mull {{[0-9]+}}(%esp)
-; X86-NEXT:    cmovol %edi, %eax
+; X86-NEXT:    cmovbl %edi, %eax
 ; X86-NEXT:    movl %eax, 12(%ecx)
 ; X86-NEXT:    movl %ebp, 8(%ecx)
 ; X86-NEXT:    movl %ebx, 4(%ecx)
diff --git a/llvm/test/CodeGen/X86/umulo-128-legalisation-lowering.ll b/llvm/test/CodeGen/X86/umulo-128-legalisation-lowering.ll
index 89afd1b00444b..bc7e15a9aeeb2 100644
--- a/llvm/test/CodeGen/X86/umulo-128-legalisation-lowering.ll
+++ b/llvm/test/CodeGen/X86/umulo-128-legalisation-lowering.ll
@@ -14,10 +14,10 @@ define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
 ; X64-NEXT:    andb %dl, %r9b
 ; X64-NEXT:    mulq %r8
 ; X64-NEXT:    movq %rax, %rsi
-; X64-NEXT:    seto %r10b
+; X64-NEXT:    setb %r10b
 ; X64-NEXT:    movq %rcx, %rax
 ; X64-NEXT:    mulq %rdi
-; X64-NEXT:    seto %r11b
+; X64-NEXT:    setb %r11b
 ; X64-NEXT:    orb %r10b, %r11b
 ; X64-NEXT:    orb %r9b, %r11b
 ; X64-NEXT:    leaq (%rsi,%rax), %rcx
@@ -51,11 +51,11 @@ define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
 ; X86-NEXT:    mull %ebx
 ; X86-NEXT:    movl %eax, %ecx
-; X86-NEXT:    seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    movl %esi, %eax
 ; X86-NEXT:    mull %edi
 ; X86-NEXT:    leal (%ecx,%eax), %esi
-; X86-NEXT:    seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    movl %edi, %eax
 ; X86-NEXT:    mull %ebx
 ; X86-NEXT:    movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
@@ -66,13 +66,13 @@ define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
 ; X86-NEXT:    mull %edi
 ; X86-NEXT:    movl %eax, %esi
-; X86-NEXT:    seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ebx
 ; X86-NEXT:    movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
 ; X86-NEXT:    mull %ebx
 ; X86-NEXT:    leal (%esi,%eax), %esi
-; X86-NEXT:    seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
+; X86-NEXT:    setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
 ; X86-NEXT:    movl %ebx, %eax
 ; X86-NEXT:    mull %edi
 ; X86-NEXT:   ...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list