Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
target/hexagon: import additional tests
Signed-off-by: Alessandro Di Federico <ale@rev.ng> Signed-off-by: Niccolò Izzo <nizzo@rev.ng> Signed-off-by: Anton Johansson <anjo@rev.ng> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20220923173831.227551-12-anjo@rev.ng>
- Loading branch information
1 parent
e71fdc4
commit 585a86b
Showing
27 changed files
with
766 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#define SYS_exit_group 94 | ||
|
||
.text | ||
.globl pass | ||
pass: | ||
r0 = #0 | ||
r6 = #SYS_exit_group | ||
trap0(#1) | ||
|
||
.globl fail | ||
fail: | ||
r0 = #1 | ||
r6 = #SYS_exit_group | ||
trap0(#1) |
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,17 @@ | ||
/* Purpose: test example, verify the soundness of the abs operation */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
r1 = #-2 | ||
r2 = #2 | ||
} | ||
{ | ||
r3 = abs(r1) | ||
} | ||
{ | ||
p0 = cmp.eq(r3, r2); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,40 @@ | ||
/* | ||
* Purpose: test example, verify the soundness of the cl[01] operations. | ||
* | ||
* The number 0x000001aa has 23 leading zeroes | ||
* they become 55 when considered as 64 bit register | ||
* and it has 1 trailing zero. | ||
*/ | ||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
r0 = #426 | ||
r1 = #0 | ||
} | ||
{ | ||
r2 = cl0(r0) | ||
} | ||
{ | ||
p0 = cmp.eq(r2, #23); if (p0.new) jump:t test2 | ||
jump fail | ||
} | ||
|
||
test2: | ||
{ | ||
r2 = cl0(r1:0) | ||
} | ||
{ | ||
p0 = cmp.eq(r2, #55); if (p0.new) jump:t test3 | ||
jump fail | ||
} | ||
|
||
test3: | ||
{ | ||
r2 = ct0(r0) | ||
} | ||
{ | ||
p0 = cmp.eq(r2, #1); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,22 @@ | ||
/* Purpose: test example, verify the soundness of the bitsplit operation */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
r1 = #187 | ||
} | ||
{ | ||
r3:2 = bitsplit(r1, #3) | ||
} | ||
{ | ||
p0 = cmp.eq(r2, #3); if (p0.new) jump:t test2 | ||
jump fail | ||
} | ||
|
||
test2: | ||
{ | ||
p0 = cmp.eq(r3, #23); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,64 @@ | ||
/* | ||
* Purpose: test function calls and duplex instructions. | ||
* The string "Hello there, I'm a test string!" with the first letter replaced | ||
* with a capital L should be printed out. | ||
*/ | ||
|
||
#define SYS_write 64 | ||
#define FD_STDOUT 1 | ||
|
||
.text | ||
.globl test | ||
test: | ||
{ | ||
jumpr r31 | ||
memb(r0+#0) = #76 | ||
} | ||
.Lfunc_end0: | ||
.Ltmp0: | ||
.size test, .Ltmp0-test | ||
|
||
.globl _start | ||
_start: | ||
{ | ||
r0 = ##dummy_buffer | ||
allocframe(#0) | ||
call test | ||
} | ||
{ | ||
call write | ||
} | ||
{ | ||
deallocframe | ||
jump pass | ||
} | ||
.Lfunc_end1: | ||
.Ltmp1: | ||
.size _start, .Ltmp1-_start | ||
|
||
write: | ||
{ | ||
r6 = #SYS_write | ||
r0 = #FD_STDOUT | ||
r1 = ##dummy_buffer | ||
r2 = #33 | ||
} | ||
{ | ||
trap0(#1) | ||
} | ||
{ | ||
jumpr r31 | ||
} | ||
|
||
.Lfunc_end2: | ||
.Ltmp2: | ||
.size write, .Ltmp2-write | ||
|
||
.type dummy_buffer,@object | ||
.data | ||
.globl dummy_buffer | ||
.p2align 3 | ||
dummy_buffer: | ||
.string "Hello there, I'm a test string!\n" | ||
.space 223 | ||
.size dummy_buffer, 256 |
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,29 @@ | ||
/* | ||
* Purpose: demonstrate the succesful operation of the register save mechanism, | ||
* in which the caller saves the registers that will be clobbered, and restores | ||
* them after the call. | ||
*/ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
allocframe(#8) | ||
{ | ||
r16 = #47 | ||
r17 = #155 | ||
} | ||
memd(sp+#0) = r17:16 | ||
{ | ||
r16 = #255 | ||
r17 = #42 | ||
} | ||
{ | ||
deallocframe | ||
r17:16 = memd(sp+#0) | ||
} | ||
{ | ||
p0 = cmp.eq(r16, #47) | ||
p0 = cmp.eq(r17, #155); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,31 @@ | ||
/* Purpose: test a signed and unsigned comparison */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
jump signed | ||
} | ||
|
||
.globl signed | ||
signed: | ||
{ | ||
r0 = #-2 | ||
r1 = #0 | ||
} | ||
{ | ||
p0 = cmp.lt(r0, r1); if (p0.new) jump:t unsigned | ||
jump fail | ||
} | ||
|
||
.globl unsigned | ||
unsigned: | ||
{ | ||
r0 = #-2 | ||
r1 = #0 | ||
} | ||
{ | ||
p0 = cmp.gtu(r0, r1); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,38 @@ | ||
/* Purpose: test the .new operator while performing memory stores. */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
allocframe(#16) | ||
} | ||
{ | ||
r0 = #1 | ||
memw(sp+#0) = r0.new | ||
} | ||
{ | ||
r1 = #2 | ||
memw(sp+#4) = r1.new | ||
} | ||
{ | ||
r2 = #3 | ||
memw(sp+#8) = r2.new | ||
} | ||
{ | ||
r0 = memw(sp+#8) | ||
} | ||
{ | ||
r1 = memw(sp+#4) | ||
} | ||
{ | ||
r2 = memw(sp+#0) | ||
} | ||
{ | ||
r3 = mpyi(r1, r2) | ||
} | ||
{ | ||
deallocframe | ||
p0 = cmp.eq(r3, #2); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,13 @@ | ||
/* Purpose: test immediate extender instructions. */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
r2 = ##-559038737 | ||
} | ||
{ | ||
p0 = cmp.eq(r2, ##-559038737); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,30 @@ | ||
/* Purpose: computes the Fibonacci series up to a constant number. */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
r2 = #100 | ||
} | ||
{ | ||
p0 = cmp.gt(r2, #0); if (!p0.new) jump:nt .LBB0_3 | ||
} | ||
{ | ||
r3 = #0 | ||
r4 = #1 | ||
} | ||
.LBB0_2: | ||
{ | ||
r5 = r4 | ||
} | ||
{ | ||
p0 = cmp.gt(r2, r5); if (p0.new) jump:nt .LBB0_2 | ||
r4 = add(r3, r4) | ||
r3 = r5 | ||
} | ||
.LBB0_3: | ||
{ | ||
p0 = cmp.eq(r3, #144); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,16 @@ | ||
/* Purpose: test example, verify the soundness of the high/low assignment */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
r0.H = #42 | ||
} | ||
{ | ||
r0.L = #69 | ||
} | ||
{ | ||
p0 = cmp.eq(r0, #2752581); if (p0.new) jump:t pass | ||
jump fail | ||
} |
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,19 @@ | ||
/* Purpose: simple C Program to test hardware loops. */ | ||
|
||
.text | ||
.globl _start | ||
|
||
_start: | ||
{ | ||
loop0(.LBB0_1, #10) | ||
r2 = #0 | ||
} | ||
.LBB0_1: | ||
{ | ||
r2 = add(r2, #1) | ||
nop | ||
}:endloop0 | ||
{ | ||
p0 = cmp.eq(r2, #10); if (p0.new) jump:t pass | ||
jump fail | ||
} |
Oops, something went wrong.