From 1285befd03bb267118a70c3b69fa070dc857c5d3 Mon Sep 17 00:00:00 2001 From: lkcl Date: Sun, 23 Oct 2022 11:59:00 +0100 Subject: [PATCH] --- openpower/sv/bitmanip.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 3b8ee8bf7..688dede42 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -245,11 +245,13 @@ Replaces a pair of explicit instructions in hot-loops. ``` uint_xlen_t shadd(uint_xlen_t rs1, uint_xlen_t rs2, uint8_t sh) { + sh = sh & 0x3; return (rs1 << (sh+1)) + rs2; } uint_xlen_t shadduw(uint_xlen_t rs1, uint_xlen_t rs2, uint8_t sh) { uint_xlen_t rs1z = rs1 & 0xFFFFFFFF; + sh = sh & 0x3; return (rs1z << (sh+1)) + rs2; } ``` -- 2.30.2