From f8727ccf6f1093f88e49399f22bf4924c8152a34 Mon Sep 17 00:00:00 2001 From: S Pawan Kumar Date: Thu, 17 Mar 2022 09:14:32 +0530 Subject: [PATCH] Patch for issue 240. Fixes #240 --- CHANGELOG.md | 3 +++ riscv-test-suite/env/arch_test.h | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea86faeb5..b99915536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## [2.6.4] - 2022-03-17 +- Fix bug in auto-offset update for SIGUPD macros. + ## [2.6.3] - 2022-03-04 - import and synchronize P-ext changes in arch_test.h from riscv-ctg - automatically adjust base and offset if offset gets too big diff --git a/riscv-test-suite/env/arch_test.h b/riscv-test-suite/env/arch_test.h index 5c7f0ed57..a4f9d435f 100644 --- a/riscv-test-suite/env/arch_test.h +++ b/riscv-test-suite/env/arch_test.h @@ -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) @@ -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) ;\