-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Mips] Fix unable to handle inline assembly ends with compat-branch o… #77291
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,71 @@ | ||
target triple = "mipsisa32r6el-unknown-linux-gnu" | ||
|
||
; RUN: llc -filetype=asm %s -o - | FileCheck %s --check-prefix=MIPSELR6 | ||
; Function Attrs: noinline nounwind optnone uwtable | ||
define i1 @foo0() nounwind { | ||
; MIPSELR6: bnezc $1, $BB0_2 | ||
; MIPSELR6-NEXT: nop | ||
; MIPSELR6: jr $ra | ||
entry: | ||
%0 = icmp eq i32 0, 1 | ||
br i1 %0, label %2, label %3 | ||
ret i1 %0 | ||
2: | ||
ret i1 %0 | ||
3: | ||
ret i1 %0 | ||
} | ||
|
||
define i32 @foo1() nounwind { | ||
; MIPSELR6: addiu $2, $2, 1 | ||
; MIPSELR6-NEXT: .set noreorder | ||
; MIPSELR6-NEXT: beqzc $2, $tmp0 | ||
; MIPSELR6-NEXT: nop | ||
; MIPSELR6-NEXT: .set reorder | ||
; MIPSELR6: jrc $ra | ||
entry: | ||
%0 = tail call i32 asm "1: addiu $0, $0, 1; beqzc $0, 1b", "=r"() nounwind | ||
ret i32 %0 | ||
} | ||
|
||
define i32 @foo2() nounwind { | ||
; MIPSELR6: .set push | ||
; MIPSELR6-NEXT: .set at | ||
; MIPSELR6-NEXT: .set macro | ||
; MIPSELR6-NEXT: .set reorder | ||
; MIPSELR6: .set noreorder | ||
; MIPSELR6-NEXT: beqzc $9, End | ||
; MIPSELR6-NEXT: nop | ||
; MIPSELR6-NEXT: .set reorder | ||
; MIPSELR6: addiu $9, $9, 1 | ||
entry: | ||
%0 = tail call i32 asm "beqzc $$t1, End", "=r"() nounwind | ||
%1 = tail call i32 asm "addiu $$t1, $$t1, 1", "=r"() nounwind | ||
%2 = add nsw i32 %1, %0 | ||
ret i32 %2 | ||
} | ||
|
||
define i32 @foo3() nounwind { | ||
; MIPSELR6: addiu $2, $2, 1 | ||
; MIPSELR6-NEXT: .set noreorder | ||
; MIPSELR6-NEXT: beqzc $2, $tmp1 | ||
; MIPSELR6-NEXT: nop | ||
; MIPSELR6-NEXT: .set noreorder | ||
; MIPSELR6-NEXT: j End | ||
; MIPSELR6-NEXT: nop | ||
; MIPSELR6-NEXT: .set reorder | ||
entry: | ||
%0 = tail call i32 asm "1: addiu $0, $0, 1; beqzc $0, 1b; j End", "=r"() nounwind | ||
ret i32 %0 | ||
} | ||
|
||
define i32 @foo4() nounwind { | ||
; MIPSELR6: addiu $2, $2, 1 | ||
; MIPSELR6-NEXT: .set noreorder | ||
; MIPSELR6-NEXT: beqzc $2, $tmp2 | ||
; MIPSELR6-NEXT: addiu $2, $2, 1 | ||
; MIPSELR6-NEXT: .set reorder | ||
entry: | ||
%0 = tail call i32 asm "1: addiu $0, $0, 1; beqzc $0, 1b; addiu $0, $0, 1", "=r"() nounwind | ||
ret i32 %0 | ||
} |
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,18 @@ | ||
# RUN: llvm-mc -assemble -mcpu=mips64r6 -arch=mips64el -filetype=obj %s -o tmp.o | ||
# RUN: llvm-objdump -d tmp.o | FileCheck %s --check-prefix=MIPSELR6 | ||
|
||
# MIPSELR6: 0000000000000000 <aaa>: | ||
# MIPSELR6-NEXT: beqzc $13, 0x0 <aaa> | ||
# MIPSELR6-NEXT: b 0x0 <aaa> | ||
# MIPSELR6: 0000000000000008 <bbb>: | ||
# MIPSELR6-NEXT: beqzc $13, 0x8 <bbb> | ||
# MIPSELR6-NEXT: nop <aaa> | ||
# MIPSELR6: b 0x8 <bbb> | ||
.set noreorder | ||
aaa: | ||
beqzc $t1, aaa | ||
b aaa | ||
.set reorder | ||
bbb: | ||
beqzc $t1, bbb | ||
b bbb |
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
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.