Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!apple!baum@apple.com From: baum@apple.com (Allen Baum) Newsgroups: comp.arch Subject: overview of HP-PA Bitfield insts. Message-ID: <51584@apple.Apple.COM> Date: 16 Apr 91 21:52:11 GMT References: <1991Apr15.193425.3436@waikato.ac.nz> Sender: nntp@Apple.COM Organization: Apple Computer Lines: 52 With all the postings about bitfield ops, I thought I'd better give a quick and dirty overview of HP-PA's operations. The rationale for having bitfield ops at all was partly bitmap data, partly Pascal packed structures, partly doing FP in software, & a lot of OS packed data structures..... Extract [Signed] [Variable] - Right justify a field, given a bit Position of the field's LSB as an immediate, and the field length as an immediate. The [Signed] option sign-extends instead of zero extends. The [Variable] option takes the LSB bit position from a special register. This instruction can be used for right shifts of various flavors. If (LSB pos_leng>32, then MSB of reg is used as MSB of field. The rationale for having [variable] take a position out of a register is: - expected critical path in the ALU (possibly not the case in CMOS) - when a variable position is used, it's often used over & over, so having to move the position to a special register is not a significant overhead. Note that there is no variable length. We didn't see it happening enough to put it in, and in the rare cases it occurs, a case branch can be used. [Zero & ][Variable] Deposit [Immed.] - Take a Right justified field and put it back into its (unjustified) position, given a bit position of the LSB as an immediate, and a Field Length as an immediate. The [Zero] option clears the destination register, otherwise bits that are not part of the field are left unchanged. The [Variable] option takes the LSB bit position from a special register. The [Immed] option uses a five bit signed immediate as a source. With the [Zero] option, this can be used for left shifts. With the Immediate option, this can be used as a set or clear bit (or field), (fairly common in OS structures). Using both options, constants can be constructed. Since something like 80% of immediates are in the range -16:+16, this restricted immediate is still quite useful. [Variable] Shift Double Concatenate two registers, right shift the 64 result by an amount specified by an immediate, and store the 32 low order bits into the result. The [Variable] option takes shift amount from a special register. This was intended to be used to justify/position fields that crossed word boundaries. While this sounds like a lot of instructions and variations, the hardware required to implement it is quite simple. Maybe someone from the HP-PA team can comment on whether it is worthwhile (i.e. used much).