-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[X86] Support EGPR for inline assembly. #92338
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
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
41fbc18
[X86] Support EGPR for inline assembly.
FreddyLeaf c1daf20
refine
FreddyLeaf 9f43b45
clang-format
FreddyLeaf 1fdd2f2
add egpr restric to the new option.
FreddyLeaf 4d1ad30
address comments.
FreddyLeaf 4087704
address comments,
FreddyLeaf 0bb6794
address comments
FreddyLeaf 4a9bf69
address
FreddyLeaf a642173
Merge branch 'main' into egpr_inline_ass
FreddyLeaf bf3a53c
address comments.
FreddyLeaf fb6ba87
address and clang-format
FreddyLeaf 81f58b6
address comments
FreddyLeaf 528a0ae
remove redundant tests
FreddyLeaf e752556
fix build warning and address comments.
FreddyLeaf 248e6ea
Merge branch 'main' into egpr_inline_ass
FreddyLeaf 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
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
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
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
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
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,3 @@ | ||
/// Tests -mapx-inline-asm-use-gpr32 | ||
// RUN: %clang -target x86_64-unknown-linux-gnu -c -mapx-inline-asm-use-gpr32 -### %s 2>&1 | FileCheck --check-prefix=GPR32 %s | ||
// GPR32: "-target-feature" "+inline-asm-use-gpr32" |
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
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
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
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
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,17 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: not llc -mtriple=x86_64 %s 2>&1 | FileCheck %s --check-prefix=ERR | ||
; RUN: llc -mtriple=x86_64 -mattr=+egpr < %s | FileCheck %s | ||
; RUN: llc -mtriple=x86_64 -mattr=+egpr,+inline-asm-use-gpr32 < %s | FileCheck %s | ||
; RUN: not llc -mtriple=x86_64 -mattr=+inline-asm-use-gpr32 %s 2>&1 | FileCheck %s --check-prefix=ERR | ||
|
||
; ERR: error: inline assembly requires more registers than available | ||
|
||
define void @constraint_jR_test() nounwind { | ||
; CHECK-LABEL: constraint_jR_test: | ||
; CHECK: addq %r16, %rax | ||
entry: | ||
%reg = alloca i64, align 8 | ||
%0 = load i64, ptr %reg, align 8 | ||
call void asm sideeffect "add $0, %rax", "^jR,~{rax},~{rbx},~{rbp},~{rcx},~{rdx},~{rdi},~{rsi},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(i64 %0) | ||
ret void | ||
} |
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,28 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: not llc -mtriple=x86_64 < %s >%t1 2>%t2 | ||
; RUN: FileCheck %s <%t1 | ||
; RUN: FileCheck %s <%t2 --check-prefix=ERR | ||
; RUN: not llc -mattr=+egpr -mtriple=x86_64 < %s >%t1 2>%t2 | ||
; RUN: FileCheck %s <%t1 | ||
; RUN: FileCheck %s <%t2 --check-prefix=ERR | ||
; RUN: not llc -mattr=+egpr,+inline-asm-use-gpr32 -mtriple=x86_64 < %s >%t1 2>%t2 | ||
; RUN: FileCheck %s <%t1 | ||
; RUN: FileCheck %s <%t2 --check-prefix=ERR | ||
|
||
; CHECK: addq %r8, %rax | ||
define void @constraint_jr_test() nounwind { | ||
entry: | ||
%reg = alloca i64, align 8 | ||
%0 = load i64, ptr %reg, align 8 | ||
call void asm sideeffect "add $0, %rax", "^jr,~{rax},~{rbx},~{rbp},~{rcx},~{rdx},~{rdi},~{rsi},~{dirflag},~{fpsr},~{flags}"(i64 %0) | ||
ret void | ||
} | ||
|
||
; ERR: error: inline assembly requires more registers than available | ||
define void @constraint_jr_test_err() nounwind { | ||
entry: | ||
%reg = alloca i64, align 8 | ||
%0 = load i64, ptr %reg, align 8 | ||
call void asm sideeffect "add $0, %rax", "^jr,~{rax},~{rbx},~{rbp},~{rcx},~{rdx},~{rdi},~{rsi},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"(i64 %0) | ||
ret void | ||
} |
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 |
---|---|---|
@@ -1,21 +1,26 @@ | ||
; Check r16-r31 can not be used with 'q','r','l' constraint for backward compatibility. | ||
; RUN: not llc < %s -mtriple=x86_64-unknown-unknown -mattr=+egpr 2>&1 | FileCheck %s | ||
; RUN: not llc -mtriple=x86_64 < %s 2>&1 | FileCheck %s --check-prefix=ERR | ||
; RUN: not llc -mtriple=x86_64 -mattr=+egpr < %s 2>&1 | FileCheck %s --check-prefix=ERR | ||
; RUN: llc -mtriple=x86_64 -mattr=+egpr,+inline-asm-use-gpr32 < %s | FileCheck %s | ||
|
||
define void @q() { | ||
; CHECK: error: inline assembly requires more registers than available | ||
%a = call i32 asm sideeffect "movq %rax, $0", "=q,~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rsi},~{rbp},~{rsp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() | ||
; ERR: error: inline assembly requires more registers than available | ||
; CHECK: movq %rax, %r16 | ||
%a = call i64 asm sideeffect "movq %rax, $0", "=q,~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rsi},~{rbp},~{rsp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() | ||
ret void | ||
} | ||
|
||
define void @r() { | ||
; CHECK: error: inline assembly requires more registers than available | ||
%a = call i32 asm sideeffect "movq %rax, $0", "=r,~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rsi},~{rbp},~{rsp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() | ||
; ERR: error: inline assembly requires more registers than available | ||
; CHECK: movq %rax, %r16 | ||
%a = call i64 asm sideeffect "movq %rax, $0", "=r,~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rsi},~{rbp},~{rsp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() | ||
ret void | ||
} | ||
|
||
define void @l() { | ||
; CHECK: error: inline assembly requires more registers than available | ||
%a = call i32 asm sideeffect "movq %rax, $0", "=l,~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rsi},~{rbp},~{rsp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() | ||
; ERR: error: inline assembly requires more registers than available | ||
; CHECK: movq %rax, %r16 | ||
%a = call i64 asm sideeffect "movq %rax, $0", "=l,~{rax},~{rbx},~{rcx},~{rdx},~{rdi},~{rsi},~{rbp},~{rsp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() | ||
ret void | ||
} | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.