From 1c558aa3a1d40d689230002bc2d7b7f299b66978 Mon Sep 17 00:00:00 2001 From: Chih-Min Chao Date: Wed, 20 May 2020 00:58:09 -0700 Subject: rvv: make overlap handling zero size Signed-off-by: Chih-Min Chao --- riscv/decode.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/riscv/decode.h b/riscv/decode.h index ef1b2fd..c9b33fe 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -418,14 +418,15 @@ inline long double to_f(float128_t f){long double r; memcpy(&r, &f, sizeof(r)); // // vector: operation and register acccess check helper // -static inline bool is_overlapped(const int astart, const int asize, - const int bstart, const int bsize) +static inline bool is_overlapped(const int astart, int asize, + const int bstart, int bsize) { - if (asize == 0 && bsize == 0) - return false; + asize = asize == 0 ? 1 : asize; + bsize = bsize == 0 ? 1 : bsize; const int aend = astart + asize; const int bend = bstart + bsize; + return std::max(aend, bend) - std::min(astart, bstart) < asize + bsize; } -- cgit v1.1