Compaq ECQD2KCTE Laptop User Manual


 
Instruction Descriptions 4–53
For software that is not designed to use the BWX extension, the intended sequence for loading
and zero-extending a word from unaligned address X is:
LDQ_U R1, X(R11) ; Ignores va<2:0>, R1 = yBAx xxxx
LDQ_U R2, X+1(R11) ; Ignores va<2:0>, R2 = yBAx xxxx
LDA R3, X(R11) ; R3<2:0> = (X mod 8) = 5
EXTWL R1, R3, R1 ; R1 = 0000 00BA
EXTWH R2, R3, R2 ; R2 = 0000 0000
OR R2, R1, R1 ; R1 = 0000 00BA
For software that is not designed to use the BWX extension, the intended sequence for loading
and sign-extending a word from unaligned address X is:
LDQ_U R1, X(R11) ; Ignores va<2:0>, R1 = yBAx xxxx
LDQ_U R2, X+1(R11) ; Ignores va<2:0>, R2 = yBAx xxxx
LDA R3, X+1+1(R11) ; R3<2:0> = 5+1+1 = 7
EXTQL R1, R3, R1 ; R1 = 0000 000y
EXTQH R2, R3, R2 ; R2 = BAxx xxx0
OR R2, R1, R1 ; R1 = BAxx xxxy
SRA R1, #48, R1 ; R1 = ssss ssBA
For software that is not designed to use the BWX extension, the intended sequence for loading
and zero-extending a byte from address X is:
LDQ_U R1, X(R11) ; Ignores va<2:0>, R1 = yyAx xxxx
LDA R3, X(R11) ; R3<2:0> = (X mod 8) = 5
EXTBL R1, R3, R1 ; R1 = 0000 000A
For software that is not designed to use the BWX extension, the intended sequence for loading
and sign-extending a byte from address X is:
LDQ_U R1, X(R11) ; Ignores va<2:0>, R1 = yyAx xxxx
LDA R3, X+1(R11) ; R3<2:0> = (X + 1) mod 8, i.e.,
; convert byte position within
; quadword to one-origin based
EXTQH R1, R3, R1 ; Places the desired byte into byte 7
; of R1.final by left shifting
; R1.initial by ( 8 - R3<2:0> ) byte
; positions
SRA R1, #56, R1 ; Arithmetic Shift of byte 7 down
; into byte 0,
Optimized examples:
Assume that a word fetch is needed from 10(R3), where R3 is intended to contain a long-
word-aligned address. The optimized sequences below take advantage of the known constant
offset, and the longword alignment (hence a single aligned longword contains the entire word).
The sequences generate a Data Alignment Fault if R3 does not contain a longword-aligned
address.