Skip to content

Commit

Permalink
Added TEST_AMO_OP which was deleted by mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
UmerShahidengr committed Oct 27, 2023
1 parent 38e9f67 commit 04ef8f0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions riscv-test-suite/env/test_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ ;\
Expand Down

0 comments on commit 04ef8f0

Please sign in to comment.