improve tests

This commit is contained in:
nora 2025-03-15 12:43:50 +01:00
parent 8989d32ff5
commit a132b481e6
4 changed files with 63 additions and 56 deletions

View file

@ -24,44 +24,6 @@
CASE_BOTH \inst, \inst\()i, \a, \b, \expected
.endm
.macro WITH_SINGLE_TEST_NUMBERS macro
\macro a, 0
\macro c, 1
\macro d, 2
\macro u, 3
\macro e, 4
\macro v, 5
\macro f, 8
\macro t, 10
\macro g, 16
\macro h, 32
\macro i, 64
\macro s, 100
\macro j, 128
\macro k, 256
\macro l, 512
\macro w, 1000
\macro m, 1024
\macro n, 2047
\macro b, -1
\macro o, -2
\macro p, -16
\macro q, -1024
\macro r, -1000
.endm
.macro WITH_TWO_TEST_NUMBERS macro
.macro \macro\()_TMP namea:req a:req
.macro \macro\()_TMP_\namea nameb:req b:req
\macro \a, \b
.endm
WITH_SINGLE_TEST_NUMBERS \macro\()_TMP_\namea
.endm
WITH_SINGLE_TEST_NUMBERS \macro\()_TMP
.endm
START_TEST
# Base instructions

View file

@ -21,28 +21,30 @@
.endm
START_TEST
CASE amoswap.w, 1, 0, 1
CASE amoswap.w, 10, -1, 10
CASE amoswap.w 0, 0, 0
.macro CASE_AMOSWAP a:req b:req
CASE amoswap.w, \a, \b, \a
.endm
WITH_TWO_TEST_NUMBERS CASE_AMOSWAP
CASE amoadd.w, 1, 1, 2
CASE amoadd.w, -1, 1, 0
CASE amoadd.w, 10, -2, 8
.macro CASE_AMOADD a:req b:req
CASE amoadd.w, \a, \b, \a + \b
.endm
WITH_TWO_TEST_NUMBERS CASE_AMOADD
CASE amoand.w, 0b11, 0b11, 0b11
CASE amoand.w, -1, -1, -1
CASE amoand.w, -1, 0, 0
CASE amoand.w, -1, 40, 40
CASE amoand.w, 0b101, 0b100, 0b100
.macro CASE_AMOAND a:req b:req
CASE amoand.w, \a, \b, \a & \b
.endm
WITH_TWO_TEST_NUMBERS CASE_AMOAND
CASE amoor.w, -1, 0, -1
CASE amoor.w, -1, 40, -1
CASE amoor.w, 0, 0, 0
CASE amoor.w, 0b101, 0b110, 0b111
.macro CASE_AMOOR a:req b:req
CASE amoor.w, \a, \b, \a | \b
.endm
WITH_TWO_TEST_NUMBERS CASE_AMOOR
CASE amoxor.w, -1, 0, -1
CASE amoxor.w, -1, -1, 0
CASE amoxor.w, 0b101, 0b100, 0b001
.macro CASE_AMOXOR a:req b:req
CASE amoxor.w, \a, \b, \a ^ \b
.endm
WITH_TWO_TEST_NUMBERS CASE_AMOXOR
CASE amomax.w, 0, 0, 0
CASE amomax.w, 0, 1, 1

View file

@ -19,6 +19,46 @@
j fail
.endm
.macro WITH_SINGLE_TEST_NUMBERS macro
\macro a, 0
\macro c, 1
\macro d, 2
\macro u, 3
\macro e, 4
\macro v, 5
\macro f, 8
\macro t, 10
\macro g, 16
\macro h, 32
\macro i, 64
\macro s, 100
\macro j, 128
\macro k, 256
\macro l, 512
\macro w, 1000
\macro m, 1024
\macro n, 2047
\macro b, -1
\macro o, -2
\macro p, -16
\macro q, -1024
\macro r, -1000
.endm
.macro WITH_TWO_TEST_NUMBERS macro
.macro \macro\()_TMP namea:req a:req
.macro \macro\()_TMP_\namea nameb:req b:req
\macro \a, \b
.endm
WITH_SINGLE_TEST_NUMBERS \macro\()_TMP_\namea
.endm
WITH_SINGLE_TEST_NUMBERS \macro\()_TMP
.endm
fail:
li a7, -1
li a0, 0