From 99bbbf5296bdb7a8d9911ef35d986e4f8e5d3509 Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sun, 17 Aug 2025 05:37:41 +0000 Subject: [PATCH] [X86] Remove TuningPOPCNTFalseDeps from AlderLake This false dependency issue was fixed in CannonLake looking at the data from uops.info. This is confirmed not to be an issue based on benchmarking data in #153983. Setting this can potentially lead to extra xor instructions whihc could consume extra frontend/renaming resources. None of the other CPUs that have had this fixed have the tuning flag. Fixes #153983. --- llvm/lib/Target/X86/X86.td | 4 +++- llvm/test/CodeGen/X86/bitcnt-false-dep.ll | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td index 990b381341f07..3d34ea3bed318 100644 --- a/llvm/lib/Target/X86/X86.td +++ b/llvm/lib/Target/X86/X86.td @@ -1291,7 +1291,9 @@ def ProcessorFeatures { list ADLAdditionalTuning = [TuningPERMFalseDeps, TuningPreferMovmskOverVTest, TuningFastImmVectorShift]; - list ADLTuning = !listconcat(SKLTuning, ADLAdditionalTuning); + list ADLRemoveTuning = [TuningPOPCNTFalseDeps]; + list ADLTuning = + !listremove(!listconcat(SKLTuning, ADLAdditionalTuning), ADLRemoveTuning); list ADLFeatures = !listconcat(TRMFeatures, ADLAdditionalFeatures); diff --git a/llvm/test/CodeGen/X86/bitcnt-false-dep.ll b/llvm/test/CodeGen/X86/bitcnt-false-dep.ll index 5f576c8586285..793cbb8f75bdc 100644 --- a/llvm/test/CodeGen/X86/bitcnt-false-dep.ll +++ b/llvm/test/CodeGen/X86/bitcnt-false-dep.ll @@ -1,6 +1,7 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=haswell | FileCheck %s --check-prefix=HSW ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake | FileCheck %s --check-prefix=SKL ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=skx | FileCheck %s --check-prefix=SKL +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=alderlake | FileCheck %s --check-prefix=ADL ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=silvermont -mattr=+lzcnt,+bmi | FileCheck %s --check-prefix=SKL ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=goldmont -mattr=+lzcnt,+bmi | FileCheck %s --check-prefix=SKL @@ -37,6 +38,10 @@ ret: ;SKL-LABEL:@loopdep_popcnt32 ;SKL: xorl [[GPR0:%e[a-d]x]], [[GPR0]] ;SKL-NEXT: popcntl {{.*}}, [[GPR0]] + +;ADL-LABEL:@loopdep_popcnt32 +;ADL-NOT: xor +;ADL: popcntl } define i64 @loopdep_popcnt64(ptr nocapture %x, ptr nocapture %y) nounwind { @@ -63,6 +68,10 @@ ret: ;SKL-LABEL:@loopdep_popcnt64 ;SKL: xorl %e[[GPR0:[a-d]x]], %e[[GPR0]] ;SKL-NEXT: popcntq {{.*}}, %r[[GPR0]] + +;ADL-LABEL:@loopdep_popcnt64 +;ADL-NOT: xor +;ADL: popcntq } define i32 @loopdep_tzct32(ptr nocapture %x, ptr nocapture %y) nounwind {