Skip to content

Commit

Permalink
Merge pull request #242 from riscv-non-isa/fix-offset-bug
Browse files Browse the repository at this point in the history
Patch for issue 240. Fixes #240
  • Loading branch information
neelgala authored Mar 18, 2022
2 parents bee5540 + 8f7ab2c commit effd553
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## [2.7.1] - 2022-03-18
- Fix bug in auto-offset update for SIGUPD macros.

## [2.7.0] - 2022-03-15
- Updated K Crypto (Scalar) instructions for the V.1.0.0 ratified spec.
- changed xperm.n -> xperm4 and xperm.b -> xperm8 instructions
Expand Down
24 changes: 12 additions & 12 deletions riscv-test-suite/env/arch_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,37 +578,37 @@
/* RVTEST_SIGUPD(basereg, sigreg) stores sigreg at offset(basereg) and updates offset by regwidth */
/* RVTEST_SIGUPD(basereg, sigreg,newoff) stores sigreg at newoff(basereg) and updates offset to regwidth+newoff */
#define RVTEST_SIGUPD(_BR,_R,...) \
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
.if offset+REGWIDTH>=2048 ;\
addi _BR, _BR, offset ;\
.set offset, 0 ;\
.endif ;\
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
SREG _R,offset(_BR) ;\
.set offset,offset+REGWIDTH

#define RVTEST_SIGUPD_F(_BR,_R,_F,...) \
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
.if offset+2*REGWIDTH>=2048 ;\
addi _BR, _BR,offset ;\
.set offset, 0 ;\
.endif ;\
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
FSREG _R,offset(_BR) ;\
SREG _F,offset+REGWIDTH(_BR) ;\
.set offset,offset+(2*REGWIDTH)


#define RVTEST_SIGUPD_FID(_BR,_R,_F,...) \
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
.if offset+2*REGWIDTH>=2048 ;\
addi _BR, _BR,offset ;\
.set offset, 0 ;\
.endif ;\
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
SREG _R,offset(_BR) ;\
SREG _F,offset+REGWIDTH(_BR) ;\
.set offset,offset+(2*REGWIDTH)
Expand All @@ -632,13 +632,13 @@

// for updating signatures that include flagreg when 'rd' is a paired register (64-bit) in Zpsfoperand extension in RV32.
#define RVTEST_SIGUPD_PK64(_BR,_R,_R_HI,_F,...)\
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
.if offset+3*REGWIDTH>=2048 ;\
addi _BR, _BR,offset ;\
.set offset, 0 ;\
.endif ;\
.if NARG(__VA_ARGS__) == 1 ;\
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
.endif ;\
SREG _R,offset(_BR) ;\
SREG _R_HI,offset+REGWIDTH(_BR) ;\
RDOV(_F) ;\
Expand Down

0 comments on commit effd553

Please sign in to comment.