From: Jacob Lifshay Date: Tue, 18 Apr 2023 04:26:43 +0000 (-0700) Subject: add shaddw X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e7b3c2dd8b5aba121a3c1305a6a663efc322e6c;p=libreriscv.git add shaddw --- 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 |