Blame sysdeps/alpha/fpu/cfloat-compat.h

Packit 6c4009
/* Compatibility macros for old and new Alpha complex float ABI.
Packit 6c4009
   Copyright (C) 2004-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library.  If not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/* The behaviour of complex float changed between GCC 3.3 and 3.4.
Packit 6c4009
Packit 6c4009
   In 3.3 and before (below, complex version 1, or "c1"), complex float
Packit 6c4009
   values were packed into one floating point register.
Packit 6c4009
Packit 6c4009
   In 3.4 and later (below, complex version 2, or "c2"), GCC changed to
Packit 6c4009
   follow the official Tru64 ABI, which passes the components of a complex
Packit 6c4009
   as separate parameters.  */
Packit 6c4009
Packit 6c4009
typedef union { double d; _Complex float cf; } c1_compat;
Packit 6c4009
# define c1_cfloat_decl(x)	double x
Packit 6c4009
# define c1_cfloat_real(x)	__real__ c1_cfloat_value (x)
Packit 6c4009
# define c1_cfloat_imag(x)	__imag__ c1_cfloat_value (x)
Packit 6c4009
# define c1_cfloat_value(x)	(((c1_compat *)(void *)&x)->cf)
Packit 6c4009
# define c1_cfloat_rettype	double
Packit 6c4009
# define c1_cfloat_return(x)	({ c1_compat _; _.cf = (x); _.d; })
Packit 6c4009
Packit 6c4009
# define c2_cfloat_decl(x)	_Complex float x
Packit 6c4009
# define c2_cfloat_real(x)	__real__ x
Packit 6c4009
# define c2_cfloat_imag(x)	__imag__ x
Packit 6c4009
# define c2_cfloat_value(x)	x
Packit 6c4009
# define c2_cfloat_rettype	_Complex float
Packit 6c4009
# define c2_cfloat_return(x)	x
Packit 6c4009
Packit 6c4009
/* Get the proper symbol versions defined for each function.  */
Packit 6c4009
Packit 6c4009
#include <shlib-compat.h>
Packit 6c4009
#include <libm-alias-float.h>
Packit 6c4009
Packit 6c4009
#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_3_4)
Packit 6c4009
#define cfloat_versions_compat(func) \
Packit 6c4009
  compat_symbol (libm, __c1_##func, func, GLIBC_2_1)
Packit 6c4009
#else
Packit 6c4009
#define cfloat_versions_compat(func)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define cfloat_versions(func) \
Packit 6c4009
  cfloat_versions_compat(func##f); \
Packit 6c4009
  versioned_symbol (libm, __c2_##func##f, func##f, GLIBC_2_3_4); \
Packit 6c4009
  extern typeof(__c2_##func##f) __##func##f attribute_hidden; \
Packit 6c4009
  strong_alias (__c2_##func##f, __##func##f); \
Packit 6c4009
  libm_alias_float_other (__##func, func)