From 5e7b3c2dd8b5aba121a3c1305a6a663efc322e6c Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 17 Apr 2023 21:26:43 -0700 Subject: [PATCH] add shaddw --- openpower/sv/bitmanip.mdwn | 12 ++++++++++++ openpower/sv/draft_opcode_tables.mdwn | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index c83965590..59688e129 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -270,6 +270,12 @@ Pseudo-code (shadd): m <- sm + 1 RT <- (n[m:XLEN-1] || [0]*m) + (RA) +Pseudo-code (shaddw): + + shift <- sm + 1 # Shift is between 1-4 + n <- EXTS((RB)[XLEN/2:XLEN-1]) # Only use lower XLEN/2-bits of RB + RT <- (n << shift) + (RA) # Shift n, add RA + Pseudo-code (shadduw): n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1] @@ -282,6 +288,12 @@ uint_xlen_t shadd(uint_xlen_t RA, uint_xlen_t RB, uint8_t sm) { return (RB << (sm+1)) + RA; } +uint_xlen_t shaddw(uint_xlen_t RA, uint_xlen_t RB, uint8_t sm) { + uint_xlen_t n = (int_xlen_t)(RB << XLEN / 2) >> XLEN / 2; + sm = sm & 0x3; + return (n << (sm+1)) + RA; +} + uint_xlen_t shadduw(uint_xlen_t RA, uint_xlen_t RB, uint8_t sm) { uint_xlen_t n = RB & 0xFFFFFFFF; sm = sm & 0x3; diff --git a/openpower/sv/draft_opcode_tables.mdwn b/openpower/sv/draft_opcode_tables.mdwn index a1cdbd677..527962620 100644 --- a/openpower/sv/draft_opcode_tables.mdwn +++ b/openpower/sv/draft_opcode_tables.mdwn @@ -100,7 +100,7 @@ the [[sv/av_opcodes]]) | NN | | | | | 00 | 0101 110 |0 | crfbinlog | {TODO} | | NN | | | | | 00 | 0101 110 |1 | rsvd | | | NN | | | | | 10 | 0101 110 |Rc| rsvd | | -| NN | | | | | -1 | 0101 110 |Rc| rsvd | | +| NN | RT | RA | RB | sm0| sm1 1 | 0101 110 |Rc| shaddw | X-Form | | NN | RT | RA | RB | 0 | itype | 1001 110 |Rc| av minmax | X-Form | | NN | RT | RA | RB | 1 | 00 | 1001 110 |Rc| av abss | X-Form | | NN | RT | RA | RB | 1 | 01 | 1001 110 |Rc| av absu | X-Form | -- 2.30.2