The byte-swapping function described in the previous chapter provides an excellent demonstration of the ability of new processor instructions to reduce cycle count. Figure 4.3 illustrates the byte-swap function, which converts a 32-bit word between big- and little-endian formats.
The nine instructions from the base Xtensa ISA that are required to perform this operation are:
|slli a9, a14, 24||Form intermediate result bits 24–31 in register a9|
|slli a8, a14, 8||Shift 32-bit word left by 8 bits, save in register a8|
|srli a10, a14, 8||Shift 32-bit word right ...|