[hsa merge 09/10] Majority of the HSA back-end
Jakub Jelinek
jakub@redhat.com
Mon Jan 18 15:48:00 GMT 2016
Hi!
PDP endian is
gcc_assert (!BYTES_BIG_ENDIAN);
gcc_assert (WORDS_BIG_ENDIAN);
and 16-bit words, thus within uint16_t it is little endian, and the
16-bit words are ordered in larger units in big endian order.
> +#else
> + val = ((val & 0xff00ff00) >> 8) | ((val & 0xff00ff) << 8);
Too many spaces before =?
> + return (val >> 16) | (val << 16);
> +#endif
> +#endif
> +}
> +
> +/* Convert VAL to little endian form, if necessary. */
> +
> +static uint64_t
> +lendian64 (uint64_t val)
> +{
> +#if GCC_VERSION >= 4006
> +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> + return val;
> +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> + return __builtin_bswap64 (val);
> +#else /* __ORDER_PDP_ENDIAN__ */
> + return (((val & 0xffff) << 48)
> + | ((val & 0xffff0000) << 16)
> + | ((val & 0xffff00000000) >> 16)
> + | ((val & 0xffff000000000000) >> 48));
You are missing ll suffixes on the large constants.
That said, PDP endian host will not work with your patch if the system
compiler is not GCC >= 4.6, and most likely you are relying on __CHAR_BIT__
== 8 on the host too. Guess it can be handled incrementally though.
Jakub
More information about the Gcc-patches
mailing list