Blame sysdeps/s390/multiarch/ifunc-resolve.h

Packit 6c4009
/* IFUNC resolver function for CPU specific functions.
Packit 6c4009
   32/64 bit S/390 version.
Packit 6c4009
   Copyright (C) 2015-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
#include <unistd.h>
Packit 6c4009
#include <dl-procinfo.h>
Packit 6c4009
Packit 6c4009
#define S390_STFLE_BITS_Z10  34 /* General instructions extension */
Packit 6c4009
#define S390_STFLE_BITS_Z196 45 /* Distinct operands, pop ... */
Packit Service 6d4f8a
#define S390_STFLE_BITS_ARCH13_MIE3 61 /* Miscellaneous-Instruction-Extensions
Packit Service 6d4f8a
					  Facility 3, e.g. mvcrl.  */
Packit Service 6d4f8a
Packit Service 6d4f8a
#define S390_IS_ARCH13_MIE3(STFLE_BITS)			\
Packit Service 6d4f8a
  ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_ARCH13_MIE3))) != 0)
Packit 6c4009
Packit 6c4009
#define S390_IS_Z196(STFLE_BITS)			\
Packit 6c4009
  ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_Z196))) != 0)
Packit 6c4009
Packit 6c4009
#define S390_IS_Z10(STFLE_BITS)				\
Packit 6c4009
  ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_Z10))) != 0)
Packit 6c4009
Packit 6c4009
#define S390_STORE_STFLE(STFLE_BITS)					\
Packit 6c4009
  /* We want just 1 double word to be returned.  */			\
Packit 6c4009
  register unsigned long reg0 __asm__("0") = 0;				\
Packit 6c4009
									\
Packit 6c4009
  __asm__ __volatile__(".machine push"        "\n\t"			\
Packit 6c4009
		       ".machine \"z9-109\""  "\n\t"			\
Packit 6c4009
		       ".machinemode \"zarch_nohighgprs\"\n\t"		\
Packit 6c4009
		       "stfle %0"             "\n\t"			\
Packit 6c4009
		       ".machine pop"         "\n"			\
Packit 6c4009
		       : "=QS" (STFLE_BITS), "+d" (reg0)		\
Packit 6c4009
		       : : "cc");
Packit Service eafc22
#define s390_libc_ifunc_expr_stfle_init()				\
Packit 6c4009
  unsigned long long stfle_bits = 0ULL;					\
Packit Service c4c4e8
  if (__glibc_likely ((hwcap & HWCAP_S390_STFLE)			\
Packit Service c4c4e8
		      && (hwcap & HWCAP_S390_ZARCH)			\
Packit Service c4c4e8
		      && (hwcap & HWCAP_S390_HIGH_GPRS)))		\
Packit 6c4009
    {									\
Packit 6c4009
      S390_STORE_STFLE (stfle_bits);					\
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
#define s390_libc_ifunc_expr_init()
Packit 6c4009
#define s390_libc_ifunc_expr(TYPE_FUNC, FUNC, EXPR)		\
Packit 6c4009
  __ifunc (TYPE_FUNC, FUNC, EXPR, unsigned long int hwcap,	\
Packit 6c4009
	   s390_libc_ifunc_expr_init);