-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[RISCV] Fix bugs about getting register list of Zcmp push/pop. #66073
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 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bf518a6
[RISCV] Fix internal compiler about Zcmp.
170908a
[RISCV] Use right pushed register number when max pushed register is …
2df605c
[RISCV] Preserve original test which check case only using s4.
9f8d8d5
[RISCV] Update comments.
44dc55f
[RISCV] Update test to not use inline asm and rename zcmp-crash.ll to…
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 |
|---|---|---|
|
|
@@ -1998,12 +1998,12 @@ define void @foo() { | |
| ; RV32I: # %bb.0: # %entry | ||
| ; RV32I-NEXT: addi sp, sp, -16 | ||
| ; RV32I-NEXT: .cfi_def_cfa_offset 16 | ||
| ; RV32I-NEXT: sw s4, 12(sp) # 4-byte Folded Spill | ||
| ; RV32I-NEXT: .cfi_offset s4, -4 | ||
| ; RV32I-NEXT: sw s11, 12(sp) # 4-byte Folded Spill | ||
| ; RV32I-NEXT: .cfi_offset s11, -4 | ||
| ; RV32I-NEXT: #APP | ||
| ; RV32I-NEXT: li s4, 0 | ||
| ; RV32I-NEXT: li s11, 0 | ||
| ; RV32I-NEXT: #NO_APP | ||
| ; RV32I-NEXT: lw s4, 12(sp) # 4-byte Folded Reload | ||
| ; RV32I-NEXT: lw s11, 12(sp) # 4-byte Folded Reload | ||
| ; RV32I-NEXT: addi sp, sp, 16 | ||
| ; RV32I-NEXT: ret | ||
| ; | ||
|
|
@@ -2013,62 +2013,62 @@ define void @foo() { | |
| ; RV32I-WITH-FP-NEXT: .cfi_def_cfa_offset 16 | ||
| ; RV32I-WITH-FP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill | ||
| ; RV32I-WITH-FP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill | ||
| ; RV32I-WITH-FP-NEXT: sw s4, 4(sp) # 4-byte Folded Spill | ||
| ; RV32I-WITH-FP-NEXT: sw s11, 4(sp) # 4-byte Folded Spill | ||
| ; RV32I-WITH-FP-NEXT: .cfi_offset ra, -4 | ||
| ; RV32I-WITH-FP-NEXT: .cfi_offset s0, -8 | ||
| ; RV32I-WITH-FP-NEXT: .cfi_offset s4, -12 | ||
| ; RV32I-WITH-FP-NEXT: .cfi_offset s11, -12 | ||
| ; RV32I-WITH-FP-NEXT: addi s0, sp, 16 | ||
| ; RV32I-WITH-FP-NEXT: .cfi_def_cfa s0, 0 | ||
| ; RV32I-WITH-FP-NEXT: #APP | ||
| ; RV32I-WITH-FP-NEXT: li s4, 0 | ||
| ; RV32I-WITH-FP-NEXT: li s11, 0 | ||
| ; RV32I-WITH-FP-NEXT: #NO_APP | ||
| ; RV32I-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload | ||
| ; RV32I-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload | ||
| ; RV32I-WITH-FP-NEXT: lw s4, 4(sp) # 4-byte Folded Reload | ||
| ; RV32I-WITH-FP-NEXT: lw s11, 4(sp) # 4-byte Folded Reload | ||
| ; RV32I-WITH-FP-NEXT: addi sp, sp, 16 | ||
| ; RV32I-WITH-FP-NEXT: ret | ||
| ; | ||
| ; RV32IZCMP-LABEL: foo: | ||
| ; RV32IZCMP: # %bb.0: # %entry | ||
| ; RV32IZCMP-NEXT: cm.push {ra, s0-s4}, -32 | ||
| ; RV32IZCMP-NEXT: .cfi_def_cfa_offset 32 | ||
| ; RV32IZCMP-NEXT: .cfi_offset s4, -4 | ||
| ; RV32IZCMP-NEXT: cm.push {ra, s0-s11}, -64 | ||
| ; RV32IZCMP-NEXT: .cfi_def_cfa_offset 64 | ||
| ; RV32IZCMP-NEXT: .cfi_offset s11, -4 | ||
| ; RV32IZCMP-NEXT: #APP | ||
| ; RV32IZCMP-NEXT: li s4, 0 | ||
| ; RV32IZCMP-NEXT: li s11, 0 | ||
| ; RV32IZCMP-NEXT: #NO_APP | ||
| ; RV32IZCMP-NEXT: cm.popret {ra, s0-s4}, 32 | ||
| ; RV32IZCMP-NEXT: cm.popret {ra, s0-s11}, 64 | ||
| ; | ||
| ; RV32IZCMP-WITH-FP-LABEL: foo: | ||
| ; RV32IZCMP-WITH-FP: # %bb.0: # %entry | ||
| ; RV32IZCMP-WITH-FP-NEXT: addi sp, sp, -16 | ||
| ; RV32IZCMP-WITH-FP-NEXT: .cfi_def_cfa_offset 16 | ||
| ; RV32IZCMP-WITH-FP-NEXT: sw ra, 12(sp) # 4-byte Folded Spill | ||
| ; RV32IZCMP-WITH-FP-NEXT: sw s0, 8(sp) # 4-byte Folded Spill | ||
| ; RV32IZCMP-WITH-FP-NEXT: sw s4, 4(sp) # 4-byte Folded Spill | ||
| ; RV32IZCMP-WITH-FP-NEXT: sw s11, 4(sp) # 4-byte Folded Spill | ||
| ; RV32IZCMP-WITH-FP-NEXT: .cfi_offset ra, -4 | ||
| ; RV32IZCMP-WITH-FP-NEXT: .cfi_offset s0, -8 | ||
| ; RV32IZCMP-WITH-FP-NEXT: .cfi_offset s4, -12 | ||
| ; RV32IZCMP-WITH-FP-NEXT: .cfi_offset s11, -12 | ||
| ; RV32IZCMP-WITH-FP-NEXT: addi s0, sp, 16 | ||
| ; RV32IZCMP-WITH-FP-NEXT: .cfi_def_cfa s0, 0 | ||
| ; RV32IZCMP-WITH-FP-NEXT: #APP | ||
| ; RV32IZCMP-WITH-FP-NEXT: li s4, 0 | ||
| ; RV32IZCMP-WITH-FP-NEXT: li s11, 0 | ||
| ; RV32IZCMP-WITH-FP-NEXT: #NO_APP | ||
| ; RV32IZCMP-WITH-FP-NEXT: lw ra, 12(sp) # 4-byte Folded Reload | ||
| ; RV32IZCMP-WITH-FP-NEXT: lw s0, 8(sp) # 4-byte Folded Reload | ||
| ; RV32IZCMP-WITH-FP-NEXT: lw s4, 4(sp) # 4-byte Folded Reload | ||
| ; RV32IZCMP-WITH-FP-NEXT: lw s11, 4(sp) # 4-byte Folded Reload | ||
| ; RV32IZCMP-WITH-FP-NEXT: addi sp, sp, 16 | ||
| ; RV32IZCMP-WITH-FP-NEXT: ret | ||
| ; | ||
| ; RV64I-LABEL: foo: | ||
| ; RV64I: # %bb.0: # %entry | ||
| ; RV64I-NEXT: addi sp, sp, -16 | ||
| ; RV64I-NEXT: .cfi_def_cfa_offset 16 | ||
| ; RV64I-NEXT: sd s4, 8(sp) # 8-byte Folded Spill | ||
| ; RV64I-NEXT: .cfi_offset s4, -8 | ||
| ; RV64I-NEXT: sd s11, 8(sp) # 8-byte Folded Spill | ||
| ; RV64I-NEXT: .cfi_offset s11, -8 | ||
| ; RV64I-NEXT: #APP | ||
| ; RV64I-NEXT: li s4, 0 | ||
| ; RV64I-NEXT: li s11, 0 | ||
| ; RV64I-NEXT: #NO_APP | ||
| ; RV64I-NEXT: ld s4, 8(sp) # 8-byte Folded Reload | ||
| ; RV64I-NEXT: ld s11, 8(sp) # 8-byte Folded Reload | ||
| ; RV64I-NEXT: addi sp, sp, 16 | ||
| ; RV64I-NEXT: ret | ||
| ; | ||
|
|
@@ -2078,53 +2078,53 @@ define void @foo() { | |
| ; RV64I-WITH-FP-NEXT: .cfi_def_cfa_offset 32 | ||
| ; RV64I-WITH-FP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill | ||
| ; RV64I-WITH-FP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill | ||
| ; RV64I-WITH-FP-NEXT: sd s4, 8(sp) # 8-byte Folded Spill | ||
| ; RV64I-WITH-FP-NEXT: sd s11, 8(sp) # 8-byte Folded Spill | ||
| ; RV64I-WITH-FP-NEXT: .cfi_offset ra, -8 | ||
| ; RV64I-WITH-FP-NEXT: .cfi_offset s0, -16 | ||
| ; RV64I-WITH-FP-NEXT: .cfi_offset s4, -24 | ||
| ; RV64I-WITH-FP-NEXT: .cfi_offset s11, -24 | ||
| ; RV64I-WITH-FP-NEXT: addi s0, sp, 32 | ||
| ; RV64I-WITH-FP-NEXT: .cfi_def_cfa s0, 0 | ||
| ; RV64I-WITH-FP-NEXT: #APP | ||
| ; RV64I-WITH-FP-NEXT: li s4, 0 | ||
| ; RV64I-WITH-FP-NEXT: li s11, 0 | ||
| ; RV64I-WITH-FP-NEXT: #NO_APP | ||
| ; RV64I-WITH-FP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload | ||
| ; RV64I-WITH-FP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload | ||
| ; RV64I-WITH-FP-NEXT: ld s4, 8(sp) # 8-byte Folded Reload | ||
| ; RV64I-WITH-FP-NEXT: ld s11, 8(sp) # 8-byte Folded Reload | ||
| ; RV64I-WITH-FP-NEXT: addi sp, sp, 32 | ||
| ; RV64I-WITH-FP-NEXT: ret | ||
| ; | ||
| ; RV64IZCMP-LABEL: foo: | ||
| ; RV64IZCMP: # %bb.0: # %entry | ||
| ; RV64IZCMP-NEXT: cm.push {ra, s0-s4}, -48 | ||
| ; RV64IZCMP-NEXT: .cfi_def_cfa_offset 48 | ||
| ; RV64IZCMP-NEXT: .cfi_offset s4, -8 | ||
| ; RV64IZCMP-NEXT: cm.push {ra, s0-s11}, -112 | ||
| ; RV64IZCMP-NEXT: .cfi_def_cfa_offset 112 | ||
| ; RV64IZCMP-NEXT: .cfi_offset s11, -8 | ||
| ; RV64IZCMP-NEXT: #APP | ||
| ; RV64IZCMP-NEXT: li s4, 0 | ||
| ; RV64IZCMP-NEXT: li s11, 0 | ||
| ; RV64IZCMP-NEXT: #NO_APP | ||
| ; RV64IZCMP-NEXT: cm.popret {ra, s0-s4}, 48 | ||
| ; RV64IZCMP-NEXT: cm.popret {ra, s0-s11}, 112 | ||
| ; | ||
| ; RV64IZCMP-WITH-FP-LABEL: foo: | ||
| ; RV64IZCMP-WITH-FP: # %bb.0: # %entry | ||
| ; RV64IZCMP-WITH-FP-NEXT: addi sp, sp, -32 | ||
| ; RV64IZCMP-WITH-FP-NEXT: .cfi_def_cfa_offset 32 | ||
| ; RV64IZCMP-WITH-FP-NEXT: sd ra, 24(sp) # 8-byte Folded Spill | ||
| ; RV64IZCMP-WITH-FP-NEXT: sd s0, 16(sp) # 8-byte Folded Spill | ||
| ; RV64IZCMP-WITH-FP-NEXT: sd s4, 8(sp) # 8-byte Folded Spill | ||
| ; RV64IZCMP-WITH-FP-NEXT: sd s11, 8(sp) # 8-byte Folded Spill | ||
| ; RV64IZCMP-WITH-FP-NEXT: .cfi_offset ra, -8 | ||
| ; RV64IZCMP-WITH-FP-NEXT: .cfi_offset s0, -16 | ||
| ; RV64IZCMP-WITH-FP-NEXT: .cfi_offset s4, -24 | ||
| ; RV64IZCMP-WITH-FP-NEXT: .cfi_offset s11, -24 | ||
| ; RV64IZCMP-WITH-FP-NEXT: addi s0, sp, 32 | ||
| ; RV64IZCMP-WITH-FP-NEXT: .cfi_def_cfa s0, 0 | ||
| ; RV64IZCMP-WITH-FP-NEXT: #APP | ||
| ; RV64IZCMP-WITH-FP-NEXT: li s4, 0 | ||
| ; RV64IZCMP-WITH-FP-NEXT: li s11, 0 | ||
| ; RV64IZCMP-WITH-FP-NEXT: #NO_APP | ||
| ; RV64IZCMP-WITH-FP-NEXT: ld ra, 24(sp) # 8-byte Folded Reload | ||
| ; RV64IZCMP-WITH-FP-NEXT: ld s0, 16(sp) # 8-byte Folded Reload | ||
| ; RV64IZCMP-WITH-FP-NEXT: ld s4, 8(sp) # 8-byte Folded Reload | ||
| ; RV64IZCMP-WITH-FP-NEXT: ld s11, 8(sp) # 8-byte Folded Reload | ||
| ; RV64IZCMP-WITH-FP-NEXT: addi sp, sp, 32 | ||
| ; RV64IZCMP-WITH-FP-NEXT: ret | ||
| entry: | ||
| tail call void asm sideeffect "li s4, 0", "~{s4}"() | ||
| tail call void asm sideeffect "li s11, 0", "~{s11}"() | ||
|
Member
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. Add one more function instead of updating this?
Contributor
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. Done. |
||
| 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,21 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 | ||
| ; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+f,+zcmp -verify-machineinstrs < %s | FileCheck %s | ||
|
|
||
| ; Test the file could be compiled successfully. | ||
| define void @bar() { | ||
| ; CHECK-LABEL: bar: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: addi sp, sp, -16 | ||
| ; CHECK-NEXT: .cfi_def_cfa_offset 16 | ||
| ; CHECK-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill | ||
| ; CHECK-NEXT: .cfi_offset fs0, -4 | ||
| ; CHECK-NEXT: #APP | ||
| ; CHECK-NEXT: fmv.w.x fs0, zero | ||
| ; CHECK-NEXT: #NO_APP | ||
| ; CHECK-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload | ||
| ; CHECK-NEXT: addi sp, sp, 16 | ||
| ; CHECK-NEXT: ret | ||
| entry: | ||
| tail call void asm sideeffect "fmv.w.x fs0, zero", "~{fs0}"() | ||
| ret void | ||
| } |
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.
Comment need to update to reflect the update.
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.
Done.