diff --git a/riscv-test-suite/env/test_macros.h b/riscv-test-suite/env/test_macros.h index 3c43b5990..1aee495a4 100644 --- a/riscv-test-suite/env/test_macros.h +++ b/riscv-test-suite/env/test_macros.h @@ -179,6 +179,20 @@ or t6, t6, t5 ;\ csrw satp, t6 ; +//Tests for atomic memory operation(AMO) instructions +#define TEST_AMO_OP(inst, destreg, origptr, reg2, origval, updval, sigptr, ...) ;\ + .if NARG(__VA_ARGS__) == 1 ;\ + .set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\ + .endif ;\ + LI(reg2, MASK_XLEN(origval)) ;\ + RVTEST_SIGUPD(sigptr, reg2) /*Write original AMO src */ ;\ + LI(reg2, MASK_XLEN(updval)) ;\ + addi origptr, sigptr, offset-REGWIDTH /* Calculate where orig AMO src is stored */ ;\ + inst destreg, reg2, (origptr) /*origval -> destreg; updated val -> (origptr) */ ;\ + RVTEST_SIGUPD(sigptr, destreg) /* write original AMO val */ + + + #define NAN_BOXED(__val__,__width__,__max__) ;\ .if __width__ == 32 ;\ .word __val__ ;\