From 04ef8f0ff340e0eca52c4052937097710deb7214 Mon Sep 17 00:00:00 2001 From: umershahidengr Date: Fri, 27 Oct 2023 09:09:19 +0500 Subject: [PATCH] Added TEST_AMO_OP which was deleted by mistake --- riscv-test-suite/env/test_macros.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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__ ;\