+# bitmanipulation
+
+**DRAFT STATUS**
+
+this extension amalgamates bitnanipulation primitives from many sources, including RISC-V bitmanip, Packed SIMD, AVX-512 and OpenPOWER VSX. Vectorisation and SIMD are removed: these are straight scalar (element) operations. Vectorisation Context is provided by [[openpower/sv]].
+
+ternaryv is experimental and is the only operation that may be considered a "Packed SIMD". It is added as a variant of the already well-justified ternary operation (done in AVX512 as an immediate only) "because it looks fun". As it is based on the LUT4 concept it will allow accelerated emulation of FPGAs. Other vendors of ISAs are buying FPGA companies to achieve a similar objective.
+
+general-purpose Galois Field operations are added so as to avoid huge opcode proliferation across many areas of Computer Science. however for convenience and also to avoid setup costs, some of the more common operations (clmul, crc32) are also added. The expectation is that these operations would all be covered by the same pipeline.
+
+# summary
+
+minor opcode allocation
+
+ | 28.30 |31| name |
+ | ------ |--| --------- |
+ | 00 |Rc| ternaryi |
+ | 001 |Rc| ternary |
+ | 010 |Rc| bitmask |
+ | 011 |Rc| gf* |
+ | 101 |1 | ternaryv |
+ | 101 |0 | ternarycr |
+ | 110 |Rc| 1/2-op |
+ | 111 |Rc| bitmaski |
+
+1-op and variants
+
+| dest | src1 | subop | op |
+| ---- | ---- | ----- | -------- |
+| RT | RA | .. | bmatflip |
+
+2-op and variants
+
+| dest | src1 | src2 | subop | op |
+| ---- | ---- | ---- | ----- | -------- |
+| RT | RA | RB | or | bmatflip |
+| RT | RA | RB | xor | bmatflip |
+| RT | RA | RB | bdep | dep/ext |
+| RT | RA | RB | bext | dep/ext |
+| RT | RA | RB | | grev |
+| RT | RA | RB | | clmul* |
+| RT | RA | RB | | gorc |
+| RT | RA | RB | shuf | shuffle |
+| RT | RA | RB | unshuf| shuffle |
+| RT | RA | RB | width | xperm |
+| RT | RA | RB | type | minmax |
+| RT | RA | RB | | |
+| RT | RA | RB | | |
+| RT | RA | RB | | |
+
+3 ops
+
+* bitmask set/extract
+* ternary bitops
+* GF
+
+| 0.5|6.10|11.15|16.20|21..25 | 26....30 |31| name |
+| -- | -- | --- | --- | ----- | -------- |--| ------ |
+| NN | RT | RA | RB | RC | mode 001 |Rc| ternary |
+| NN | RT | RA | RB | im0-4 | im5-7 00 |Rc| ternaryi |
+| NN | RS | RA | RB | RC | 00 011 |Rc| gfmul |
+| NN | RS | RA | RB | deg | 01 011 |Rc| gfadd |
+| NN | RT | RA | RB | deg | 10 011 |Rc| gfinv |
+| NN | RS | RA | RB | deg | 11 011 |Rc| gfmuli |
+
+| 0.5|6.10|11.15| 16.23 |24.27 | 28.30 |31| name |
+| -- | -- | --- | ----- | ---- | ----- |--| ------ |
+| NN | RT | RA | imm | mask | 101 |1 | ternaryv |
+
+| 0.5|6.8 | 9.11|12.14|15|16.23|24.27 | 28.30|31| name |
+| -- | -- | --- | --- |- |-----|----- | -----|--| -------|
+| NN | BA | BB | BC |0 |imm | mask | 101 |0 | ternarycr |
+
+ops
+
+| 0.5|6.10|11.15|16.20| 21.22 | 23 | 24....30 |31| name |
+| -- | -- | --- | --- | ----- | -- | -------- |--| ---- |
+| NN | RA | RB | | | 0 | 0000 110 |Rc| rsvd |
+| NN | RA | RB | RC | itype | 1 | 0000 110 |Rc| xperm |
+| NN | RA | RB | RC | itype | 0 | 0100 110 |Rc| minmax |
+| NN | RA | RB | | | 1 | 0100 110 |Rc| rsvd |
+| NN | RA | RB | sh | itype | SH | 1000 110 |Rc| bmopsi |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | | 1100 110 |Rc| rsvd |
+| NN | RA | RB | | | 0 | 0001 110 |Rc| rsvd |
+| NN | RA | RB | | | 0 | 0101 110 |Rc| rsvd |
+| NN | RA | RB | RC | 00 | 0 | 0010 110 |Rc| gorc |
+| NN | RA | RB | sh | 00 | SH | 1010 110 |Rc| gorci |
+| NN | RA | RB | RC | 00 | 0 | 0110 110 |Rc| gorcw |
+| NN | RA | RB | sh | 00 | 0 | 1110 110 |Rc| gorcwi |
+| NN | RA | RB | RC | 00 | 1 | 1110 110 |Rc| bmator |
+| NN | RA | RB | RC | 01 | 0 | 0010 110 |Rc| grev |
+| NN | RA | RB | RC | 01 | 1 | 0010 110 |Rc| clmul |
+| NN | RA | RB | sh | 01 | SH | 1010 110 |Rc| grevi |
+| NN | RA | RB | RC | 01 | 0 | 0110 110 |Rc| grevw |
+| NN | RA | RB | sh | 01 | 0 | 1110 110 |Rc| grevwi |
+| NN | RA | RB | RC | 01 | 1 | 1110 110 |Rc| bmatxor |
+| NN | RA | RB | RC | 10 | 0 | 0010 110 |Rc| shfl |
+| NN | RA | RB | sh | 10 | SH | 1010 110 |Rc| shfli |
+| NN | RA | RB | RC | 10 | 0 | 0110 110 |Rc| shflw |
+| NN | RA | RB | RC | 10 | 0 | 1110 110 |Rc| bdep |
+| NN | RA | RB | RC | 10 | 1 | 1110 110 |Rc| bext |
+| NN | RA | RB | RC | 11 | 0 | 1110 110 |Rc| clmulr |
+| NN | RA | RB | RC | 11 | 1 | 1110 110 |Rc| clmulh |
+| NN | RA | RB | | | | NN11 110 |Rc| rsvd |
+