[hsa merge 09/10] Majority of the HSA back-end

Jakub Jelinek jakub@redhat.com
Sat Jan 16 09:23:00 GMT 2016


On Sat, Jan 16, 2016 at 09:58:51AM +0100, Jakub Jelinek wrote:
> IMHO you'd be best to write your own helpers for conversion to little
> endian (and back).
> gcc configure already has AC_C_BIGENDIAN (dunno how it handles pdp endian
> host though, so not sure if it is safe to rely on that), for recent GCC
> you can use __BYTE_ORDER__ macro to check endianity and __builtin_bswap*.
> So perhaps just
> #if GCC_VERSION >= 4006
> // use __BYTE_ORDER__ and __builtin_bswap or nothing
> #else
> // provide a safe slower default, with shifts and masking
> #endif

Note e.g. libiberty/simple-object* uses the slow version with shifts and
masking all the time, so just optimizing the case of recent GCC host (and
therefore also bootstrapped compilers) might be enough.

	Jakub



More information about the Gcc-patches mailing list