From: lkcl Date: Mon, 30 May 2022 10:01:29 +0000 (+0100) Subject: (no commit message) X-Git-Tag: opf_rfc_ls005_v1~2031 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a61cfce2007ab6fcf52e816dc8244e8e4d5572b1;p=libreriscv.git --- 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