Bit manipulation instructions: Difference between revisions

Content deleted Content added
others: Added 8X300, a very clever and fast design for its era. I designed these into early "Winchester" controllers.
Line 17:
 
== Hardware bit manipulation ==
Bit manipulation can be categorized into several classes:
; Byte manipulation
: Operate on a byte at a specified bit ___location and size{{efn|Often limited to a single word or less, e.g., 1-8 on the [[IBM 7030]], and sometimes not allowed to cross word boundaries.}}
: Operate on a string of bytes as above
; Connectives
: Combine two bit strings bit-by-bit with one of the 16 two-input Boolean operations
; Counting
: Operation on all bits to find, e.g.,
:# First or last 0 or 1
:# Total number of 1 bits
; Masking
: Perform an operation only on the elements{{efn|E.g., bits, bytes, words.}} selected by a mask
:# Extract
:# Insert
;Reversing
:Reverse the bit or byte order of a string
; Shifting
: Arithmetic shift
: Logical shift
: Rotate
; Testing
: Testing whether selected bits are all zero, all one, or mixed
== Examples ==
{{Further|topic=a more complete list of find-first style instructions|Find_first_set#Hardware_support}}
All the architectures below have instruction subsets and groups where the bit manipulation is provided in hardware. From the list it can be seen that [[DSP]]s and [[Embedded system|Embedded]] [[Microcontroller]]s have at least test/set/clear bit, however there are much more comprehensive instructions such as [[Count leading zeros]], [[Popcount]], [[Galois field]] arithmetic, [[Binary-coded decimal]], bit-matrix multiply and transpose, byte-permute, bit permute including [[Bit-reversal_permutation|bit-reversal]], specialised cryptographic instructions and many more.
Line 112 ⟶ 135:
* [[SuperH]] has comprehensive memory-based bit manipulation including And-complement and Or-complement, but also has standard register-based test/set/clear and an unusual instruction that replaces bit N (in the range 0 to 7) and copies the replaced bit into the Test register.<ref>{{cite web | title=Renesas SH Instruction Set Summary | url=https://shared-ptr.com/sh_insns.html }}</ref>
* The [[Signetics]] [[Signetics 8X300|8X300]] is a microprocessor produced starting 1976. The processor normally manipulates 8-bit data bytes, but the mask and rotate units makes it possible to manipulate single or multiple bits, making this a variable data-length processor.
 
== Notes ==
{{notelist}}
 
== See also ==