aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2020-05-20 00:58:09 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2020-05-20 00:58:09 -0700
commit1c558aa3a1d40d689230002bc2d7b7f299b66978 (patch)
tree111e58ab22405c5434bad88ca8afdef3c60d24fd
parent3f73156f2297763571e38701d89fdfa35a22aca2 (diff)
downloadspike-1c558aa3a1d40d689230002bc2d7b7f299b66978.zip
spike-1c558aa3a1d40d689230002bc2d7b7f299b66978.tar.gz
spike-1c558aa3a1d40d689230002bc2d7b7f299b66978.tar.bz2
rvv: make overlap handling zero size
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
-rw-r--r--riscv/decode.h9
1 files 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;
}