[haiku-commits] Re: haiku: hrev47269 - headers/os/support

  • From: Paweł Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 26 May 2014 19:52:37 +0200

2014-05-26 19:37 GMT+02:00  <jessica.l.hamilton@xxxxxxxxx>:
> hrev47269 adds 1 changeset to branch 'master'
> old head: 36764b40013b19746e6caa041ab3f5100c84a4c2
> new head: 4ffdf2ed40845d8fb856a1a3ca5b5e74616850e9
> overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=4ffdf2e+%5E36764b4
>
> ----------------------------------------------------------------------------
>
> 4ffdf2e: Use GCC builtins for byte-swapping. Fixes #10800.
>
>   * Introduced in gcc-4.3 for at least Intel platforms
>   * On ARM, full support added in gcc-4.8
>   * Other platforms untested, left as-is
>   * This introduces a breaking change to the ABI for gcc4

You didn't remove these symbols in this commit so there is no ABI breakage.

<snip>
>  /* Private implementations */
>  extern double __swap_double(double arg);
>  extern float  __swap_float(float arg);
> +#if (defined(__INTEL__) || defined(__x86_64__)) && GCC_VERSION >= 40300
> +#define __swap_int64(arg)      __builtin_bswap64(arg)
> +#define __swap_int32(arg)      __builtin_bswap32(arg)
> +#define __swap_int16(arg)      __builtin_bswap16(arg)
> +#elif defined(__ARM__) && GCC_VERSION >= 40800
> +#define __swap_int64(arg)      __builtin_bswap64(arg)
> +#define __swap_int32(arg)      __builtin_bswap32(arg)
> +#define __swap_int16(arg)      __builtin_bswap16(arg)
> +#else
>  extern uint64 __swap_int64(uint64 arg);
>  extern uint32 __swap_int32(uint32 arg);
>  extern uint16 __swap_int16(uint16 arg);
> +#endif

I really think that these check are much too complicated. Our GCC4 is
4.8.2 (or something newer when we update) so there is no reason for
GCC version checks (obviously, apart from recognizing GCC2). CPU
architecture checks are also not needed, since these builtins are
available on all platforms. True, on some architectures (at least on
sparc64) GCC emits function call instead of inlining appropriate
instructions, but the called function is a part of libgcc so it has to
be provided anyway.

Paweł

Other related posts: