On Thu, Jun 02, 2022 at 01:01:04PM +1000, Jordan Niethe wrote: > > What about the more fundamental thing? Have the order of the two halves > > of a prefixed insn as ulong not depend on endianness? It really is two > > opcodes, and the prefixed one is first, always, even in LE. > The reason would be the value of as ulong is then used to write a > prefixed instruction to > memory with std. > If both endiannesses had the halves the same one of them would store > the suffix in front of the prefix.
You cannot do such a (possibly) unaligned access from C though, not without invoking undefined behaviour. The compiler usually lets you get away with it, but there are no guarantees. You can make sure you only ever do such an access from assembler code of course. Swapping the two halves of a register costs at most one insn. It is harmful premature optimisation to make this single cycle advantage override more important consideration (almost everything else :-) ) Segher