From a61cfce2007ab6fcf52e816dc8244e8e4d5572b1 Mon Sep 17 00:00:00 2001 From: lkcl Date: Mon, 30 May 2022 11:01:29 +0100 Subject: [PATCH] --- openpower/sv/bitmanip.mdwn | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 9a28dd090..32c3015bb 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -693,8 +693,8 @@ uint64_t bmatflip(uint64_t RA) x = shfl64(x, 31); return x; } -uint64_t bmatxor(uint64_t RA, uint64_t RB) -{ + +uint64_t bmatxori(uint64_t RA, uint64_t RB, uint8_t imm) { // transpose of RB uint64_t RBt = bmatflip(RB); uint8_t u[8]; // rows of RA @@ -705,13 +705,18 @@ uint64_t bmatxor(uint64_t RA, uint64_t RB) } uint64_t x = 0; for (int i = 0; i < 64; i++) { + uint64_t bit = (imm >> (i%8)) & 1; if (pcnt(u[i / 8] & v[i % 8]) & 1) - x |= 1LL << i; + x |= bit << i; } return x; } -uint64_t bmator(uint64_t RA, uint64_t RB) -{ + +uint64_t bmatxor(uint64_t RA, uint64_t RB) { + return bmatxori(RA, RB, 0xff) +} + +uint64_t bmator(uint64_t RA, uint64_t RB) { // transpose of RB uint64_t RBt = bmatflip(RB); uint8_t u[8]; // rows of RA @@ -727,8 +732,8 @@ uint64_t bmator(uint64_t RA, uint64_t RB) } return x; } -uint64_t bmatand(uint64_t RA, uint64_t RB) -{ + +uint64_t bmatand(uint64_t RA, uint64_t RB) { // transpose of RB uint64_t RBt = bmatflip(RB); uint8_t u[8]; // rows of RA -- 2.30.2