-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AArch64] Fix handling of x29/x30 in inline assembly clobbers #167783
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ; RUN: llc -mtriple=aarch64 -verify-machineinstrs < %s | FileCheck %s | ||
|
|
||
| ; Test that both numeric register names (x29, x30) and their architectural | ||
| ; aliases (fp, lr) work correctly as clobbers in inline assembly. | ||
|
|
||
| define void @clobber_x29() nounwind { | ||
| ; CHECK-LABEL: clobber_x29: | ||
| ; CHECK: str x29, [sp | ||
| ; CHECK: ldr x29, [sp | ||
| tail call void asm sideeffect "", "~{x29}"() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know these are marked tailcall so in theory we should never get load/stores for stack frame management. However, if you put a nop in the asm statement, you could make this into: And it would be bit more robust and immediately clear what the intended behaviour is.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, you stated the test intent above (thank you for that too, it often gets forgotten), but it can be visually more clear. |
||
| ret void | ||
| } | ||
|
|
||
| define void @clobber_fp() nounwind { | ||
| ; CHECK-LABEL: clobber_fp: | ||
| ; CHECK: str x29, [sp | ||
| ; CHECK: ldr x29, [sp | ||
| tail call void asm sideeffect "", "~{fp}"() | ||
| ret void | ||
| } | ||
|
|
||
| define void @clobber_x30() nounwind { | ||
| ; CHECK-LABEL: clobber_x30: | ||
| ; CHECK: str x30, [sp | ||
| ; CHECK: ldr x30, [sp | ||
| tail call void asm sideeffect "", "~{x30}"() | ||
| ret void | ||
| } | ||
|
|
||
| define void @clobber_lr() nounwind { | ||
| ; CHECK-LABEL: clobber_lr: | ||
| ; CHECK: str x30, [sp | ||
| ; CHECK: ldr x30, [sp | ||
| tail call void asm sideeffect "", "~{lr}"() | ||
| ret void | ||
| } | ||
lalinsky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.