Skip to content

[X86] Remove SlowDivide tuning from GRTTuning #84676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions llvm/lib/Target/X86/X86.td
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,6 @@ def ProcessorFeatures {
// Gracemont
list<SubtargetFeature> GRTTuning = [TuningMacroFusion,
TuningSlow3OpsLEA,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LEA also seems to be reasonably fast on GRT.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure. We have TuningSlow3OpsLEA for AlderLake and uops.info shows it has longer latency on it.

I don't have any information about newer targets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2c latency, but other slow lea is 3c. Bit of a middle ground.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, the latency was reduced to 1 since IceLake but was grown back to 2 on AlderLake.

I think we can change it for IceLake, but AlderLake etc. need more date provements.

TuningSlowDivide32,
TuningSlowDivide64,
TuningFastScalarFSQRT,
TuningFastVectorFSQRT,
TuningFast15ByteNOP,
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/CodeGen/X86/bypass-slow-division-tune.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mcpu=x86-64 < %s | FileCheck -check-prefixes=CHECK,REST,X64 %s
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mcpu=silvermont < %s | FileCheck -check-prefixes=CHECK,REST,SLM %s
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake < %s | FileCheck -check-prefixes=CHECK,REST,SKL %s
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mcpu=goldmont < %s | FileCheck -check-prefixes=CHECK,REST,GMT %s
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mcpu=gracemont < %s | FileCheck -check-prefixes=CHECK,REST,GMT %s
; RUN: llc -profile-summary-huge-working-set-size-threshold=1 -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake < %s | FileCheck -check-prefixes=HUGEWS %s

; Verify that div32 is bypassed only for Atoms.
Expand Down Expand Up @@ -117,6 +119,13 @@ define i64 @div64(i64 %a, i64 %b) {
; SKL-NEXT: # kill: def $eax killed $eax def $rax
; SKL-NEXT: retq
;
; GMT-LABEL: div64:
; GMT: # %bb.0: # %entry
; GMT-NEXT: movq %rdi, %rax
; GMT-NEXT: cqto
; GMT-NEXT: idivq %rsi
; GMT-NEXT: retq
;
; HUGEWS-LABEL: div64:
; HUGEWS: # %bb.0: # %entry
; HUGEWS-NEXT: movq %rdi, %rax
Expand Down Expand Up @@ -240,6 +249,13 @@ define i64 @div64_hugews(i64 %a, i64 %b) {
; SKL-NEXT: # kill: def $eax killed $eax def $rax
; SKL-NEXT: retq
;
; GMT-LABEL: div64_hugews:
; GMT: # %bb.0:
; GMT-NEXT: movq %rdi, %rax
; GMT-NEXT: cqto
; GMT-NEXT: idivq %rsi
; GMT-NEXT: retq
;
; HUGEWS-LABEL: div64_hugews:
; HUGEWS: # %bb.0:
; HUGEWS-NEXT: movq %rdi, %rax
Expand Down