forked from paritytech/polkavm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guest-programs/riscv-tests: Add risc-v Zbb instruction set tests
Signed-off-by: Aman <[email protected]>
- Loading branch information
Showing
130 changed files
with
2,745 additions
and
2 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,26 @@ | ||
#======================================================================= | ||
# Makefrag for rv32uzbb tests | ||
#----------------------------------------------------------------------- | ||
|
||
rv32uzbb_sc_tests = \ | ||
andn \ | ||
clz \ | ||
cpop \ | ||
ctz \ | ||
max maxu \ | ||
min minu \ | ||
orc_b \ | ||
orn \ | ||
rev8 \ | ||
rol \ | ||
ror \ | ||
rori \ | ||
sext_b sext_h \ | ||
xnor \ | ||
zext_h \ | ||
|
||
rv32uzbb_p_tests = $(addprefix rv32uzbb-p-, $(rv32uzbb_sc_tests)) | ||
rv32uzbb_v_tests = $(addprefix rv32uzbb-v-, $(rv32uzbb_sc_tests)) | ||
rv32uzbb_ps_tests = $(addprefix rv32uzbb-ps-, $(rv32uzbb_sc_tests)) | ||
|
||
spike_tests += $(rv32uzbb_p_tests) $(rv32uzbb_v_tests) |
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,7 @@ | ||
# See LICENSE for license details. | ||
|
||
#include "riscv_test.h" | ||
#undef RVTEST_RV64U | ||
#define RVTEST_RV64U RVTEST_RV32U | ||
|
||
#include "../rv64uzbb/andn.S" |
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,76 @@ | ||
# See LICENSE for license details. | ||
|
||
#***************************************************************************** | ||
# clz.S | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Test clz instruction. | ||
# | ||
|
||
#include "riscv_test.h" | ||
#include "test_macros.h" | ||
|
||
RVTEST_RV32U | ||
RVTEST_CODE_BEGIN | ||
|
||
#------------------------------------------------------------- | ||
# Arithmetic tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_OP( 2, clz, 32, 0x00000000); | ||
TEST_R_OP( 3, clz, 31, 0x00000001); | ||
TEST_R_OP( 4, clz, 30, 0x00000003); | ||
|
||
TEST_R_OP( 5, clz, 0, 0xffff8000 ); | ||
TEST_R_OP( 6, clz, 8, 0x00800000 ); | ||
TEST_R_OP( 7, clz, 0, 0xffff8000 ); | ||
|
||
TEST_R_OP( 8, clz, 17, 0x00007fff); | ||
TEST_R_OP( 9, clz, 1, 0x7fffffff); | ||
TEST_R_OP( 10, clz, 13, 0x0007ffff ); | ||
|
||
TEST_R_OP( 11, clz, 0, 0x80000000); | ||
TEST_R_OP( 12, clz, 3, 0x121f5000); | ||
|
||
TEST_R_OP( 13, clz, 5, 0x04000000); | ||
TEST_R_OP( 14, clz, 28, 0x0000000e); | ||
TEST_R_OP( 15, clz, 2, 0x20401341); | ||
|
||
#------------------------------------------------------------- | ||
# Source/Destination tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_SRC1_EQ_DEST( 16, clz, 28, 13); | ||
TEST_R_SRC1_EQ_DEST( 17, clz, 28, 11); | ||
|
||
#------------------------------------------------------------- | ||
# Bypassing tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_DEST_BYPASS( 18, 0, clz, 28, 13); | ||
TEST_R_DEST_BYPASS( 29, 1, clz, 27, 19); | ||
TEST_R_DEST_BYPASS( 20, 2, clz, 26, 34); | ||
|
||
#------------------------------------------------------------- | ||
# Other tests | ||
#------------------------------------------------------------- | ||
|
||
|
||
TEST_R_OP( 21, clz, 5, 0x070f8000 ); | ||
TEST_R_OP( 22, clz, 4, 0x08008000 ); | ||
TEST_R_OP( 23, clz, 3, 0x18008000 ); | ||
|
||
TEST_R_OP( 24, clz, 17, 0x00007fff); | ||
TEST_R_OP( 25, clz, 1, 0x7fffffff); | ||
TEST_R_OP( 26, clz, 13, 0x0007ffff); | ||
|
||
TEST_PASSFAIL | ||
|
||
RVTEST_CODE_END | ||
|
||
.data | ||
RVTEST_DATA_BEGIN | ||
|
||
TEST_DATA | ||
|
||
RVTEST_DATA_END |
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,75 @@ | ||
# See LICENSE for license details. | ||
|
||
#***************************************************************************** | ||
# cpop.S | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Test cpop instruction. | ||
# | ||
|
||
#include "riscv_test.h" | ||
#include "test_macros.h" | ||
|
||
RVTEST_RV32U | ||
RVTEST_CODE_BEGIN | ||
|
||
#------------------------------------------------------------- | ||
# Arithmetic tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_OP( 2, cpop, 0, 0x00000000); | ||
TEST_R_OP( 3, cpop, 1, 0x00000001); | ||
TEST_R_OP( 4, cpop, 2, 0x00000003); | ||
|
||
TEST_R_OP( 5, cpop, 17, 0xffff8000 ); | ||
TEST_R_OP( 6, cpop, 1, 0x00800000 ); | ||
TEST_R_OP( 7, cpop, 18, 0xffff6000 ); | ||
|
||
TEST_R_OP( 8, cpop, 15, 0x00007fff); | ||
TEST_R_OP( 9, cpop, 31, 0x7fffffff); | ||
TEST_R_OP( 10, cpop, 19, 0x0007ffff ); | ||
|
||
TEST_R_OP( 11, cpop, 1, 0x80000000); | ||
TEST_R_OP( 12, cpop, 9, 0x121f5000); | ||
|
||
TEST_R_OP( 13, cpop, 0, 0x00000000); | ||
TEST_R_OP( 14, cpop, 3, 0x0000000e); | ||
TEST_R_OP( 15, cpop, 7, 0x20401341); | ||
|
||
#------------------------------------------------------------- | ||
# Source/Destination tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_SRC1_EQ_DEST( 16, cpop, 3, 13); | ||
TEST_R_SRC1_EQ_DEST( 17, cpop, 3, 11); | ||
|
||
#------------------------------------------------------------- | ||
# Bypassing tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_DEST_BYPASS( 18, 0, cpop, 3, 13); | ||
TEST_R_DEST_BYPASS( 29, 1, cpop, 3, 19); | ||
TEST_R_DEST_BYPASS( 20, 2, cpop, 2, 34); | ||
|
||
#------------------------------------------------------------- | ||
# Other tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_OP( 21, cpop, 8, 0x007f8000 ); | ||
TEST_R_OP( 22, cpop, 2, 0x00808000 ); | ||
TEST_R_OP( 23, cpop, 3, 0x01808000 ); | ||
|
||
TEST_R_OP( 24, cpop, 17, 0x30007fff); | ||
TEST_R_OP( 25, cpop, 30, 0x77ffffff); | ||
TEST_R_OP( 26, cpop, 19, 0x0007ffff); | ||
|
||
TEST_PASSFAIL | ||
|
||
RVTEST_CODE_END | ||
|
||
.data | ||
RVTEST_DATA_BEGIN | ||
|
||
TEST_DATA | ||
|
||
RVTEST_DATA_END |
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,75 @@ | ||
# See LICENSE for license details. | ||
|
||
#***************************************************************************** | ||
# ctz.S | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Test ctz instruction. | ||
# | ||
|
||
#include "riscv_test.h" | ||
#include "test_macros.h" | ||
|
||
RVTEST_RV32U | ||
RVTEST_CODE_BEGIN | ||
|
||
#------------------------------------------------------------- | ||
# Arithmetic tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_OP( 2, ctz, 32, 0x00000000); | ||
TEST_R_OP( 3, ctz, 0, 0x00000001); | ||
TEST_R_OP( 4, ctz, 0, 0x00000003); | ||
|
||
TEST_R_OP( 5, ctz, 15, 0xffff8000 ); | ||
TEST_R_OP( 6, ctz, 23, 0x00800000 ); | ||
TEST_R_OP( 7, ctz, 15, 0xffff8000 ); | ||
|
||
TEST_R_OP( 8, ctz, 0, 0x00007fff); | ||
TEST_R_OP( 9, ctz, 0, 0x7fffffff); | ||
TEST_R_OP( 10, ctz, 0, 0x0007ffff ); | ||
|
||
TEST_R_OP( 11, ctz, 31, 0x80000000); | ||
TEST_R_OP( 12, ctz, 12, 0x121f5000); | ||
|
||
TEST_R_OP( 13, ctz, 30, 0xc0000000); | ||
TEST_R_OP( 14, ctz, 1, 0x0000000e); | ||
TEST_R_OP( 15, ctz, 0, 0x20401341); | ||
|
||
#------------------------------------------------------------- | ||
# Source/Destination tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_SRC1_EQ_DEST( 16, ctz, 0, 13); | ||
TEST_R_SRC1_EQ_DEST( 17, ctz, 0, 11); | ||
|
||
#------------------------------------------------------------- | ||
# Bypassing tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_DEST_BYPASS( 18, 0, ctz, 0, 13); | ||
TEST_R_DEST_BYPASS( 29, 1, ctz, 0, 19); | ||
TEST_R_DEST_BYPASS( 20, 2, ctz, 1, 34); | ||
|
||
#------------------------------------------------------------- | ||
# Other tests | ||
#------------------------------------------------------------- | ||
|
||
TEST_R_OP( 21, ctz, 15, 0x007f8000 ); | ||
TEST_R_OP( 22, ctz, 15, 0x00808000 ); | ||
TEST_R_OP( 23, ctz, 12, 0x01809000 ); | ||
|
||
TEST_R_OP( 24, ctz, 0, 0x00007fff); | ||
TEST_R_OP( 25, ctz, 0, 0x7fffffff); | ||
TEST_R_OP( 26, ctz, 0, 0x0007ffff); | ||
|
||
TEST_PASSFAIL | ||
|
||
RVTEST_CODE_END | ||
|
||
.data | ||
RVTEST_DATA_BEGIN | ||
|
||
TEST_DATA | ||
|
||
RVTEST_DATA_END |
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,7 @@ | ||
# See LICENSE for license details. | ||
|
||
#include "riscv_test.h" | ||
#undef RVTEST_RV64U | ||
#define RVTEST_RV64U RVTEST_RV32U | ||
|
||
#include "../rv64uzbb/max.S" |
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,7 @@ | ||
# See LICENSE for license details. | ||
|
||
#include "riscv_test.h" | ||
#undef RVTEST_RV64U | ||
#define RVTEST_RV64U RVTEST_RV32U | ||
|
||
#include "../rv64uzbb/maxu.S" |
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,7 @@ | ||
# See LICENSE for license details. | ||
|
||
#include "riscv_test.h" | ||
#undef RVTEST_RV64U | ||
#define RVTEST_RV64U RVTEST_RV32U | ||
|
||
#include "../rv64uzbb/min.S" |
Oops, something went wrong.