From 26a6dfc119c1b7791f497c6bafa5ece8f99969c8 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 9 Nov 2018 10:11:34 +0000 Subject: [PATCH] macro-ify gt, ge, eq and ne --- riscv/sv_insn_redirect.cc | 42 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index aa4cb33..66f0350 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -740,6 +740,10 @@ sv_reg_t sv_proc_t::rv_sr(sv_reg_t const & lhs, sv_reg_t const & rhs, #define lt < #define gt > +#define ge >= +#define le <= +#define eq == +#define ne != #define OP_RES_FN( fname, SLHSTYPE, SRHSTYPE, SRESTYPE, \ LHSTYPE, RHSTYPE, RESTYPE ) \ @@ -781,38 +785,12 @@ bool sv_proc_t::rv_##fname (SLHSTYPE const & lhs, SRHSTYPE const & rhs) \ OP_BOOL_FN( lt, sv_reg_t, sv_reg_t, uint64_t, uint64_t ) OP_BOOL_FN( lt, sv_sreg_t, sv_sreg_t, int64_t, int64_t ) - -bool sv_proc_t::rv_gt(sv_reg_t const & lhs, sv_reg_t const & rhs) -{ - return lhs > rhs; -} - -bool sv_proc_t::rv_gt(sv_sreg_t const & lhs, sv_sreg_t const & rhs) -{ - return lhs > rhs; -} - -bool sv_proc_t::rv_ge(sv_reg_t const & lhs, sv_reg_t const & rhs) -{ - return lhs >= rhs; -} - -bool sv_proc_t::rv_ge(sv_sreg_t const & lhs, sv_sreg_t const & rhs) -{ - return lhs >= rhs; -} - -bool sv_proc_t::rv_eq(sv_reg_t const & lhs, sv_reg_t const & rhs) -{ - return lhs == rhs; -} - -bool sv_proc_t::rv_ne(sv_reg_t const & lhs, sv_reg_t const & rhs) -{ - fprintf(stderr, "rv_ne %lx %lx %d\n", - (uint64_t)lhs, (uint64_t)rhs, (lhs != rhs)); - return (lhs != rhs); -} +OP_BOOL_FN( gt, sv_reg_t, sv_reg_t, uint64_t, uint64_t ) +OP_BOOL_FN( gt, sv_sreg_t, sv_sreg_t, int64_t, int64_t ) +OP_BOOL_FN( ge, sv_reg_t, sv_reg_t, uint64_t, uint64_t ) +OP_BOOL_FN( ge, sv_sreg_t, sv_sreg_t, int64_t, int64_t ) +OP_BOOL_FN( eq, sv_reg_t, sv_reg_t, uint64_t, uint64_t ) +OP_BOOL_FN( ne, sv_reg_t, sv_reg_t, uint64_t, uint64_t ) // ---- -- 2.30.2