diff --git a/Cargo.toml b/Cargo.toml index 3303906..40009e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,9 @@ eyre = "0.6.12" libc = "0.2.170" owo-colors = "4.2.0" +[profile.dev] +opt-level = 1 + [profile.release] debug = 1 diff --git a/tests/check/int_comp.S b/tests/check/int_comp.S index 71753fa..25b0520 100644 --- a/tests/check/int_comp.S +++ b/tests/check/int_comp.S @@ -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 diff --git a/tests/check/zaamo.S b/tests/check/zaamo.S index c91b7a3..c8bca0e 100644 --- a/tests/check/zaamo.S +++ b/tests/check/zaamo.S @@ -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 diff --git a/tests/helper.S b/tests/helper.S index de1e7ca..464b905 100644 --- a/tests/helper.S +++ b/tests/helper.S @@ -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