-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LLVM] Make s_getpc_b64 rematerializable #71823
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
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -stress-regalloc=2 -verify-machineinstrs < %s | FileCheck %s | ||
|
||
|
||
define void @test_remat_s_getpc_b64() { | ||
; CHECK-LABEL: test_remat_s_getpc_b64: | ||
; CHECK: ; %bb.0: ; %entry | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; CHECK-NEXT: s_xor_saveexec_b64 s[4:5], -1 | ||
; CHECK-NEXT: buffer_store_dword v0, off, s[0:3], s32 ; 4-byte Folded Spill | ||
; CHECK-NEXT: s_mov_b64 exec, s[4:5] | ||
; CHECK-NEXT: v_writelane_b32 v0, s30, 0 | ||
; CHECK-NEXT: s_getpc_b64 s[4:5] | ||
; CHECK-NEXT: v_writelane_b32 v0, s31, 1 | ||
; CHECK-NEXT: ;;#ASMSTART | ||
; CHECK-NEXT: ;;#ASMEND | ||
; CHECK-NEXT: ;;#ASMSTART | ||
; CHECK-NEXT: ;;#ASMEND | ||
; CHECK-NEXT: s_getpc_b64 s[4:5] | ||
; CHECK-NEXT: v_mov_b32_e32 v1, s4 | ||
; CHECK-NEXT: v_mov_b32_e32 v2, s5 | ||
; CHECK-NEXT: global_store_dwordx2 v[1:2], v[1:2], off | ||
; CHECK-NEXT: v_readlane_b32 s31, v0, 1 | ||
; CHECK-NEXT: v_readlane_b32 s30, v0, 0 | ||
; CHECK-NEXT: s_xor_saveexec_b64 s[4:5], -1 | ||
; CHECK-NEXT: buffer_load_dword v0, off, s[0:3], s32 ; 4-byte Folded Reload | ||
; CHECK-NEXT: s_mov_b64 exec, s[4:5] | ||
; CHECK-NEXT: s_waitcnt vmcnt(0) | ||
; CHECK-NEXT: s_setpc_b64 s[30:31] | ||
entry: | ||
%0 = tail call i64 @llvm.amdgcn.s.getpc() | ||
tail call void asm sideeffect "", "s"(i64 %0) | ||
tail call void asm sideeffect "", "~{s0},~{s1},~{s2},~{s3},~{s4},~{s5},~{s6},~{s7},~{s8},~{s9},~{s10},~{s11},~{s12},~{s13},~{s14},~{s15},~{s16},~{s17},~{s18},~{s19},~{s20},~{s21},~{s22},~{s23},~{s24},~{s25},~{s26},~{s27},~{s28},~{s29},~{s30},~{s31}"() | ||
store i64 %0, ptr addrspace(1) undef | ||
ret void | ||
} | ||
|
||
declare i64 @llvm.amdgcn.s.getpc() |
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.
Does this also work if it's in the bundle sequence with the following add?
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.
You mean the SI_PC_ADD_REL_OFFSET sequence? That's not even expanded to a bundle until after RA.