On Wed, 2017-09-13 at 13:08 +0000, paul.kon...@dell.com wrote: > > On Sep 13, 2017, at 5:51 AM, Jürg Billeter <juerg.bille...@codethink.co.uk> > > wrote: > > To support existing large code bases, the goal is to reverse storage > > order for all scalars, not just (selected) structs/unions. Also need to > > support taking the address of a scalar field, for example. C++ support > > will be required as well. > > I wonder about that. It's inefficient to do byte swapping on local > data; it is only useful and needed on external data. Data that goes > to files for use by other-byte-order applications, or data that goes > across a bus or network to consumers that have the other byte > order. A byte swapped local variable only consumes cycles and > instruction space to no purpose.
Existing code that has been written under the assumption of big-endian memory layout can break on little-endian systems even with just local data (e.g., accessing individual bytes of a 32-bit scalar). It would obviously be best to fix all such code, however, that's not always feasible, unfortunately. Avoiding byte swapping for spilled registers where storage order is (normally) not observable by applications will hopefully reduce the performance overhead. Jürg