Compaq ECQD2KCTE manual Big-endian examples

Models: ECQD2KCTE

1 371
Download 371 pages 20.35 Kb
Page 110
Image 110

For software that is not designed to use the BWX extension, the intended sequence for loading and zero-extending an aligned word from 10(R3) is:

LDL

R1, 8(R3)

; R1

= ssss BAxx

 

 

; Faults if

R3 is not longword aligned

EXTWL

R1, #2, R1

; R1

= 0000

00BA

For software that is not designed to use the BWX extension, the intended sequence for loading and sign-extending an aligned word from 10(R3) is:

LDL

R1, 8(R3)

; R1

= ssss BAxx

 

 

; Faults if

R3 is not longword aligned

SRA

R1, #16, R1

; R1

= ssss

ssBA

Big-endian examples:

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 = xxxx xAyy

LDA

R3, X(R11)

; R3<2:0> = 5, shift will be 2 bytes

EXTBL

R1, R3, R1

; R1 = 0000 000A

The intended sequence for loading a quadword from unaligned address X(R11) is:

LDQ_U

R1, X(R11)

; Ignores va<2:0>, R1 = xxxxxABC

LDQ_U

R2, X+7(R11)

; Ignores va<2:0>, R2 = DEFGHyyy

LDA

R3, X+7(R11)

; R3<2:0> = 4, shift will be 3 bytes

EXTQH

R1, R3, R1

; R1

= ABC0 0000

EXTQL

R2, R3, R2

; R2

= 000D EFGH

OR

R1, R2, R1

; R1

= ABCD EFGH

Note that the address in the LDA instruction for big-endian quadwords is X+7, for longwords is X+3, and for words is X+1; for little-endian, these are all just X. Also note that the EXTQH and EXTQL instructions are reversed with respect to the little-endian sequence.

4–54Alpha Architecture Handbook

Page 110
Image 110
Compaq ECQD2KCTE manual Big-endian examples