(RT) = r
```
+# bitmatrix
+
+```
+uint64_t bmatflip(uint64_t RA)
+{
+ uint64_t x = RA;
+ x = shfl64(x, 31);
+ x = shfl64(x, 31);
+ x = shfl64(x, 31);
+ return x;
+}
+uint64_t bmatxor(uint64_t RA, uint64_t RB)
+{
+ // transpose of RB
+ uint64_t RBt = bmatflip(RB);
+ uint8_t u[8]; // rows of RA
+ uint8_t v[8]; // cols of RB
+ for (int i = 0; i < 8; i++) {
+ u[i] = RA >> (i*8);
+ v[i] = RBt >> (i*8);
+ }
+ uint64_t x = 0;
+ for (int i = 0; i < 64; i++) {
+ if (pcnt(u[i / 8] & v[i % 8]) & 1)
+ x |= 1LL << i;
+ }
+ return x;
+}
+uint64_t bmator(uint64_t RA, uint64_t RB)
+{
+ // transpose of RB
+ uint64_t RBt = bmatflip(RB);
+ uint8_t u[8]; // rows of RA
+ uint8_t v[8]; // cols of RB
+ for (int i = 0; i < 8; i++) {
+ u[i] = RA >> (i*8);
+ v[i] = RBt >> (i*8);
+ }
+ uint64_t x = 0;
+ for (int i = 0; i < 64; i++) {
+ if ((u[i / 8] & v[i % 8]) != 0)
+ x |= 1LL << i;
+ }
+ return x;
+}
+
+```
+
# Instructions for Binary Galois Fields `GF(2^m)`
see:
(RS) = gfpmsubr(factor1, factor2, term)
```
-# bitmatrix
-
-```
-uint64_t bmatflip(uint64_t RA)
-{
- uint64_t x = RA;
- x = shfl64(x, 31);
- x = shfl64(x, 31);
- x = shfl64(x, 31);
- return x;
-}
-uint64_t bmatxor(uint64_t RA, uint64_t RB)
-{
- // transpose of RB
- uint64_t RBt = bmatflip(RB);
- uint8_t u[8]; // rows of RA
- uint8_t v[8]; // cols of RB
- for (int i = 0; i < 8; i++) {
- u[i] = RA >> (i*8);
- v[i] = RBt >> (i*8);
- }
- uint64_t x = 0;
- for (int i = 0; i < 64; i++) {
- if (pcnt(u[i / 8] & v[i % 8]) & 1)
- x |= 1LL << i;
- }
- return x;
-}
-uint64_t bmator(uint64_t RA, uint64_t RB)
-{
- // transpose of RB
- uint64_t RBt = bmatflip(RB);
- uint8_t u[8]; // rows of RA
- uint8_t v[8]; // cols of RB
- for (int i = 0; i < 8; i++) {
- u[i] = RA >> (i*8);
- v[i] = RBt >> (i*8);
- }
- uint64_t x = 0;
- for (int i = 0; i < 64; i++) {
- if ((u[i / 8] & v[i % 8]) != 0)
- x |= 1LL << i;
- }
- return x;
-}
-
-```
-
# Already in POWER ISA
## count leading/trailing zeros with mask