-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'callnd' no longer executes the following instruction before transfer…
…ing control
- Loading branch information
Showing
7 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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
Binary file not shown.
This file contains 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,36 @@ | ||
; | ||
; Tests 'callnd' doesn't execute the following instructions before the call. | ||
; | ||
; We test this as an .elf because this error didn't show up in binary mode. | ||
; | ||
; Compile with: | ||
; | ||
; patmos-llc test53.ll -filetype=obj -o test53.elf && patmos-ld.lld --nostdlib --static -o test53.elf test53.elf | ||
; | ||
|
||
define i32 @_start() #0 { | ||
entry: | ||
%0 = tail call i32 asm sideeffect " | ||
li $0 = 123 | ||
pmov $$p7 = !$$p0 | ||
callnd test_fn | ||
pmov $$p7 = $$p0 | ||
pmov $$p7 = $$p0 | ||
pmov $$p7 = $$p0 | ||
nop | ||
nop | ||
nop | ||
li $$r0 = 24 | ||
test_fn: | ||
li (!$$p7) $0 = 0 # Set to 0 only if p7 is false | ||
li ( $$p7) $0 = 1 # Set to 1 only if p7 is true | ||
brcf 0 # halt | ||
nop | ||
nop | ||
nop | ||
", "=r"() | ||
ret i32 %0 | ||
} | ||
|
||
attributes #0 = { naked noinline } |
Binary file not shown.
This file contains 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,34 @@ | ||
; | ||
; Tests 'callnd' and 'retnd' work correctly together (returns to the right address). | ||
; | ||
; We test this as an .elf because this error didn't show up in binary mode. | ||
; | ||
; Compile with: | ||
; | ||
; patmos-llc test54.ll -filetype=obj -o test54.elf && patmos-ld.lld --nostdlib --static -o test54.elf test54.elf | ||
; | ||
|
||
define i32 @_start() #0 { | ||
entry: | ||
%0 = tail call i32 asm sideeffect " | ||
li $$r1 = 0 | ||
li $$r2 = 0 | ||
callnd test_fn | ||
li $$r2 = 456 # Checkpoint | ||
brcf 0 # halt | ||
nop | ||
nop | ||
nop | ||
li $$r0 = 24 | ||
test_fn: | ||
li $$r1 = 123 # Checkpoint | ||
retnd | ||
nop | ||
nop | ||
nop | ||
", "=r"() | ||
ret i32 %0 | ||
} | ||
|
||
attributes #0 = { naked noinline } |