[llvm] [X86][APX] Enable prefer-legacy-setcc tuning for Novalake and Diamondrapids (PR #202480)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 18:52:06 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Feng Zou (fzou1)

<details>
<summary>Changes</summary>

Performance measurements show legacy SetCC is still good on these platforms.

---

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


10 Files Affected:

- (modified) llvm/lib/Target/X86/X86.td (+6-2) 
- (modified) llvm/lib/Target/X86/X86FixupSetCC.cpp (+8-7) 
- (modified) llvm/test/CodeGen/X86/apx/ccmp.ll (+739-494) 
- (modified) llvm/test/CodeGen/X86/apx/ctest.ll (+585-427) 
- (modified) llvm/test/CodeGen/X86/apx/setzucc.ll (+92-50) 
- (modified) llvm/test/CodeGen/X86/fast-isel-fcmp.ll (+2) 
- (modified) llvm/test/CodeGen/X86/fast-isel-select-cmov2.ll (+2) 
- (modified) llvm/test/CodeGen/X86/pr27591.ll (+2) 
- (modified) llvm/test/CodeGen/X86/pr32284.ll (+22-12) 
- (modified) llvm/test/CodeGen/X86/pr54369.ll (+2) 


``````````diff
diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td
index 50fb7204ebfa1..9388ce0ca3d8e 100644
--- a/llvm/lib/Target/X86/X86.td
+++ b/llvm/lib/Target/X86/X86.td
@@ -1216,6 +1216,8 @@ def ProcessorFeatures {
                                                   FeatureAMXTF32];
   list<SubtargetFeature> DMRFeatures =
     !listconcat(GNRDFeatures, DMRAdditionalFeatures);
+  list<SubtargetFeature> DMRAdditionalTuning = [TuningPreferLegacySetCC];
+  list<SubtargetFeature> DMRTuning = !listconcat(GNRTuning, DMRAdditionalTuning);
 
   // Atom
   list<SubtargetFeature> AtomFeatures = [FeatureX87,
@@ -1387,6 +1389,8 @@ def ProcessorFeatures {
                                                   FeaturePREFETCHI];
   list<SubtargetFeature> NVLFeatures =
       !listconcat(PTLFeatures, NVLAdditionalFeatures);
+  list<SubtargetFeature> NVLAdditionalTuning = [TuningPreferLegacySetCC];
+  list<SubtargetFeature> NVLTuning = !listconcat(ADLTuning, NVLAdditionalTuning);
 
   // Clearwaterforest
   list<SubtargetFeature> CWFAdditionalFeatures = [FeaturePREFETCHI,
@@ -1946,7 +1950,7 @@ def : ProcModel<P, AlderlakePModel,
                 ProcessorFeatures.PTLFeatures, ProcessorFeatures.ADLTuning>;
 }
 def : ProcModel<"novalake", AlderlakePModel, ProcessorFeatures.NVLFeatures,
-                ProcessorFeatures.ADLTuning>;
+                ProcessorFeatures.NVLTuning>;
 
 def : ProcModel<"clearwaterforest", AlderlakePModel,
                 ProcessorFeatures.CWFFeatures, ProcessorFeatures.ADLTuning>;
@@ -1959,7 +1963,7 @@ def : ProcModel<P, SapphireRapidsModel,
                 ProcessorFeatures.GNRDFeatures, ProcessorFeatures.GNRTuning>;
 }
 def : ProcModel<"diamondrapids", SapphireRapidsModel,
-                ProcessorFeatures.DMRFeatures, ProcessorFeatures.GNRTuning>;
+                ProcessorFeatures.DMRFeatures, ProcessorFeatures.DMRTuning>;
 
 // AMD CPUs.
 
diff --git a/llvm/lib/Target/X86/X86FixupSetCC.cpp b/llvm/lib/Target/X86/X86FixupSetCC.cpp
index d4c7ecd270244..c063339e9d8ea 100644
--- a/llvm/lib/Target/X86/X86FixupSetCC.cpp
+++ b/llvm/lib/Target/X86/X86FixupSetCC.cpp
@@ -92,12 +92,17 @@ static bool fixupSetCC(MachineFunction &MF) {
       if (!FlagsDefMI)
         continue;
 
+      // When ZU is available and not disabled by tuning, we rewrite to
+      // setzucc, which doesn't clobber eflags; otherwise we insert a MOV32r0
+      // (which does clobber eflags) before FlagsDefMI.
+      bool UseSetZUCC = ST->hasZU() && !ST->preferLegacySetCC();
+
       // We'd like to put something that clobbers eflags directly before
       // FlagsDefMI. This can't hurt anything after FlagsDefMI, because
       // it, itself, by definition, clobbers eflags. But it may happen that
       // FlagsDefMI also *uses* eflags, in which case the transformation is
       // invalid.
-      if (!ST->hasZU() &&
+      if (!UseSetZUCC &&
           FlagsDefMI->readsRegister(X86::EFLAGS, /*TRI=*/nullptr))
         continue;
 
@@ -117,12 +122,8 @@ static bool fixupSetCC(MachineFunction &MF) {
       // inserting the setcc/setzucc result into the low byte of the zeroed
       // register.
       Register ZeroReg = MRI->createVirtualRegister(RC);
-      if (ST->hasZU()) {
-        if (!ST->preferLegacySetCC())
-          assert((MI.getOpcode() == X86::SETZUCCr) &&
-                 "Expect setzucc instruction!");
-        else
-          MI.setDesc(TII->get(X86::SETZUCCr));
+      if (UseSetZUCC) {
+        MI.setDesc(TII->get(X86::SETZUCCr));
         BuildMI(*ZExt->getParent(), ZExt, ZExt->getDebugLoc(),
                 TII->get(TargetOpcode::IMPLICIT_DEF), ZeroReg);
       } else {
diff --git a/llvm/test/CodeGen/X86/apx/ccmp.ll b/llvm/test/CodeGen/X86/apx/ccmp.ll
index 2c62e608223bc..94cbb7786721c 100644
--- a/llvm/test/CodeGen/X86/apx/ccmp.ll
+++ b/llvm/test/CodeGen/X86/apx/ccmp.ll
@@ -1,7 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ccmp -show-mc-encoding -verify-machineinstrs | FileCheck %s
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+ccmp,+ndd -show-mc-encoding -verify-machineinstrs | FileCheck %s --check-prefix=NDD
-; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+zu -show-mc-encoding -verify-machineinstrs | FileCheck %s --check-prefix=SETZUCC
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+zu -show-mc-encoding -verify-machineinstrs | FileCheck %s --check-prefixes=ZU_COMMON,PREFER_NO_LEGACY_SETCC
+; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+zu,+prefer-legacy-setcc -show-mc-encoding -verify-machineinstrs | FileCheck %s --check-prefixes=ZU_COMMON,PREFER_LEGACY_SETCC
 
 define void @ccmp8rr_zf(i8 noundef %a, i8 noundef %b, i8 noundef %c) {
 ; CHECK-LABEL: ccmp8rr_zf:
@@ -32,22 +33,22 @@ define void @ccmp8rr_zf(i8 noundef %a, i8 noundef %b, i8 noundef %c) {
 ; NDD-NEXT:  .LBB0_1: # %if.end
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; SETZUCC-LABEL: ccmp8rr_zf:
-; SETZUCC:       # %bb.0: # %entry
-; SETZUCC-NEXT:    cmpb %dl, %dil # encoding: [0x40,0x38,0xd7]
-; SETZUCC-NEXT:    je .LBB0_3 # encoding: [0x74,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB0_3, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.1: # %entry
-; SETZUCC-NEXT:    cmpb %dl, %sil # encoding: [0x40,0x38,0xd6]
-; SETZUCC-NEXT:    je .LBB0_3 # encoding: [0x74,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB0_3, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.2: # %if.end
-; SETZUCC-NEXT:    retq # encoding: [0xc3]
-; SETZUCC-NEXT:  .LBB0_3: # %if.then
-; SETZUCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; SETZUCC-NEXT:    jmp foo # TAILCALL
-; SETZUCC-NEXT:    # encoding: [0xeb,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
+; ZU_COMMON-LABEL: ccmp8rr_zf:
+; ZU_COMMON:       # %bb.0: # %entry
+; ZU_COMMON-NEXT:    cmpb %dl, %dil # encoding: [0x40,0x38,0xd7]
+; ZU_COMMON-NEXT:    je .LBB0_3 # encoding: [0x74,A]
+; ZU_COMMON-NEXT:    # fixup A - offset: 1, value: .LBB0_3, kind: FK_PCRel_1
+; ZU_COMMON-NEXT:  # %bb.1: # %entry
+; ZU_COMMON-NEXT:    cmpb %dl, %sil # encoding: [0x40,0x38,0xd6]
+; ZU_COMMON-NEXT:    je .LBB0_3 # encoding: [0x74,A]
+; ZU_COMMON-NEXT:    # fixup A - offset: 1, value: .LBB0_3, kind: FK_PCRel_1
+; ZU_COMMON-NEXT:  # %bb.2: # %if.end
+; ZU_COMMON-NEXT:    retq # encoding: [0xc3]
+; ZU_COMMON-NEXT:  .LBB0_3: # %if.then
+; ZU_COMMON-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; ZU_COMMON-NEXT:    jmp foo # TAILCALL
+; ZU_COMMON-NEXT:    # encoding: [0xeb,A]
+; ZU_COMMON-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
 entry:
   %cmp = icmp eq i8 %a, %c
   %cmp1 = icmp eq i8 %b, %c
@@ -91,22 +92,39 @@ define void @ccmp8rr_cf(i8 noundef %a, i8 noundef %b) {
 ; NDD-NEXT:  .LBB1_1: # %if.end
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; SETZUCC-LABEL: ccmp8rr_cf:
-; SETZUCC:       # %bb.0: # %entry
-; SETZUCC-NEXT:    cmpb $2, %dil # encoding: [0x40,0x80,0xff,0x02]
-; SETZUCC-NEXT:    setzul %al # encoding: [0x62,0xf4,0x7f,0x18,0x4c,0xc0]
-; SETZUCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
-; SETZUCC-NEXT:    setzub %cl # encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc1]
-; SETZUCC-NEXT:    orb %al, %cl # encoding: [0x08,0xc1]
-; SETZUCC-NEXT:    jne .LBB1_1 # encoding: [0x75,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB1_1, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.2: # %if.then
-; SETZUCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; SETZUCC-NEXT:    jmp foo # TAILCALL
-; SETZUCC-NEXT:    # encoding: [0xeb,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
-; SETZUCC-NEXT:  .LBB1_1: # %if.end
-; SETZUCC-NEXT:    retq # encoding: [0xc3]
+; PREFER_NO_LEGACY_SETCC-LABEL: ccmp8rr_cf:
+; PREFER_NO_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpb $2, %dil # encoding: [0x40,0x80,0xff,0x02]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzul %al # encoding: [0x62,0xf4,0x7f,0x18,0x4c,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzub %cl # encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    orb %al, %cl # encoding: [0x08,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    jne .LBB1_1 # encoding: [0x75,A]
+; PREFER_NO_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB1_1, kind: FK_PCRel_1
+; PREFER_NO_LEGACY_SETCC-NEXT:  # %bb.2: # %if.then
+; PREFER_NO_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    jmp foo # TAILCALL
+; PREFER_NO_LEGACY_SETCC-NEXT:    # encoding: [0xeb,A]
+; PREFER_NO_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
+; PREFER_NO_LEGACY_SETCC-NEXT:  .LBB1_1: # %if.end
+; PREFER_NO_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
+;
+; PREFER_LEGACY_SETCC-LABEL: ccmp8rr_cf:
+; PREFER_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_LEGACY_SETCC-NEXT:    cmpb $2, %dil # encoding: [0x40,0x80,0xff,0x02]
+; PREFER_LEGACY_SETCC-NEXT:    setl %al # encoding: [0x0f,0x9c,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
+; PREFER_LEGACY_SETCC-NEXT:    setb %cl # encoding: [0x0f,0x92,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    orb %al, %cl # encoding: [0x08,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    jne .LBB1_1 # encoding: [0x75,A]
+; PREFER_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB1_1, kind: FK_PCRel_1
+; PREFER_LEGACY_SETCC-NEXT:  # %bb.2: # %if.then
+; PREFER_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    jmp foo # TAILCALL
+; PREFER_LEGACY_SETCC-NEXT:    # encoding: [0xeb,A]
+; PREFER_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
+; PREFER_LEGACY_SETCC-NEXT:  .LBB1_1: # %if.end
+; PREFER_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
 entry:
   %cmp = icmp sgt i8 %a, 1
   %tobool = icmp ugt i8 %b, 1
@@ -146,21 +164,37 @@ define i8 @ccmp8rr_sf(i8 %a, i8 %b, i8* nocapture %c)  {
 ; NDD-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; SETZUCC-LABEL: ccmp8rr_sf:
-; SETZUCC:       # %bb.0: # %entry
-; SETZUCC-NEXT:    testb %dil, %dil # encoding: [0x40,0x84,0xff]
-; SETZUCC-NEXT:    setzune %al # encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
-; SETZUCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
-; SETZUCC-NEXT:    setzuge %cl # encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc1]
-; SETZUCC-NEXT:    andb %al, %cl # encoding: [0x20,0xc1]
-; SETZUCC-NEXT:    cmpb $1, %cl # encoding: [0x80,0xf9,0x01]
-; SETZUCC-NEXT:    jne .LBB2_2 # encoding: [0x75,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB2_2, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.1: # %if.then
-; SETZUCC-NEXT:    movb %dil, (%rdx) # encoding: [0x40,0x88,0x3a]
-; SETZUCC-NEXT:  .LBB2_2: # %if.end
-; SETZUCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; SETZUCC-NEXT:    retq # encoding: [0xc3]
+; PREFER_NO_LEGACY_SETCC-LABEL: ccmp8rr_sf:
+; PREFER_NO_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_NO_LEGACY_SETCC-NEXT:    testb %dil, %dil # encoding: [0x40,0x84,0xff]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzune %al # encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzuge %cl # encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    andb %al, %cl # encoding: [0x20,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpb $1, %cl # encoding: [0x80,0xf9,0x01]
+; PREFER_NO_LEGACY_SETCC-NEXT:    jne .LBB2_2 # encoding: [0x75,A]
+; PREFER_NO_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB2_2, kind: FK_PCRel_1
+; PREFER_NO_LEGACY_SETCC-NEXT:  # %bb.1: # %if.then
+; PREFER_NO_LEGACY_SETCC-NEXT:    movb %dil, (%rdx) # encoding: [0x40,0x88,0x3a]
+; PREFER_NO_LEGACY_SETCC-NEXT:  .LBB2_2: # %if.end
+; PREFER_NO_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
+;
+; PREFER_LEGACY_SETCC-LABEL: ccmp8rr_sf:
+; PREFER_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_LEGACY_SETCC-NEXT:    testb %dil, %dil # encoding: [0x40,0x84,0xff]
+; PREFER_LEGACY_SETCC-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
+; PREFER_LEGACY_SETCC-NEXT:    setge %cl # encoding: [0x0f,0x9d,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    andb %al, %cl # encoding: [0x20,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    cmpb $1, %cl # encoding: [0x80,0xf9,0x01]
+; PREFER_LEGACY_SETCC-NEXT:    jne .LBB2_2 # encoding: [0x75,A]
+; PREFER_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB2_2, kind: FK_PCRel_1
+; PREFER_LEGACY_SETCC-NEXT:  # %bb.1: # %if.then
+; PREFER_LEGACY_SETCC-NEXT:    movb %dil, (%rdx) # encoding: [0x40,0x88,0x3a]
+; PREFER_LEGACY_SETCC-NEXT:  .LBB2_2: # %if.end
+; PREFER_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
 entry:
   %tobool = icmp ne i8 %a, 0
   %cmp = icmp sgt i8 %b, 1
@@ -200,21 +234,37 @@ define i8 @ccmp8rr_none(i8 %a, i8 %b, i8* nocapture %c)  {
 ; NDD-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; SETZUCC-LABEL: ccmp8rr_none:
-; SETZUCC:       # %bb.0: # %entry
-; SETZUCC-NEXT:    testb %dil, %dil # encoding: [0x40,0x84,0xff]
-; SETZUCC-NEXT:    setzune %al # encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
-; SETZUCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
-; SETZUCC-NEXT:    setzuge %cl # encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc1]
-; SETZUCC-NEXT:    orb %al, %cl # encoding: [0x08,0xc1]
-; SETZUCC-NEXT:    cmpb $1, %cl # encoding: [0x80,0xf9,0x01]
-; SETZUCC-NEXT:    jne .LBB3_2 # encoding: [0x75,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB3_2, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.1: # %if.then
-; SETZUCC-NEXT:    movb %dil, (%rdx) # encoding: [0x40,0x88,0x3a]
-; SETZUCC-NEXT:  .LBB3_2: # %if.end
-; SETZUCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; SETZUCC-NEXT:    retq # encoding: [0xc3]
+; PREFER_NO_LEGACY_SETCC-LABEL: ccmp8rr_none:
+; PREFER_NO_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_NO_LEGACY_SETCC-NEXT:    testb %dil, %dil # encoding: [0x40,0x84,0xff]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzune %al # encoding: [0x62,0xf4,0x7f,0x18,0x45,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzuge %cl # encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    orb %al, %cl # encoding: [0x08,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpb $1, %cl # encoding: [0x80,0xf9,0x01]
+; PREFER_NO_LEGACY_SETCC-NEXT:    jne .LBB3_2 # encoding: [0x75,A]
+; PREFER_NO_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB3_2, kind: FK_PCRel_1
+; PREFER_NO_LEGACY_SETCC-NEXT:  # %bb.1: # %if.then
+; PREFER_NO_LEGACY_SETCC-NEXT:    movb %dil, (%rdx) # encoding: [0x40,0x88,0x3a]
+; PREFER_NO_LEGACY_SETCC-NEXT:  .LBB3_2: # %if.end
+; PREFER_NO_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
+;
+; PREFER_LEGACY_SETCC-LABEL: ccmp8rr_none:
+; PREFER_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_LEGACY_SETCC-NEXT:    testb %dil, %dil # encoding: [0x40,0x84,0xff]
+; PREFER_LEGACY_SETCC-NEXT:    setne %al # encoding: [0x0f,0x95,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    cmpb $2, %sil # encoding: [0x40,0x80,0xfe,0x02]
+; PREFER_LEGACY_SETCC-NEXT:    setge %cl # encoding: [0x0f,0x9d,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    orb %al, %cl # encoding: [0x08,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    cmpb $1, %cl # encoding: [0x80,0xf9,0x01]
+; PREFER_LEGACY_SETCC-NEXT:    jne .LBB3_2 # encoding: [0x75,A]
+; PREFER_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB3_2, kind: FK_PCRel_1
+; PREFER_LEGACY_SETCC-NEXT:  # %bb.1: # %if.then
+; PREFER_LEGACY_SETCC-NEXT:    movb %dil, (%rdx) # encoding: [0x40,0x88,0x3a]
+; PREFER_LEGACY_SETCC-NEXT:  .LBB3_2: # %if.end
+; PREFER_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
 entry:
   %tobool = icmp ne i8 %a, 0
   %cmp = icmp sgt i8 %b, 1
@@ -258,22 +308,39 @@ define void @ccmp16rr_sf(i16 noundef %a, i16 noundef %b, i16 noundef %c) {
 ; NDD-NEXT:  .LBB4_1: # %if.end
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; SETZUCC-LABEL: ccmp16rr_sf:
-; SETZUCC:       # %bb.0: # %entry
-; SETZUCC-NEXT:    cmpw %dx, %di # encoding: [0x66,0x39,0xd7]
-; SETZUCC-NEXT:    setzule %al # encoding: [0x62,0xf4,0x7f,0x18,0x4e,0xc0]
-; SETZUCC-NEXT:    cmpw %dx, %si # encoding: [0x66,0x39,0xd6]
-; SETZUCC-NEXT:    setzuge %cl # encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc1]
-; SETZUCC-NEXT:    testb %cl, %al # encoding: [0x84,0xc8]
-; SETZUCC-NEXT:    jne .LBB4_1 # encoding: [0x75,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB4_1, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.2: # %if.then
-; SETZUCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; SETZUCC-NEXT:    jmp foo # TAILCALL
-; SETZUCC-NEXT:    # encoding: [0xeb,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
-; SETZUCC-NEXT:  .LBB4_1: # %if.end
-; SETZUCC-NEXT:    retq # encoding: [0xc3]
+; PREFER_NO_LEGACY_SETCC-LABEL: ccmp16rr_sf:
+; PREFER_NO_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpw %dx, %di # encoding: [0x66,0x39,0xd7]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzule %al # encoding: [0x62,0xf4,0x7f,0x18,0x4e,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    cmpw %dx, %si # encoding: [0x66,0x39,0xd6]
+; PREFER_NO_LEGACY_SETCC-NEXT:    setzuge %cl # encoding: [0x62,0xf4,0x7f,0x18,0x4d,0xc1]
+; PREFER_NO_LEGACY_SETCC-NEXT:    testb %cl, %al # encoding: [0x84,0xc8]
+; PREFER_NO_LEGACY_SETCC-NEXT:    jne .LBB4_1 # encoding: [0x75,A]
+; PREFER_NO_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB4_1, kind: FK_PCRel_1
+; PREFER_NO_LEGACY_SETCC-NEXT:  # %bb.2: # %if.then
+; PREFER_NO_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_NO_LEGACY_SETCC-NEXT:    jmp foo # TAILCALL
+; PREFER_NO_LEGACY_SETCC-NEXT:    # encoding: [0xeb,A]
+; PREFER_NO_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
+; PREFER_NO_LEGACY_SETCC-NEXT:  .LBB4_1: # %if.end
+; PREFER_NO_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
+;
+; PREFER_LEGACY_SETCC-LABEL: ccmp16rr_sf:
+; PREFER_LEGACY_SETCC:       # %bb.0: # %entry
+; PREFER_LEGACY_SETCC-NEXT:    cmpw %dx, %di # encoding: [0x66,0x39,0xd7]
+; PREFER_LEGACY_SETCC-NEXT:    setle %al # encoding: [0x0f,0x9e,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    cmpw %dx, %si # encoding: [0x66,0x39,0xd6]
+; PREFER_LEGACY_SETCC-NEXT:    setge %cl # encoding: [0x0f,0x9d,0xc1]
+; PREFER_LEGACY_SETCC-NEXT:    testb %cl, %al # encoding: [0x84,0xc8]
+; PREFER_LEGACY_SETCC-NEXT:    jne .LBB4_1 # encoding: [0x75,A]
+; PREFER_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: .LBB4_1, kind: FK_PCRel_1
+; PREFER_LEGACY_SETCC-NEXT:  # %bb.2: # %if.then
+; PREFER_LEGACY_SETCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
+; PREFER_LEGACY_SETCC-NEXT:    jmp foo # TAILCALL
+; PREFER_LEGACY_SETCC-NEXT:    # encoding: [0xeb,A]
+; PREFER_LEGACY_SETCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
+; PREFER_LEGACY_SETCC-NEXT:  .LBB4_1: # %if.end
+; PREFER_LEGACY_SETCC-NEXT:    retq # encoding: [0xc3]
 entry:
   %cmp = icmp sgt i16 %a, %c
   %cmp1 = icmp slt i16 %b, %c
@@ -317,22 +384,39 @@ define void @ccmp32rr_cf(i32 noundef %a, i32 noundef %b, i32 noundef %c) {
 ; NDD-NEXT:  .LBB5_1: # %if.end
 ; NDD-NEXT:    retq # encoding: [0xc3]
 ;
-; SETZUCC-LABEL: ccmp32rr_cf:
-; SETZUCC:       # %bb.0: # %entry
-; SETZUCC-NEXT:    cmpl %edx, %edi # encoding: [0x39,0xd7]
-; SETZUCC-NEXT:    setzub %al # encoding: [0x62,0xf4,0x7f,0x18,0x42,0xc0]
-; SETZUCC-NEXT:    cmpl %edx, %esi # encoding: [0x39,0xd6]
-; SETZUCC-NEXT:    setzua %cl # encoding: [0x62,0xf4,0x7f,0x18,0x47,0xc1]
-; SETZUCC-NEXT:    testb %cl, %al # encoding: [0x84,0xc8]
-; SETZUCC-NEXT:    jne .LBB5_1 # encoding: [0x75,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: .LBB5_1, kind: FK_PCRel_1
-; SETZUCC-NEXT:  # %bb.2: # %if.then
-; SETZUCC-NEXT:    xorl %eax, %eax # encoding: [0x31,0xc0]
-; SETZUCC-NEXT:    jmp foo # TAILCALL
-; SETZUCC-NEXT:    # encoding: [0xeb,A]
-; SETZUCC-NEXT:    # fixup A - offset: 1, value: foo, kind: FK_PCRel_1
-; SETZUCC-NEXT:  .LBB5_1: # %if.end
-; SETZUCC-NEXT:    retq # encoding: [0xc3]
+; PREFER_NO_LEGACY_SETCC-LAB...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list