Remove VL_NEGATE_{I,Q,E}, use C native unary '-' instead

This is to avoid slowing down -O0 models unnecessarily.
This commit is contained in:
Geza Lore 2020-04-30 01:03:10 +01:00
parent aa9cde22c8
commit 209a585a68
2 changed files with 1 additions and 7 deletions

View File

@ -1428,13 +1428,6 @@ static inline int _VL_CMPS_W(int lbits, WDataInP lwp, WDataInP rwp) VL_MT_SAFE {
//=========================================================================
// Math
// Optimization bug in GCC 2.96 and presumably all-pre GCC 3 versions need this workaround,
// we can't just
//# define VL_NEGATE_I(data) (-(data))
static inline IData VL_NEGATE_I(IData data) VL_PURE { return -data; }
static inline QData VL_NEGATE_Q(QData data) VL_PURE { return -data; }
static inline EData VL_NEGATE_E(EData data) VL_PURE { return -data; }
static inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp, WDataInP lwp) VL_MT_SAFE {
EData carry = 1;
for (int i = 0; i < words; ++i) {

View File

@ -5089,6 +5089,7 @@ public:
virtual void numberOperate(V3Number& out, const V3Number& lhs) { out.opNegate(lhs); }
virtual string emitVerilog() { return "%f(- %l)"; }
virtual string emitC() { return "VL_NEGATE_%lq(%lW, %P, %li)"; }
virtual string emitSimpleOperator() { return "-"; }
virtual bool cleanOut() const { return false; }
virtual bool cleanLhs() const { return false; }
virtual bool sizeMattersLhs() const { return true; }