-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[AArch64] improve zero-cycle regmov test #143680
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
fhahn
merged 1 commit into
llvm:main
from
tomershafir:aarch64-improve-0-cycle-regmove-test
Jun 18, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
llvm/test/CodeGen/AArch64/arm64-zero-cycle-regmov-gpr32.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| ; RUN: llc < %s -march=arm64 | FileCheck %s -check-prefixes=NOTCPU --match-full-lines | ||
| ; RUN: llc < %s -mtriple=arm64-apple-macosx -mcpu=apple-m1 | FileCheck %s -check-prefixes=CPU --match-full-lines | ||
| ; RUN: llc < %s -mtriple=arm64-apple-macosx -mcpu=apple-m1 -mattr=-zcm | FileCheck %s -check-prefixes=NOTATTR --match-full-lines | ||
| ; RUN: llc < %s -mtriple=arm64-apple-macosx -mattr=+zcm | FileCheck %s -check-prefixes=ATTR --match-full-lines | ||
|
|
||
| define void @t(i32 %a, i32 %b, i32 %c, i32 %d) { | ||
| entry: | ||
| ; CHECK-LABEL: t: | ||
| ; NOTCPU: mov w0, w2 | ||
| ; NOTCPU: mov w1, w3 | ||
| ; NOTCPU: mov [[REG2:w[0-9]+]], w3 | ||
| ; NOTCPU: mov [[REG1:w[0-9]+]], w2 | ||
| ; NOTCPU-NEXT: bl {{_?foo}} | ||
| ; NOTCPU: mov w0, [[REG1]] | ||
| ; NOTCPU: mov w1, [[REG2]] | ||
|
|
||
| ; CPU: mov [[REG2:x[0-9]+]], x3 | ||
| ; CPU: mov [[REG1:x[0-9]+]], x2 | ||
| ; CPU: mov x0, x2 | ||
| ; CPU: mov x1, x3 | ||
| ; CPU-NEXT: bl {{_?foo}} | ||
| ; CPU: mov x0, [[REG1]] | ||
| ; CPU: mov x1, [[REG2]] | ||
|
|
||
| ; NOTATTR: mov [[REG2:w[0-9]+]], w3 | ||
| ; NOTATTR: mov [[REG1:w[0-9]+]], w2 | ||
| ; NOTATTR: mov w0, w2 | ||
| ; NOTATTR: mov w1, w3 | ||
| ; NOTATTR-NEXT: bl {{_?foo}} | ||
| ; NOTATTR: mov w0, [[REG1]] | ||
| ; NOTATTR: mov w1, [[REG2]] | ||
|
|
||
| ; ATTR: mov x0, x2 | ||
| ; ATTR: mov x1, x3 | ||
| ; ATTR: mov [[REG2:x[0-9]+]], x3 | ||
| ; ATTR: mov [[REG1:x[0-9]+]], x2 | ||
| ; ATTR-NEXT: bl {{_?foo}} | ||
| ; ATTR: mov x0, [[REG1]] | ||
| ; ATTR: mov x1, [[REG2]] | ||
|
||
| %call = call i32 @foo(i32 %c, i32 %d) | ||
| %call1 = call i32 @foo(i32 %c, i32 %d) | ||
| unreachable | ||
| } | ||
|
|
||
| declare i32 @foo(i32, i32) | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How big is the full assembly for the function? Would it make sense to auto-generate the check lines via
llvm/utils/update_llc_test_checks.py?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its only 20-30 lines of assembly, I think its small enough to keep it manual and more manageable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interleaving off checks for different configuration makes it very hard to see what's going on.
I would expect that CPU/ATTR check lines are the same? Same for NOTATTR/NOTCPU?
If that's the case, they should be merged. Then it would make sense to auto-generate and check the full assembly for the case with and without the feature enabled (either via CPU or attribute)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So CPU/ATTR differ because
-mcpuchanges the order of instructions. Same for NOTATTR/NOTCPU. I can separate each configuration by duplicating; CHECK: bl {{_?foo}}, or autogen it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will separate the outputs as described, as I dont think the cons of autogenerating the test worth it here (overfitting, robustness, readability, harder to debug)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, thanks. Separating the output makes things clearer.