-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[RISCV] Only convert volatile i64 load/store to Zilsd in SelectionDAG. #169529
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
Open
topperc
wants to merge
2
commits into
llvm:main
Choose a base branch
from
topperc:pr/zilsd-non-volatile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26
−34
Open
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
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 |
|---|---|---|
|
|
@@ -9,9 +9,10 @@ | |
| define i64 @load(ptr %a) nounwind { | ||
| ; CHECK-LABEL: load: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: mv a2, a0 | ||
| ; CHECK-NEXT: ld a0, 80(a0) | ||
| ; CHECK-NEXT: ld zero, 0(a2) | ||
| ; CHECK-NEXT: lw a2, 80(a0) | ||
| ; CHECK-NEXT: lw a1, 84(a0) | ||
| ; CHECK-NEXT: ld zero, 0(a0) | ||
| ; CHECK-NEXT: mv a0, a2 | ||
| ; CHECK-NEXT: ret | ||
| %1 = getelementptr i64, ptr %a, i32 10 | ||
| %2 = load i64, ptr %1 | ||
|
|
@@ -44,10 +45,10 @@ define i64 @load_align4(ptr %a) nounwind { | |
| define void @store(ptr %a, i64 %b) nounwind { | ||
| ; CHECK-LABEL: store: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: mv a3, a2 | ||
| ; CHECK-NEXT: mv a2, a1 | ||
| ; CHECK-NEXT: sd a2, 0(a0) | ||
| ; CHECK-NEXT: sd a2, 88(a0) | ||
| ; CHECK-NEXT: sw a1, 0(a0) | ||
| ; CHECK-NEXT: sw a2, 4(a0) | ||
| ; CHECK-NEXT: sw a1, 88(a0) | ||
| ; CHECK-NEXT: sw a2, 92(a0) | ||
| ; CHECK-NEXT: ret | ||
| store i64 %b, ptr %a | ||
| %1 = getelementptr i64, ptr %a, i32 11 | ||
|
|
@@ -56,25 +57,11 @@ define void @store(ptr %a, i64 %b) nounwind { | |
| } | ||
|
|
||
| define void @store_align4(ptr %a, i64 %b) nounwind { | ||
| ; SLOW-LABEL: store_align4: | ||
| ; SLOW: # %bb.0: | ||
| ; SLOW-NEXT: sw a1, 88(a0) | ||
| ; SLOW-NEXT: sw a2, 92(a0) | ||
| ; SLOW-NEXT: ret | ||
| ; | ||
| ; FAST-LABEL: store_align4: | ||
| ; FAST: # %bb.0: | ||
| ; FAST-NEXT: mv a3, a2 | ||
| ; FAST-NEXT: mv a2, a1 | ||
| ; FAST-NEXT: sd a2, 88(a0) | ||
| ; FAST-NEXT: ret | ||
| ; | ||
| ; 4BYTEALIGN-LABEL: store_align4: | ||
| ; 4BYTEALIGN: # %bb.0: | ||
| ; 4BYTEALIGN-NEXT: mv a3, a2 | ||
| ; 4BYTEALIGN-NEXT: mv a2, a1 | ||
| ; 4BYTEALIGN-NEXT: sd a2, 88(a0) | ||
| ; 4BYTEALIGN-NEXT: ret | ||
| ; CHECK-LABEL: store_align4: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: sw a1, 88(a0) | ||
| ; CHECK-NEXT: sw a2, 92(a0) | ||
| ; CHECK-NEXT: ret | ||
| %1 = getelementptr i64, ptr %a, i32 11 | ||
| store i64 %b, ptr %1, align 4 | ||
| ret void | ||
|
|
@@ -158,9 +145,8 @@ define void @store_unaligned(ptr %p, i64 %v) { | |
| ; | ||
| ; FAST-LABEL: store_unaligned: | ||
| ; FAST: # %bb.0: | ||
| ; FAST-NEXT: mv a3, a2 | ||
| ; FAST-NEXT: mv a2, a1 | ||
| ; FAST-NEXT: sd a2, 0(a0) | ||
| ; FAST-NEXT: sw a1, 0(a0) | ||
| ; FAST-NEXT: sw a2, 4(a0) | ||
| ; FAST-NEXT: ret | ||
| ; | ||
| ; 4BYTEALIGN-LABEL: store_unaligned: | ||
|
|
@@ -213,10 +199,11 @@ define void @large_offset(ptr nocapture %p, i64 %d) nounwind { | |
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: lui a1, 4 | ||
| ; CHECK-NEXT: add a0, a0, a1 | ||
| ; CHECK-NEXT: ld a2, -384(a0) | ||
| ; CHECK-NEXT: lw a2, -384(a0) | ||
|
Collaborator
Author
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. This is a regression. x10 is already allocated. We pick x11 for the odd register first, but this can't pair since x10 is already used. So we pick x12 for the even but don't revisit the odd. |
||
| ; CHECK-NEXT: lw a1, -380(a0) | ||
| ; CHECK-NEXT: addi a2, a2, 1 | ||
| ; CHECK-NEXT: seqz a1, a2 | ||
| ; CHECK-NEXT: add a3, a3, a1 | ||
| ; CHECK-NEXT: seqz a3, a2 | ||
| ; CHECK-NEXT: add a3, a1, a3 | ||
| ; CHECK-NEXT: sd a2, -384(a0) | ||
| ; CHECK-NEXT: ret | ||
| entry: | ||
|
|
||
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.
Curious that does this also considered a regression in terms of latency since it turns 2 loads to 4 loads?
Or it doesn't matter since latency of sd is 2 * sw