This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [hsa merge 09/10] Majority of the HSA back-end
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Jan 2016 16:48:08 +0100
- Subject: Re: [hsa merge 09/10] Majority of the HSA back-end
- Authentication-results: sourceware.org; auth=none
- References: <20160113173925 dot 220029649 at virgil dot suse dot cz> <20160113173925 dot 914372077 at virgil dot suse dot cz> <20160115234912 dot GA30403 at virgil dot suse dot cz> <20160116085851 dot GJ3017 at tucnak dot redhat dot com> <20160118153249 dot GC30403 at virgil dot suse dot cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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