test_ ## testnum: \
code; \
li x29, correctval; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
bne testreg, x29, fail;
#define TEST_CASE_JUMP( testnum, testreg, correctval, code... ) \
test_ ## testnum: \
code; \
li x29, correctval; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
beq testreg, x29, pass_ ## testnum; \
j fail; \
pass_ ## testnum: \
#define TEST_LD_DEST_BYPASS( testnum, nop_cycles, inst, result, offset, base ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: la x1, base; \
inst x3, offset(x1); \
#define TEST_LD_SRC1_BYPASS( testnum, nop_cycles, inst, result, offset, base ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: la x1, base; \
TEST_INSERT_NOPS_ ## nop_cycles \
#define TEST_ST_SRC12_BYPASS( testnum, src1_nops, src2_nops, load_inst, store_inst, result, offset, base ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: la x1, result; \
TEST_INSERT_NOPS_ ## src1_nops \
#define TEST_ST_SRC21_BYPASS( testnum, src1_nops, src2_nops, load_inst, store_inst, result, offset, base ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: la x2, base; \
TEST_INSERT_NOPS_ ## src1_nops \
#define TEST_BR1_OP_TAKEN( testnum, inst, val1 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x1, val1; \
inst x1, 2f; \
- bne x0, x28, fail; \
-1: bne x0, x28, 3f; \
+ bne x0, TESTNUM, fail; \
+1: bne x0, TESTNUM, 3f; \
2: inst x1, 1b; \
- bne x0, x28, fail; \
+ bne x0, TESTNUM, fail; \
3:
#define TEST_BR1_OP_NOTTAKEN( testnum, inst, val1 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x1, val1; \
inst x1, 1f; \
- bne x0, x28, 2f; \
-1: bne x0, x28, fail; \
+ bne x0, TESTNUM, 2f; \
+1: bne x0, TESTNUM, fail; \
2: inst x1, 1b; \
3:
#define TEST_BR1_SRC1_BYPASS( testnum, nop_cycles, inst, val1 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: li x1, val1; \
TEST_INSERT_NOPS_ ## nop_cycles \
#define TEST_BR2_OP_TAKEN( testnum, inst, val1, val2 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x1, val1; \
li x2, val2; \
inst x1, x2, 2f; \
- bne x0, x28, fail; \
-1: bne x0, x28, 3f; \
+ bne x0, TESTNUM, fail; \
+1: bne x0, TESTNUM, 3f; \
2: inst x1, x2, 1b; \
- bne x0, x28, fail; \
+ bne x0, TESTNUM, fail; \
3:
#define TEST_BR2_OP_NOTTAKEN( testnum, inst, val1, val2 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x1, val1; \
li x2, val2; \
inst x1, x2, 1f; \
- bne x0, x28, 2f; \
-1: bne x0, x28, fail; \
+ bne x0, TESTNUM, 2f; \
+1: bne x0, TESTNUM, fail; \
2: inst x1, x2, 1b; \
3:
#define TEST_BR2_SRC12_BYPASS( testnum, src1_nops, src2_nops, inst, val1, val2 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: li x1, val1; \
TEST_INSERT_NOPS_ ## src1_nops \
#define TEST_BR2_SRC21_BYPASS( testnum, src1_nops, src2_nops, inst, val1, val2 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: li x2, val2; \
TEST_INSERT_NOPS_ ## src1_nops \
#define TEST_JR_SRC1_BYPASS( testnum, nop_cycles, inst ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: la x6, 2f; \
TEST_INSERT_NOPS_ ## nop_cycles \
inst x6; \
- bne x0, x28, fail; \
+ bne x0, TESTNUM, fail; \
2: addi x4, x4, 1; \
li x5, 2; \
bne x4, x5, 1b \
#define TEST_JALR_SRC1_BYPASS( testnum, nop_cycles, inst ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
li x4, 0; \
1: la x6, 2f; \
TEST_INSERT_NOPS_ ## nop_cycles \
inst x19, x6, 0; \
- bne x0, x28, fail; \
+ bne x0, TESTNUM, fail; \
2: addi x4, x4, 1; \
li x5, 2; \
bne x4, x5, 1b \
#define TEST_FP_OP_S_INTERNAL( testnum, result, val1, val2, val3, code... ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
la a0, test_ ## testnum ## _data ;\
flw f0, 0(a0); \
flw f1, 4(a0); \
#define TEST_FP_OP_D_INTERNAL( testnum, result, val1, val2, val3, code... ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
la a0, test_ ## testnum ## _data ;\
fld f0, 0(a0); \
fld f1, 8(a0); \
#define TEST_INT_FP_OP_S( testnum, inst, result, val1 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
la a0, test_ ## testnum ## _data ;\
lw a3, 0(a0); \
li a0, val1; \
#define TEST_INT_FP_OP_D( testnum, inst, result, val1 ) \
test_ ## testnum: \
- li x28, testnum; \
+ li TESTNUM, testnum; \
la a0, test_ ## testnum ## _data ;\
ld a3, 0(a0); \
li a0, val1; \
stop; \
handler ## testnum: \
vxcptkill; \
- li x28,2; \
+ li TESTNUM,2; \
vxcptcause a0; \
li a1,HWACHA_CAUSE_TVEC_ILLEGAL_REGID; \
bne a0,a1,fail; \
fence; \
ld a1,0(a3); \
li a2,5; \
- li x28,2; \
+ li TESTNUM,2; \
bne a1,a2,fail; \
ld a1,8(a3); \
- li x28,3; \
+ li TESTNUM,3; \
bne a1,a2,fail; \
ld a1,16(a3); \
- li x28,4; \
+ li TESTNUM,4; \
bne a1,a2,fail; \
ld a1,24(a3); \
- li x28,5; \
+ li TESTNUM,5; \
bne a1,a2,fail; \
#define TEST_ILLEGAL_VT_REGID( testnum, nxreg, nfreg, inst, reg1, reg2, reg3) \
stop; \
handler ## testnum: \
vxcptkill; \
- li x28,2; \
+ li TESTNUM,2; \
vxcptcause a0; \
li a1,HWACHA_CAUSE_VF_ILLEGAL_REGID; \
bne a0,a1,fail; \
fence; \
ld a1,0(a3); \
li a2,5; \
- li x28,2; \
+ li TESTNUM,2; \
bne a1,a2,fail; \
ld a1,8(a3); \
- li x28,3; \
+ li TESTNUM,3; \
bne a1,a2,fail; \
ld a1,16(a3); \
- li x28,4; \
+ li TESTNUM,4; \
bne a1,a2,fail; \
ld a1,24(a3); \
- li x28,5; \
+ li TESTNUM,5; \
bne a1,a2,fail; \
#-----------------------------------------------------------------------
-# Pass and fail code (assumes test num is in x28)
+# Pass and fail code (assumes test num is in TESTNUM)
#-----------------------------------------------------------------------
#define TEST_PASSFAIL \
- bne x0, x28, pass; \
+ bne x0, TESTNUM, pass; \
fail: \
RVTEST_FAIL \
pass: \
fence; \
li a1,correctval; \
li a2,0; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
test_loop ## testnum: \
ld a0,0(a4); \
beq a0,a1,skip ## testnum; \
fence; \
lw a1, 0(a5); \
li a2, 0; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
test_loop ## testnum: \
lw a0,0(a4); \
beq a0,a1,skip ## testnum; \
fence; \
ld a1, 0(a5); \
li a2, 0; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
test_loop ## testnum: \
ld a0,0(a4); \
beq a0,a1,skip ## testnum; \
la a5, test_ ## testnum ## _data ;\
lw a1, 0(a5); \
li a2, 0; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
test_loop ## testnum: \
lw a0,0(a4); \
beq a0,a1,skip ## testnum; \
la a5, test_ ## testnum ## _data ;\
ld a1, 0(a5); \
li a2, 0; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
test_loop ## testnum: \
ld a0,0(a4); \
beq a0,a1,skip ## testnum; \
fence; \
li a1,correctval; \
li a2,0; \
- li x28, testnum; \
+ li TESTNUM, testnum; \
test_loop ## testnum: \
ld a0,0(a4); \
beq a0,a1,skip ## testnum; \
)
#-----------------------------------------------------------------------
-# Pass and fail code (assumes test num is in x28)
+# Pass and fail code (assumes test num is in TESTNUM)
#-----------------------------------------------------------------------
#define TEST_PASSFAIL \
- bne x0, x28, pass; \
+ bne x0, TESTNUM, pass; \
fail: \
RVTEST_FAIL \
pass: \