From: Dmitry Selyutin Date: Thu, 27 Oct 2022 16:49:00 +0000 (+0300) Subject: bitmanip: sync shadd/shadduw pseudocode X-Git-Tag: opf_rfc_ls001_v3~20 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=767d19e3a7bfae5259e7e06f59fce58a0e24eca6;p=libreriscv.git bitmanip: sync shadd/shadduw pseudocode --- diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 5ad241f3f..dae0121a5 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -264,16 +264,15 @@ Replaces a pair of explicit instructions in hot-loops. Pseudo-code (shadd): - shift <- shift + 1 # Shift is between 1-4 - sum[0:63] <- ((RB) << shift) + (RA) # Shift RB, add RA - RT <- sum # Result stored in RT + n <- (RB) + m <- sm + 1 + RT <- (n[m:XLEN-1] || [0]*m) + (RA) Pseudo-code (shadduw): - shift <- shift + 1 # Shift is between 1-4 - n <- (RB)[XLEN/2:XLEN-1] # Limit RB to upper word (32-bits) - sum[0:63] <- (n << shift) + (RA) # Shift n, add RA - RT <- sum # Result stored in RT + n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1] + m <- sm + 1 + RT <- (n[m:XLEN-1] || [0]*m) + (RA) ``` uint_xlen_t shadd(uint_xlen_t RA, uint_xlen_t RB, uint8_t sm) {