Compaq ECQD2KCTE manual 14Alpha Architecture Handbook

Models: ECQD2KCTE

1 371
Download 371 pages 20.35 Kb
Page 40
Image 40

used unchanged for both conventions. Big-endian character strings have their most sig- nificant character on the left, while little-endian strings have their most significant char- acter on the right.

The compare byte (CMPBGE) instruction is neutral about direction, doing eight byte compares in parallel. However, following the CMPBGE instruction, the code is differ- ent that examines the byte mask to determine which string is larger, depending on whether the rightmost or leftmost unequal byte is used. Thus, compilers must be instructed to generate somewhat different code sequences for the two conventions.

Implementations that include big-endian support must supply all of the following features:

A means at boot time to choose the byte numbering convention. The implementation is not required to support dynamically changing the convention during program execu- tion. The chosen convention applies to all code executed, both operating-system and user.

If the big-endian convention is chosen, the longword-length load/store instructions (LDF, LDL, LDL_L, LDS, STF, STL, STL_C, STS) invert bit va<2> (bit 2 of the vir- tual address). This has the effect of accessing the half of a quadword other than the half that would be accessed under the little-endian convention.

If the big-endian convention is chosen, the word-length load instruction, LDWU, inverts bits va<1:2> (bits 1 and 2 of the virtual address). This has the effect of accessing the half of the longword that would be accessed under the little-endian convention.

If the big-endian convention is chosen, the byte-length load instruction, LDBU, inverts bits va<0:2> (bits 0 through 2 of the virtual address). This has the effect of accessing the half of the word that would be accessed under the little-endian convention.

If the big-endian convention is chosen, the byte manipulation instructions (EXTxx, INSxx, MSKxx) invert bits Rbv<2:0>. This has the effect of changing a shift of 5 bytes into a shift of 2 bytes, for example.

The instruction stream is always considered to be little-endian, and is independent of the cho- sen byte numbering convention. Compilers, linkers, and debuggers must be aware of this when accessing an instruction stream using data-stream load/store instructions. Thus, the rightmost instruction in a quadword is always executed first and always has the instruction-stream address 0 MOD 8. The same bytes accessed by a longword load/store instruction have data- stream address 0 MOD 8 under the little-endian convention, and 4 MOD 8 under the big- endian convention.

Using either byte numbering convention, it is sometimes necessary to access data that origi- nated on a machine that used the other convention. When this occurs, it is often necessary to swap the bytes within a datum. See Section A.4.3 for a suggested code sequence.

2–14Alpha Architecture Handbook

Page 40
Image 40
Compaq ECQD2KCTE manual 14Alpha Architecture Handbook