Skip to contentSkip to conversation

sim: cgen: add MUL2OFSI and MUL1OFSI macros (needed for OR1K l.mul[u])

PATCH Superseded Doug Evans 1 participant 1 message Oct 9, 2017

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Doug Evans

author
#0 lore raw

PATCH v5 2/6 sim: cgen: add MUL2OFSI and MUL1OFSI macros (needed for OR1K l.mul[u])

Quoted 10 lines · Stafford Horne
Quoted 9 lines · Simon Marchi
Quoted 8 lines · Stafford Horne

From: Peter Gavin <[email protected]>

sim/common/ChangeLog:

2012-03-14 Peter Gavin <[email protected]>

* cgen-ops.h (MUL2OFSI): New macro, 1's complement overflow. (MUL1OFSI): New macro, 2's complement overflow.

Maybe I'm missing something but the text looks backwards. IOW:

* cgen-ops.h (MUL2OFSI): New function, 2's complement overflow. (MUL1OFSI): New function, 1's complement overflow.

?

OK with that change (and the other suggested changes to date).

Quoted 44 lines
Quoted 2 lines

Macro? Aren't they functions?

Yes, I am not sure where macro came from. Maybe I added that, maybe it was there before.

Quoted 12 lines
Quoted 12 lines
---
 sim/common/cgen-ops.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
sim/common/cgen-ops.h +0 -0
index 97585d7943..ffbdf3fd6e 100644
@@ -631,6 +631,22 @@ SUBOFQI (QI a, QI b, BI c)
   return res;
 }
 
Quoted 6 lines

sim/common/cgen-ops.h SUBOFQI (QI a, QI b, BI c) · line 637

Quoted 4 lines
sim/common/cgen-ops.h +4 -0
+SEMOPS_INLINE BI
+MUL2OFSI (SI a, SI b)
+{
+  DI tmp = MULDI (EXTSIDI(a), EXTSIDI(b));

Add spaces before the parentheses.

Right, fixed.

Quoted 11 lines

sim/common/cgen-ops.h SUBOFQI (QI a, QI b, BI c) · line 645

Quoted 8 lines
sim/common/cgen-ops.h +8 -0
+  BI res = tmp < -0x80000000LL || tmp > 0x7fffffffLL;
+  return res;
+}
+
+SEMOPS_INLINE BI
+MUL1OFSI (USI a, USI b)
+{
+  UDI tmp = MULDI (ZEXTSIDI(a), ZEXTSIDI(b));

Here too.

Quoted 3 lines

Otherwise, this patch makes sense to me.

Simon

Thank You
-Stafford