(no commit message)
authorlkcl <lkcl@web>
Mon, 30 May 2022 14:31:18 +0000 (15:31 +0100)
committerIkiWiki <ikiwiki.info>
Mon, 30 May 2022 14:31:18 +0000 (15:31 +0100)
openpower/sv/bitmanip.mdwn

index 34e29db1ca696373b6f9cd9168c7762f4191d4db..214ae57e3f99513bbeed7854f89b63b05b82fca0 100644 (file)
@@ -102,7 +102,7 @@ TODO: convert all instructions to use RT and not RS
 | NN |    |     |      |         | 0  11  00 |1 | svshape    | SVM-Form    |
 | NN |    |     |      |         | 1  11  00 |1 | svremap   | SVRM-Form   |
 | NN | RT | RA  | RB   | im0-4   | im5-7  01 |0 | grevlog |  TLI-Form    |
-| NN | RT | RA  | RB   | im0-4   | im5-7  01 |1 | bmatxori |   TLI-Form  |
+| NN | RT | RA  | RB   | im0-4   | im5-7  01 |1 | grevlogw |   TLI-Form  |
 | NN | RT | RA  | RB   | RC      | mode  010 |Rc| bitmask\* |  VA2-Form    |
 | NN |FRS | d1  |  d0  |   d0    | 00    011 |d2| fmvis   | DX-Form     |
 | NN |FRS | d1  |  d0  |   d0    | 01    011 |d2| fishmv  | DX-Form    |
@@ -122,7 +122,7 @@ the [[sv/av_opcodes]])
 | -- | -- | --- | --- | -- | ----- | -------- |--| ----      | ------- |
 | NN | RS | me  | sh  | SH | ME 0  | nn00 110 |Rc| bmopsi    | BM-Form |
 | NN | RS | RA  | sh  | SH |  0 1  | nn00 110 |Rc| bmopsi    | XB-Form |
-| NN |    |     |     |    |  1 1  | --00 110 |Rc| rsvd      |         |
+| NN | RS | RA  |im04 | im5|  1 1  | im67 00 110 |Rc| bmatxori  | TODO    |
 | NN | RT | RA  | RB  | 1  |  00   | 0001 110 |Rc| cldiv     | X-Form  |
 | NN | RT | RA  | RB  | 1  |  01   | 0001 110 |Rc| clmod     | X-Form  |
 | NN | RT | RA  |     | 1  |  10   | 0001 110 |Rc| clmulh    | X-Form  |
@@ -688,6 +688,10 @@ as GF2P8AFFINEQB. uses:
 | -- | -- | --- | ---  | -----   | -----|--| ------ | ----- |
 | NN | RT | RA  | RB   | im0-7   | 01   |1 | bmatxori |           |
 
+| 0.5|6.10|11.15|16.20| 21 | 22.23 | 24....30 |31| name      |  Form   |
+| -- | -- | --- | --- | -- | ----- | -------- |--| ----      | ------- |
+| NN | RS | RA  |im04 | im5|  1 1  | im67 00 110 |Rc| bmatxori  | TODO    |
+
 
 ```
 uint64_t bmatflip(uint64_t RA)
@@ -699,20 +703,20 @@ uint64_t bmatflip(uint64_t RA)
     return x;
 }
 
-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
-    uint8_t v[8]; // cols of RB
+uint64_t bmatxori(uint64_t RS, uint64_t RA, uint8_t imm) {
+    // transpose of RA
+    uint64_t RAt = bmatflip(RA);
+    uint8_t u[8]; // rows of RS
+    uint8_t v[8]; // cols of RA
     for (int i = 0; i < 8; i++) {
-        u[i] = RA >> (i*8);
-        v[i] = RBt >> (i*8);
+        u[i] = RS >> (i*8);
+        v[i] = RAt >> (i*8);
     }
-    uint64_t x = 0;
+    uint64_t bit, 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 |= bit << i;
+        bit = (imm >> (i%8)) & 1;
+        bit ^= pcnt(u[i / 8] & v[i % 8]) & 1;
+        x |= bit << i;
     }
     return x;
 }