Beispiel #1
0
static int
do_test (int argc, char **argv)
{
  int fails;

  get_cpuinfo ();
  fails = check_proc ("avx", HAS_ARCH_FEATURE (AVX_Usable),
		      "HAS_ARCH_FEATURE (AVX_Usable)");
  fails += check_proc ("fma4", HAS_ARCH_FEATURE (FMA4_Usable),
		       "HAS_ARCH_FEATURE (FMA4_Usable)");
  fails += check_proc ("sse4_2", HAS_CPU_FEATURE (SSE4_2),
		       "HAS_CPU_FEATURE (SSE4_2)");
  fails += check_proc ("sse4_1", HAS_CPU_FEATURE (SSE4_1)
		       , "HAS_CPU_FEATURE (SSE4_1)");
  fails += check_proc ("ssse3", HAS_CPU_FEATURE (SSSE3),
		       "HAS_CPU_FEATURE (SSSE3)");
  fails += check_proc ("popcnt", HAS_CPU_FEATURE (POPCOUNT),
		       "HAS_CPU_FEATURE (POPCOUNT)");

  printf ("%d differences between /proc/cpuinfo and glibc code.\n", fails);

  return (fails != 0);
}
Beispiel #2
0
/* Force elision for all new locks.  This is used to decide whether existing
   DEFAULT locks should be automatically upgraded to elision in
   pthread_mutex_lock().  Disabled for suid programs.  Only used when elision
   is available.  */

int __pthread_force_elision attribute_hidden;

/* Initialize elison.  */

static void
elision_init (int argc __attribute__ ((unused)),
	      char **argv  __attribute__ ((unused)),
	      char **environ)
{
  __elision_available = HAS_CPU_FEATURE (RTM);
#ifdef ENABLE_LOCK_ELISION
  __pthread_force_elision = __libc_enable_secure ? 0 : __elision_available;
#endif
  if (!HAS_CPU_FEATURE (RTM))
    __elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks */
}

#ifdef SHARED
# define INIT_SECTION ".init_array"
#else
# define INIT_SECTION ".preinit_array"
#endif

void (*const __pthread_init_array []) (int, char **, char **)
  __attribute__ ((section (INIT_SECTION), aligned (sizeof (void *)))) =
Beispiel #3
0
static int
do_test (void)
{
  const struct cpu_features *cpu_features = __get_cpu_features ();

  switch (cpu_features->basic.kind)
    {
    case arch_kind_intel:
    case arch_kind_amd:
    case arch_kind_other:
      printf ("Vendor: %s\n", cpu_kinds[cpu_features->basic.kind]);
      printf ("Family: 0x%x\n", cpu_features->basic.family);
      printf ("Model: 0x%x\n", cpu_features->basic.model);
      printf ("Stepping: 0x%x\n", cpu_features->basic.stepping);
      break;

    default:
      abort ();
    }

#ifdef __SSE2__
  TEST_VERIFY_EXIT (HAS_CPU_FEATURE (SSE2));
#endif

  printf ("CPU features:\n");
  CHECK_CPU_FEATURE (SSE3);
  CHECK_CPU_FEATURE (PCLMULQDQ);
  CHECK_CPU_FEATURE (DTES64);
  CHECK_CPU_FEATURE (MONITOR);
  CHECK_CPU_FEATURE (DS_CPL);
  CHECK_CPU_FEATURE (VMX);
  CHECK_CPU_FEATURE (SMX);
  CHECK_CPU_FEATURE (EST);
  CHECK_CPU_FEATURE (TM2);
  CHECK_CPU_FEATURE (SSSE3);
  CHECK_CPU_FEATURE (CNXT_ID);
  CHECK_CPU_FEATURE (SDBG);
  CHECK_CPU_FEATURE (FMA);
  CHECK_CPU_FEATURE (CMPXCHG16B);
  CHECK_CPU_FEATURE (XTPRUPDCTRL);
  CHECK_CPU_FEATURE (PDCM);
  CHECK_CPU_FEATURE (PCID);
  CHECK_CPU_FEATURE (DCA);
  CHECK_CPU_FEATURE (SSE4_1);
  CHECK_CPU_FEATURE (SSE4_2);
  CHECK_CPU_FEATURE (X2APIC);
  CHECK_CPU_FEATURE (MOVBE);
  CHECK_CPU_FEATURE (POPCNT);
  CHECK_CPU_FEATURE (TSC_DEADLINE);
  CHECK_CPU_FEATURE (AES);
  CHECK_CPU_FEATURE (XSAVE);
  CHECK_CPU_FEATURE (OSXSAVE);
  CHECK_CPU_FEATURE (AVX);
  CHECK_CPU_FEATURE (F16C);
  CHECK_CPU_FEATURE (RDRAND);
  CHECK_CPU_FEATURE (FPU);
  CHECK_CPU_FEATURE (VME);
  CHECK_CPU_FEATURE (DE);
  CHECK_CPU_FEATURE (PSE);
  CHECK_CPU_FEATURE (TSC);
  CHECK_CPU_FEATURE (MSR);
  CHECK_CPU_FEATURE (PAE);
  CHECK_CPU_FEATURE (MCE);
  CHECK_CPU_FEATURE (CX8);
  CHECK_CPU_FEATURE (APIC);
  CHECK_CPU_FEATURE (SEP);
  CHECK_CPU_FEATURE (MTRR);
  CHECK_CPU_FEATURE (PGE);
  CHECK_CPU_FEATURE (MCA);
  CHECK_CPU_FEATURE (CMOV);
  CHECK_CPU_FEATURE (PAT);
  CHECK_CPU_FEATURE (PSE_36);
  CHECK_CPU_FEATURE (PSN);
  CHECK_CPU_FEATURE (CLFSH);
  CHECK_CPU_FEATURE (DS);
  CHECK_CPU_FEATURE (ACPI);
  CHECK_CPU_FEATURE (MMX);
  CHECK_CPU_FEATURE (FXSR);
  CHECK_CPU_FEATURE (SSE);
  CHECK_CPU_FEATURE (SSE2);
  CHECK_CPU_FEATURE (SS);
  CHECK_CPU_FEATURE (HTT);
  CHECK_CPU_FEATURE (TM);
  CHECK_CPU_FEATURE (PBE);
  CHECK_CPU_FEATURE (FSGSBASE);
  CHECK_CPU_FEATURE (TSC_ADJUST);
  CHECK_CPU_FEATURE (SGX);
  CHECK_CPU_FEATURE (BMI1);
  CHECK_CPU_FEATURE (HLE);
  CHECK_CPU_FEATURE (AVX2);
  CHECK_CPU_FEATURE (SMEP);
  CHECK_CPU_FEATURE (BMI2);
  CHECK_CPU_FEATURE (ERMS);
  CHECK_CPU_FEATURE (INVPCID);
  CHECK_CPU_FEATURE (RTM);
  CHECK_CPU_FEATURE (PQM);
  CHECK_CPU_FEATURE (MPX);
  CHECK_CPU_FEATURE (PQE);
  CHECK_CPU_FEATURE (AVX512F);
  CHECK_CPU_FEATURE (AVX512DQ);
  CHECK_CPU_FEATURE (RDSEED);
  CHECK_CPU_FEATURE (ADX);
  CHECK_CPU_FEATURE (SMAP);
  CHECK_CPU_FEATURE (AVX512_IFMA);
  CHECK_CPU_FEATURE (CLFLUSHOPT);
  CHECK_CPU_FEATURE (CLWB);
  CHECK_CPU_FEATURE (TRACE);
  CHECK_CPU_FEATURE (AVX512PF);
  CHECK_CPU_FEATURE (AVX512ER);
  CHECK_CPU_FEATURE (AVX512CD);
  CHECK_CPU_FEATURE (SHA);
  CHECK_CPU_FEATURE (AVX512BW);
  CHECK_CPU_FEATURE (AVX512VL);
  CHECK_CPU_FEATURE (PREFETCHWT1);
  CHECK_CPU_FEATURE (AVX512_VBMI);
  CHECK_CPU_FEATURE (UMIP);
  CHECK_CPU_FEATURE (PKU);
  CHECK_CPU_FEATURE (OSPKE);
  CHECK_CPU_FEATURE (WAITPKG);
  CHECK_CPU_FEATURE (AVX512_VBMI2);
  CHECK_CPU_FEATURE (SHSTK);
  CHECK_CPU_FEATURE (GFNI);
  CHECK_CPU_FEATURE (VAES);
  CHECK_CPU_FEATURE (VPCLMULQDQ);
  CHECK_CPU_FEATURE (AVX512_VNNI);
  CHECK_CPU_FEATURE (AVX512_BITALG);
  CHECK_CPU_FEATURE (AVX512_VPOPCNTDQ);
  CHECK_CPU_FEATURE (RDPID);
  CHECK_CPU_FEATURE (CLDEMOTE);
  CHECK_CPU_FEATURE (MOVDIRI);
  CHECK_CPU_FEATURE (MOVDIR64B);
  CHECK_CPU_FEATURE (SGX_LC);
  CHECK_CPU_FEATURE (AVX512_4VNNIW);
  CHECK_CPU_FEATURE (AVX512_4FMAPS);
  CHECK_CPU_FEATURE (FSRM);
  CHECK_CPU_FEATURE (PCONFIG);
  CHECK_CPU_FEATURE (IBT);
  CHECK_CPU_FEATURE (IBRS_IBPB);
  CHECK_CPU_FEATURE (STIBP);
  CHECK_CPU_FEATURE (CAPABILITIES);
  CHECK_CPU_FEATURE (SSBD);
  CHECK_CPU_FEATURE (LAHF64_SAHF64);
  CHECK_CPU_FEATURE (SVM);
  CHECK_CPU_FEATURE (LZCNT);
  CHECK_CPU_FEATURE (SSE4A);
  CHECK_CPU_FEATURE (PREFETCHW);
  CHECK_CPU_FEATURE (XOP);
  CHECK_CPU_FEATURE (LWP);
  CHECK_CPU_FEATURE (FMA4);
  CHECK_CPU_FEATURE (TBM);
  CHECK_CPU_FEATURE (SYSCALL_SYSRET);
  CHECK_CPU_FEATURE (NX);
  CHECK_CPU_FEATURE (PAGE1GB);
  CHECK_CPU_FEATURE (RDTSCP);
  CHECK_CPU_FEATURE (LM);
  CHECK_CPU_FEATURE (XSAVEOPT);
  CHECK_CPU_FEATURE (XSAVEC);
  CHECK_CPU_FEATURE (XGETBV_ECX_1);
  CHECK_CPU_FEATURE (XSAVES);
  CHECK_CPU_FEATURE (INVARIANT_TSC);
  CHECK_CPU_FEATURE (WBNOINVD);

  printf ("Usable CPU features:\n");
  CHECK_CPU_FEATURE_USABLE (SSE3);
  CHECK_CPU_FEATURE_USABLE (PCLMULQDQ);
  CHECK_CPU_FEATURE_USABLE (SSSE3);
  CHECK_CPU_FEATURE_USABLE (FMA);
  CHECK_CPU_FEATURE_USABLE (CMPXCHG16B);
  CHECK_CPU_FEATURE_USABLE (SSE4_1);
  CHECK_CPU_FEATURE_USABLE (SSE4_2);
  CHECK_CPU_FEATURE_USABLE (MOVBE);
  CHECK_CPU_FEATURE_USABLE (POPCNT);
  CHECK_CPU_FEATURE_USABLE (AES);
  CHECK_CPU_FEATURE_USABLE (XSAVE);
  CHECK_CPU_FEATURE_USABLE (OSXSAVE);
  CHECK_CPU_FEATURE_USABLE (AVX);
  CHECK_CPU_FEATURE_USABLE (F16C);
  CHECK_CPU_FEATURE_USABLE (RDRAND);
  CHECK_CPU_FEATURE_USABLE (FPU);
  CHECK_CPU_FEATURE_USABLE (TSC);
  CHECK_CPU_FEATURE_USABLE (MSR);
  CHECK_CPU_FEATURE_USABLE (CX8);
  CHECK_CPU_FEATURE_USABLE (SEP);
  CHECK_CPU_FEATURE_USABLE (CMOV);
  CHECK_CPU_FEATURE_USABLE (CLFSH);
  CHECK_CPU_FEATURE_USABLE (MMX);
  CHECK_CPU_FEATURE_USABLE (FXSR);
  CHECK_CPU_FEATURE_USABLE (SSE);
  CHECK_CPU_FEATURE_USABLE (SSE2);
  CHECK_CPU_FEATURE_USABLE (FSGSBASE);
  CHECK_CPU_FEATURE_USABLE (BMI1);
  CHECK_CPU_FEATURE_USABLE (HLE);
  CHECK_CPU_FEATURE_USABLE (AVX2);
  CHECK_CPU_FEATURE_USABLE (BMI2);
  CHECK_CPU_FEATURE_USABLE (ERMS);
  CHECK_CPU_FEATURE_USABLE (AVX512F);
  CHECK_CPU_FEATURE_USABLE (AVX512DQ);
  CHECK_CPU_FEATURE_USABLE (RDSEED);
  CHECK_CPU_FEATURE_USABLE (ADX);
  CHECK_CPU_FEATURE_USABLE (AVX512_IFMA);
  CHECK_CPU_FEATURE_USABLE (CLFLUSHOPT);
  CHECK_CPU_FEATURE_USABLE (CLWB);
  CHECK_CPU_FEATURE_USABLE (AVX512PF);
  CHECK_CPU_FEATURE_USABLE (AVX512ER);
  CHECK_CPU_FEATURE_USABLE (AVX512CD);
  CHECK_CPU_FEATURE_USABLE (SHA);
  CHECK_CPU_FEATURE_USABLE (AVX512BW);
  CHECK_CPU_FEATURE_USABLE (AVX512VL);
  CHECK_CPU_FEATURE_USABLE (PREFETCHWT1);
  CHECK_CPU_FEATURE_USABLE (AVX512_VBMI);
  CHECK_CPU_FEATURE_USABLE (AVX512_VBMI2);
  CHECK_CPU_FEATURE_USABLE (GFNI);
  CHECK_CPU_FEATURE_USABLE (VAES);
  CHECK_CPU_FEATURE_USABLE (VPCLMULQDQ);
  CHECK_CPU_FEATURE_USABLE (AVX512_VNNI);
  CHECK_CPU_FEATURE_USABLE (AVX512_BITALG);
  CHECK_CPU_FEATURE_USABLE (AVX512_VPOPCNTDQ);
  CHECK_CPU_FEATURE_USABLE (RDPID);
  CHECK_CPU_FEATURE_USABLE (CLDEMOTE);
  CHECK_CPU_FEATURE_USABLE (MOVDIRI);
  CHECK_CPU_FEATURE_USABLE (MOVDIR64B);
  CHECK_CPU_FEATURE_USABLE (AVX512_4VNNIW);
  CHECK_CPU_FEATURE_USABLE (AVX512_4FMAPS);
  CHECK_CPU_FEATURE_USABLE (FSRM);
  CHECK_CPU_FEATURE_USABLE (LAHF64_SAHF64);
  CHECK_CPU_FEATURE_USABLE (LZCNT);
  CHECK_CPU_FEATURE_USABLE (SSE4A);
  CHECK_CPU_FEATURE_USABLE (PREFETCHW);
  CHECK_CPU_FEATURE_USABLE (XOP);
  CHECK_CPU_FEATURE_USABLE (FMA4);
  CHECK_CPU_FEATURE_USABLE (TBM);
  CHECK_CPU_FEATURE_USABLE (SYSCALL_SYSRET);
  CHECK_CPU_FEATURE_USABLE (RDTSCP);
  CHECK_CPU_FEATURE_USABLE (XSAVEOPT);
  CHECK_CPU_FEATURE_USABLE (XSAVEC);
  CHECK_CPU_FEATURE_USABLE (XGETBV_ECX_1);
  CHECK_CPU_FEATURE_USABLE (XSAVES);
  CHECK_CPU_FEATURE_USABLE (INVARIANT_TSC);
  CHECK_CPU_FEATURE_USABLE (WBNOINVD);

  return 0;
}
Beispiel #4
0
size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
			size_t max)
{
  assert (max >= MAX_IFUNC);

  size_t i = 0;

  /* Support sysdeps/x86_64/multiarch/memcmp.S.  */
  IFUNC_IMPL (i, name, memcmp,
	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSE4_1),
			      __memcmp_sse4_1)
	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSSE3),
			      __memcmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_sse2))

  /* Support sysdeps/x86_64/multiarch/memmove_chk.c.  */
  IFUNC_IMPL (i, name, __memmove_chk,
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memmove_chk_avx512_no_vzeroupper)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memmove_chk_avx512_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memmove_chk_avx512_unaligned_erms)
#endif
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memmove_chk_avx_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memmove_chk_avx_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memmove_chk_avx_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memmove_chk_ssse3_back)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memmove_chk_ssse3)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
			      __memmove_chk_sse2_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
			      __memmove_chk_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
			      __memmove_chk_sse2))

  /* Support sysdeps/x86_64/multiarch/memmove.S.  */
  IFUNC_IMPL (i, name, memmove,
	      IFUNC_IMPL_ADD (array, i, memmove,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memmove_avx_unaligned)
	      IFUNC_IMPL_ADD (array, i, memmove,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memmove_avx_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, memmove,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memmove_avx_unaligned_erms)
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, memmove,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memmove_avx512_no_vzeroupper)
	      IFUNC_IMPL_ADD (array, i, memmove,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memmove_avx512_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, memmove,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memmove_avx512_unaligned_erms)
#endif
	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
			      __memmove_ssse3_back)
	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
			      __memmove_ssse3)
	      IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_erms)
	      IFUNC_IMPL_ADD (array, i, memmove, 1,
			      __memmove_sse2_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, memmove, 1,
			      __memmove_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_sse2))

  /* Support sysdeps/x86_64/multiarch/memset_chk.S.  */
  IFUNC_IMPL (i, name, __memset_chk,
	      IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
			      __memset_chk_sse2)
	      IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
			      __memset_chk_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
			      __memset_chk_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_ARCH_FEATURE (AVX2_Usable),
			      __memset_chk_avx2)
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_ARCH_FEATURE (AVX2_Usable),
			      __memset_chk_avx2_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_ARCH_FEATURE (AVX2_Usable),
			      __memset_chk_avx2_unaligned_erms)
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memset_chk_avx512_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memset_chk_avx512_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memset_chk_avx512_no_vzeroupper)
#endif
	      )

  /* Support sysdeps/x86_64/multiarch/memset.S.  */
  IFUNC_IMPL (i, name, memset,
	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_sse2)
	      IFUNC_IMPL_ADD (array, i, memset, 1,
			      __memset_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, memset, 1,
			      __memset_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_erms)
	      IFUNC_IMPL_ADD (array, i, memset,
			      HAS_ARCH_FEATURE (AVX2_Usable),
			      __memset_avx2)
	      IFUNC_IMPL_ADD (array, i, memset,
			      HAS_ARCH_FEATURE (AVX2_Usable),
			      __memset_avx2_unaligned)
	      IFUNC_IMPL_ADD (array, i, memset,
			      HAS_ARCH_FEATURE (AVX2_Usable),
			      __memset_avx2_unaligned_erms)
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, memset,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memset_avx512_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, memset,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memset_avx512_unaligned)
	      IFUNC_IMPL_ADD (array, i, memset,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memset_avx512_no_vzeroupper)
#endif
	     )

  /* Support sysdeps/x86_64/multiarch/stpncpy.S.  */
  IFUNC_IMPL (i, name, stpncpy,
	      IFUNC_IMPL_ADD (array, i, stpncpy, HAS_CPU_FEATURE (SSSE3),
			      __stpncpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, stpncpy, 1,
			      __stpncpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_sse2))

  /* Support sysdeps/x86_64/multiarch/stpcpy.S.  */
  IFUNC_IMPL (i, name, stpcpy,
	      IFUNC_IMPL_ADD (array, i, stpcpy, HAS_CPU_FEATURE (SSSE3),
			      __stpcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_sse2))

  /* Support sysdeps/x86_64/multiarch/strcasecmp_l.S.  */
  IFUNC_IMPL (i, name, strcasecmp,
	      IFUNC_IMPL_ADD (array, i, strcasecmp,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __strcasecmp_avx)
	      IFUNC_IMPL_ADD (array, i, strcasecmp,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strcasecmp_sse42)
	      IFUNC_IMPL_ADD (array, i, strcasecmp,
			      HAS_CPU_FEATURE (SSSE3),
			      __strcasecmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_sse2))

  /* Support sysdeps/x86_64/multiarch/strcasecmp_l.S.  */
  IFUNC_IMPL (i, name, strcasecmp_l,
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __strcasecmp_l_avx)
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strcasecmp_l_sse42)
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
			      HAS_CPU_FEATURE (SSSE3),
			      __strcasecmp_l_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
			      __strcasecmp_l_sse2))

  /* Support sysdeps/x86_64/multiarch/strcat.S.  */
  IFUNC_IMPL (i, name, strcat,
	      IFUNC_IMPL_ADD (array, i, strcat, HAS_CPU_FEATURE (SSSE3),
			      __strcat_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_sse2))

  /* Support sysdeps/x86_64/multiarch/strchr.S.  */
  IFUNC_IMPL (i, name, strchr,
	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2_no_bsf)
	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_sse2))

  /* Support sysdeps/x86_64/multiarch/strcmp.S.  */
  IFUNC_IMPL (i, name, strcmp,
	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSE4_2),
			      __strcmp_sse42)
	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSSE3),
			      __strcmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_sse2))

  /* Support sysdeps/x86_64/multiarch/strcpy.S.  */
  IFUNC_IMPL (i, name, strcpy,
	      IFUNC_IMPL_ADD (array, i, strcpy, HAS_CPU_FEATURE (SSSE3),
			      __strcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_sse2))

  /* Support sysdeps/x86_64/multiarch/strcspn.S.  */
  IFUNC_IMPL (i, name, strcspn,
	      IFUNC_IMPL_ADD (array, i, strcspn, HAS_CPU_FEATURE (SSE4_2),
			      __strcspn_sse42)
	      IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_sse2))

  /* Support sysdeps/x86_64/multiarch/strncase_l.S.  */
  IFUNC_IMPL (i, name, strncasecmp,
	      IFUNC_IMPL_ADD (array, i, strncasecmp,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __strncasecmp_avx)
	      IFUNC_IMPL_ADD (array, i, strncasecmp,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strncasecmp_sse42)
	      IFUNC_IMPL_ADD (array, i, strncasecmp,
			      HAS_CPU_FEATURE (SSSE3),
			      __strncasecmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
			      __strncasecmp_sse2))

  /* Support sysdeps/x86_64/multiarch/strncase_l.S.  */
  IFUNC_IMPL (i, name, strncasecmp_l,
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __strncasecmp_l_avx)
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strncasecmp_l_sse42)
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
			      HAS_CPU_FEATURE (SSSE3),
			      __strncasecmp_l_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
			      __strncasecmp_l_sse2))

  /* Support sysdeps/x86_64/multiarch/strncat.S.  */
  IFUNC_IMPL (i, name, strncat,
	      IFUNC_IMPL_ADD (array, i, strncat, HAS_CPU_FEATURE (SSSE3),
			      __strncat_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncat, 1,
			      __strncat_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_sse2))

  /* Support sysdeps/x86_64/multiarch/strncpy.S.  */
  IFUNC_IMPL (i, name, strncpy,
	      IFUNC_IMPL_ADD (array, i, strncpy, HAS_CPU_FEATURE (SSSE3),
			      __strncpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncpy, 1,
			      __strncpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_sse2))

  /* Support sysdeps/x86_64/multiarch/strpbrk.S.  */
  IFUNC_IMPL (i, name, strpbrk,
	      IFUNC_IMPL_ADD (array, i, strpbrk, HAS_CPU_FEATURE (SSE4_2),
			      __strpbrk_sse42)
	      IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_sse2))


  /* Support sysdeps/x86_64/multiarch/strspn.S.  */
  IFUNC_IMPL (i, name, strspn,
	      IFUNC_IMPL_ADD (array, i, strspn, HAS_CPU_FEATURE (SSE4_2),
			      __strspn_sse42)
	      IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_sse2))

  /* Support sysdeps/x86_64/multiarch/strstr.c.  */
  IFUNC_IMPL (i, name, strstr,
	      IFUNC_IMPL_ADD (array, i, strstr, 1, __strstr_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, strstr, 1, __strstr_sse2))

  /* Support sysdeps/x86_64/multiarch/wcscpy.S.  */
  IFUNC_IMPL (i, name, wcscpy,
	      IFUNC_IMPL_ADD (array, i, wcscpy, HAS_CPU_FEATURE (SSSE3),
			      __wcscpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_sse2))

  /* Support sysdeps/x86_64/multiarch/wmemcmp.S.  */
  IFUNC_IMPL (i, name, wmemcmp,
	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSE4_1),
			      __wmemcmp_sse4_1)
	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSSE3),
			      __wmemcmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_sse2))

#ifdef SHARED
  /* Support sysdeps/x86_64/multiarch/memcpy_chk.S.  */
  IFUNC_IMPL (i, name, __memcpy_chk,
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memcpy_chk_avx512_no_vzeroupper)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memcpy_chk_avx512_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memcpy_chk_avx512_unaligned_erms)
#endif
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memcpy_chk_avx_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memcpy_chk_avx_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memcpy_chk_avx_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memcpy_chk_ssse3_back)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memcpy_chk_ssse3)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
			      __memcpy_chk_sse2_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
			      __memcpy_chk_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
			      __memcpy_chk_sse2))

  /* Support sysdeps/x86_64/multiarch/memcpy.S.  */
  IFUNC_IMPL (i, name, memcpy,
	      IFUNC_IMPL_ADD (array, i, memcpy,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memcpy_avx_unaligned)
	      IFUNC_IMPL_ADD (array, i, memcpy,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memcpy_avx_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, memcpy,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __memcpy_avx_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
			      __memcpy_ssse3_back)
	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
			      __memcpy_ssse3)
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, memcpy,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memcpy_avx512_no_vzeroupper)
	      IFUNC_IMPL_ADD (array, i, memcpy,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memcpy_avx512_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, memcpy,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __memcpy_avx512_unaligned_erms)
#endif
	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, memcpy, 1,
			      __memcpy_sse2_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, memcpy, 1,
			      __memcpy_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_erms)
	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_sse2))

  /* Support sysdeps/x86_64/multiarch/mempcpy_chk.S.  */
  IFUNC_IMPL (i, name, __mempcpy_chk,
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __mempcpy_chk_avx512_no_vzeroupper)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __mempcpy_chk_avx512_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __mempcpy_chk_avx512_unaligned_erms)
#endif
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __mempcpy_chk_avx_unaligned)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __mempcpy_chk_avx_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __mempcpy_chk_avx_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_chk_ssse3_back)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_chk_ssse3)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
			      __mempcpy_chk_sse2_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
			      __mempcpy_chk_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
			      __mempcpy_chk_sse2))

  /* Support sysdeps/x86_64/multiarch/mempcpy.S.  */
  IFUNC_IMPL (i, name, mempcpy,
#ifdef HAVE_AVX512_ASM_SUPPORT
	      IFUNC_IMPL_ADD (array, i, mempcpy,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __mempcpy_avx512_no_vzeroupper)
	      IFUNC_IMPL_ADD (array, i, mempcpy,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __mempcpy_avx512_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, mempcpy,
			      HAS_ARCH_FEATURE (AVX512F_Usable),
			      __mempcpy_avx512_unaligned_erms)
#endif
	      IFUNC_IMPL_ADD (array, i, mempcpy,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __mempcpy_avx_unaligned)
	      IFUNC_IMPL_ADD (array, i, mempcpy,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __mempcpy_avx_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, mempcpy,
			      HAS_ARCH_FEATURE (AVX_Usable),
			      __mempcpy_avx_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_ssse3_back)
	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, mempcpy, 1,
			      __mempcpy_sse2_unaligned_2)
	      IFUNC_IMPL_ADD (array, i, mempcpy, 1,
			      __mempcpy_sse2_unaligned_erms)
	      IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_erms)
	      IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_sse2))

  /* Support sysdeps/x86_64/multiarch/strncmp.S.  */
  IFUNC_IMPL (i, name, strncmp,
	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSE4_2),
			      __strncmp_sse42)
	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSSE3),
			      __strncmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_sse2))
#endif

  return i;
}
Beispiel #5
0
extern __typeof (__redirect_memmove) __memmove_sse2 attribute_hidden;
extern __typeof (__redirect_memmove) __memmove_ssse3 attribute_hidden;
extern __typeof (__redirect_memmove) __memmove_ssse3_back attribute_hidden;
extern __typeof (__redirect_memmove) __memmove_avx_unaligned attribute_hidden;

#endif

#include "string/memmove.c"

#if IS_IN (libc)
# include <shlib-compat.h>
# include "init-arch.h"

/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
   ifunc symbol properly.  */
extern __typeof (__redirect_memmove) __libc_memmove;
libc_ifunc (__libc_memmove,
	    HAS_ARCH_FEATURE (AVX_Fast_Unaligned_Load)
	    ? __memmove_avx_unaligned
	    : (HAS_CPU_FEATURE (SSSE3)
	       ? (HAS_ARCH_FEATURE (Fast_Copy_Backward)
	          ? __memmove_ssse3_back : __memmove_ssse3)
	       : __memmove_sse2));

strong_alias (__libc_memmove, memmove)

# if SHLIB_COMPAT (libc, GLIBC_2_2_5, GLIBC_2_14)
compat_symbol (libc, memmove, memcpy, GLIBC_2_2_5);
# endif
#endif
Beispiel #6
0
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

#include <sched.h>
#include "init-arch.h"

#define __sched_cpucount static generic_cpucount
#include <posix/sched_cpucount.c>
#undef __sched_cpucount

#define POPCNT(l) \
  ({ __cpu_mask r; \
     asm ("popcnt %1, %0" : "=r" (r) : "0" (l));\
     r; })
#define __sched_cpucount static popcount_cpucount
#include <posix/sched_cpucount.c>
#undef __sched_cpucount

libc_ifunc (__sched_cpucount,
	    HAS_CPU_FEATURE (POPCNT) ? popcount_cpucount : generic_cpucount);
Beispiel #7
0
size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
			size_t max)
{
  assert (max >= MAX_IFUNC);

  size_t i = 0;

  /* Support sysdeps/i386/i686/multiarch/bcopy.S.  */
  IFUNC_IMPL (i, name, bcopy,
	      IFUNC_IMPL_ADD (array, i, bcopy, HAS_CPU_FEATURE (SSSE3),
			      __bcopy_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, bcopy, HAS_CPU_FEATURE (SSSE3),
			      __bcopy_ssse3)
	      IFUNC_IMPL_ADD (array, i, bcopy, HAS_CPU_FEATURE (SSE2),
			      __bcopy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, bcopy, 1, __bcopy_ia32))

  /* Support sysdeps/i386/i686/multiarch/bzero.S.  */
  IFUNC_IMPL (i, name, bzero,
	      IFUNC_IMPL_ADD (array, i, bzero, HAS_CPU_FEATURE (SSE2),
			      __bzero_sse2_rep)
	      IFUNC_IMPL_ADD (array, i, bzero, HAS_CPU_FEATURE (SSE2),
			      __bzero_sse2)
	      IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ia32))

  /* Support sysdeps/i386/i686/multiarch/memchr.S.  */
  IFUNC_IMPL (i, name, memchr,
	      IFUNC_IMPL_ADD (array, i, memchr, HAS_CPU_FEATURE (SSE2),
			      __memchr_sse2_bsf)
	      IFUNC_IMPL_ADD (array, i, memchr, HAS_CPU_FEATURE (SSE2),
			      __memchr_sse2)
	      IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_ia32))

  /* Support sysdeps/i386/i686/multiarch/memcmp.S.  */
  IFUNC_IMPL (i, name, memcmp,
	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSE4_2),
			      __memcmp_sse4_2)
	      IFUNC_IMPL_ADD (array, i, memcmp, HAS_CPU_FEATURE (SSSE3),
			      __memcmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ia32))

#ifdef SHARED
  /* Support sysdeps/i386/i686/multiarch/memmove_chk.S.  */
  IFUNC_IMPL (i, name, __memmove_chk,
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memmove_chk_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memmove_chk_ssse3)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
			      HAS_CPU_FEATURE (SSE2),
			      __memmove_chk_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
			      __memmove_chk_ia32))
#endif

  /* Support sysdeps/i386/i686/multiarch/memmove.S.  */
  IFUNC_IMPL (i, name, memmove,
	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
			      __memmove_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSSE3),
			      __memmove_ssse3)
	      IFUNC_IMPL_ADD (array, i, memmove, HAS_CPU_FEATURE (SSE2),
			      __memmove_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ia32))

  /* Support sysdeps/i386/i686/multiarch/memrchr.S.  */
  IFUNC_IMPL (i, name, memrchr,
	      IFUNC_IMPL_ADD (array, i, memrchr, HAS_CPU_FEATURE (SSE2),
			      __memrchr_sse2_bsf)
	      IFUNC_IMPL_ADD (array, i, memrchr, HAS_CPU_FEATURE (SSE2),
			      __memrchr_sse2)
	      IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ia32))

#ifdef SHARED
  /* Support sysdeps/i386/i686/multiarch/memset_chk.S.  */
  IFUNC_IMPL (i, name, __memset_chk,
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_CPU_FEATURE (SSE2),
			      __memset_chk_sse2_rep)
	      IFUNC_IMPL_ADD (array, i, __memset_chk,
			      HAS_CPU_FEATURE (SSE2),
			      __memset_chk_sse2)
	      IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
			      __memset_chk_ia32))
#endif

  /* Support sysdeps/i386/i686/multiarch/memset.S.  */
  IFUNC_IMPL (i, name, memset,
	      IFUNC_IMPL_ADD (array, i, memset, HAS_CPU_FEATURE (SSE2),
			      __memset_sse2_rep)
	      IFUNC_IMPL_ADD (array, i, memset, HAS_CPU_FEATURE (SSE2),
			      __memset_sse2)
	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ia32))

  /* Support sysdeps/i386/i686/multiarch/rawmemchr.S.  */
  IFUNC_IMPL (i, name, rawmemchr,
	      IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_CPU_FEATURE (SSE2),
			      __rawmemchr_sse2_bsf)
	      IFUNC_IMPL_ADD (array, i, rawmemchr, HAS_CPU_FEATURE (SSE2),
			      __rawmemchr_sse2)
	      IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_ia32))

  /* Support sysdeps/i386/i686/multiarch/stpncpy.S.  */
  IFUNC_IMPL (i, name, stpncpy,
	      IFUNC_IMPL_ADD (array, i, stpncpy, HAS_CPU_FEATURE (SSSE3),
			      __stpncpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, stpncpy, HAS_CPU_FEATURE (SSE2),
			      __stpncpy_sse2)
	      IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/stpcpy.S.  */
  IFUNC_IMPL (i, name, stpcpy,
	      IFUNC_IMPL_ADD (array, i, stpcpy, HAS_CPU_FEATURE (SSSE3),
			      __stpcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, stpcpy, HAS_CPU_FEATURE (SSE2),
			      __stpcpy_sse2)
	      IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/strcasecmp.S.  */
  IFUNC_IMPL (i, name, strcasecmp,
	      IFUNC_IMPL_ADD (array, i, strcasecmp,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strcasecmp_sse4_2)
	      IFUNC_IMPL_ADD (array, i, strcasecmp,
			      HAS_CPU_FEATURE (SSSE3),
			      __strcasecmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ia32))

  /* Support sysdeps/i386/i686/multiarch/strcasecmp_l.S.  */
  IFUNC_IMPL (i, name, strcasecmp_l,
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strcasecmp_l_sse4_2)
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
			      HAS_CPU_FEATURE (SSSE3),
			      __strcasecmp_l_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
			      __strcasecmp_l_ia32))

  /* Support sysdeps/i386/i686/multiarch/strcat.S.  */
  IFUNC_IMPL (i, name, strcat,
	      IFUNC_IMPL_ADD (array, i, strcat, HAS_CPU_FEATURE (SSSE3),
			      __strcat_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcat, HAS_CPU_FEATURE (SSE2),
			      __strcat_sse2)
	      IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_ia32))

  /* Support sysdeps/i386/i686/multiarch/strchr.S.  */
  IFUNC_IMPL (i, name, strchr,
	      IFUNC_IMPL_ADD (array, i, strchr, HAS_CPU_FEATURE (SSE2),
			      __strchr_sse2_bsf)
	      IFUNC_IMPL_ADD (array, i, strchr, HAS_CPU_FEATURE (SSE2),
			      __strchr_sse2)
	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_ia32))

  /* Support sysdeps/i386/i686/multiarch/strcmp.S.  */
  IFUNC_IMPL (i, name, strcmp,
	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSE4_2),
			      __strcmp_sse4_2)
	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSSE3),
			      __strcmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_ia32))

  /* Support sysdeps/i386/i686/multiarch/strcpy.S.  */
  IFUNC_IMPL (i, name, strcpy,
	      IFUNC_IMPL_ADD (array, i, strcpy, HAS_CPU_FEATURE (SSSE3),
			      __strcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, strcpy, HAS_CPU_FEATURE (SSE2),
			      __strcpy_sse2)
	      IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/strcspn.S.  */
  IFUNC_IMPL (i, name, strcspn,
	      IFUNC_IMPL_ADD (array, i, strcspn, HAS_CPU_FEATURE (SSE4_2),
			      __strcspn_sse42)
	      IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_ia32))

  /* Support sysdeps/i386/i686/multiarch/strncase.S.  */
  IFUNC_IMPL (i, name, strncasecmp,
	      IFUNC_IMPL_ADD (array, i, strncasecmp,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strncasecmp_sse4_2)
	      IFUNC_IMPL_ADD (array, i, strncasecmp,
			      HAS_CPU_FEATURE (SSSE3),
			      __strncasecmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
			      __strncasecmp_ia32))

  /* Support sysdeps/i386/i686/multiarch/strncase_l.S.  */
  IFUNC_IMPL (i, name, strncasecmp_l,
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
			      HAS_CPU_FEATURE (SSE4_2),
			      __strncasecmp_l_sse4_2)
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
			      HAS_CPU_FEATURE (SSSE3),
			      __strncasecmp_l_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
			      __strncasecmp_l_ia32))

  /* Support sysdeps/i386/i686/multiarch/strncat.S.  */
  IFUNC_IMPL (i, name, strncat,
	      IFUNC_IMPL_ADD (array, i, strncat, HAS_CPU_FEATURE (SSSE3),
			      __strncat_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncat, HAS_CPU_FEATURE (SSE2),
			      __strncat_sse2)
	      IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_ia32))

  /* Support sysdeps/i386/i686/multiarch/strncpy.S.  */
  IFUNC_IMPL (i, name, strncpy,
	      IFUNC_IMPL_ADD (array, i, strncpy, HAS_CPU_FEATURE (SSSE3),
			      __strncpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncpy, HAS_CPU_FEATURE (SSE2),
			      __strncpy_sse2)
	      IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/strnlen.S.  */
  IFUNC_IMPL (i, name, strnlen,
	      IFUNC_IMPL_ADD (array, i, strnlen, HAS_CPU_FEATURE (SSE2),
			      __strnlen_sse2)
	      IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32))

  /* Support sysdeps/i386/i686/multiarch/strpbrk.S.  */
  IFUNC_IMPL (i, name, strpbrk,
	      IFUNC_IMPL_ADD (array, i, strpbrk, HAS_CPU_FEATURE (SSE4_2),
			      __strpbrk_sse42)
	      IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_ia32))

  /* Support sysdeps/i386/i686/multiarch/strrchr.S.  */
  IFUNC_IMPL (i, name, strrchr,
	      IFUNC_IMPL_ADD (array, i, strrchr, HAS_CPU_FEATURE (SSE2),
			      __strrchr_sse2_bsf)
	      IFUNC_IMPL_ADD (array, i, strrchr, HAS_CPU_FEATURE (SSE2),
			      __strrchr_sse2)
	      IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_ia32))

  /* Support sysdeps/i386/i686/multiarch/strspn.S.  */
  IFUNC_IMPL (i, name, strspn,
	      IFUNC_IMPL_ADD (array, i, strspn, HAS_CPU_FEATURE (SSE4_2),
			      __strspn_sse42)
	      IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_ia32))

  /* Support sysdeps/i386/i686/multiarch/wcschr.S.  */
  IFUNC_IMPL (i, name, wcschr,
	      IFUNC_IMPL_ADD (array, i, wcschr, HAS_CPU_FEATURE (SSE2),
			      __wcschr_sse2)
	      IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ia32))

  /* Support sysdeps/i386/i686/multiarch/wcscmp.S.  */
  IFUNC_IMPL (i, name, wcscmp,
	      IFUNC_IMPL_ADD (array, i, wcscmp, HAS_CPU_FEATURE (SSE2),
			      __wcscmp_sse2)
	      IFUNC_IMPL_ADD (array, i, wcscmp, 1, __wcscmp_ia32))

  /* Support sysdeps/i386/i686/multiarch/wcscpy.S.  */
  IFUNC_IMPL (i, name, wcscpy,
	      IFUNC_IMPL_ADD (array, i, wcscpy, HAS_CPU_FEATURE (SSSE3),
			      __wcscpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/wcslen.S.  */
  IFUNC_IMPL (i, name, wcslen,
	      IFUNC_IMPL_ADD (array, i, wcslen, HAS_CPU_FEATURE (SSE2),
			      __wcslen_sse2)
	      IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32))

  /* Support sysdeps/i386/i686/multiarch/wcsrchr.S.  */
  IFUNC_IMPL (i, name, wcsrchr,
	      IFUNC_IMPL_ADD (array, i, wcsrchr, HAS_CPU_FEATURE (SSE2),
			      __wcsrchr_sse2)
	      IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ia32))

  /* Support sysdeps/i386/i686/multiarch/wmemcmp.S.  */
  IFUNC_IMPL (i, name, wmemcmp,
	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSE4_2),
			      __wmemcmp_sse4_2)
	      IFUNC_IMPL_ADD (array, i, wmemcmp, HAS_CPU_FEATURE (SSSE3),
			      __wmemcmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_ia32))

#ifdef SHARED
  /* Support sysdeps/i386/i686/multiarch/memcpy_chk.S.  */
  IFUNC_IMPL (i, name, __memcpy_chk,
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memcpy_chk_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __memcpy_chk_ssse3)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
			      HAS_CPU_FEATURE (SSE2),
			      __memcpy_chk_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
			      __memcpy_chk_ia32))

  /* Support sysdeps/i386/i686/multiarch/memcpy.S.  */
  IFUNC_IMPL (i, name, memcpy,
	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
			      __memcpy_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSSE3),
			      __memcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, memcpy, HAS_CPU_FEATURE (SSE2),
			      __memcpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/mempcpy_chk.S.  */
  IFUNC_IMPL (i, name, __mempcpy_chk,
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_chk_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_chk_ssse3)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
			      HAS_CPU_FEATURE (SSE2),
			      __mempcpy_chk_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
			      __mempcpy_chk_ia32))

  /* Support sysdeps/i386/i686/multiarch/mempcpy.S.  */
  IFUNC_IMPL (i, name, mempcpy,
	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_ssse3_rep)
	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSSE3),
			      __mempcpy_ssse3)
	      IFUNC_IMPL_ADD (array, i, mempcpy, HAS_CPU_FEATURE (SSE2),
			      __mempcpy_sse2_unaligned)
	      IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ia32))

  /* Support sysdeps/i386/i686/multiarch/strlen.S.  */
  IFUNC_IMPL (i, name, strlen,
	      IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE2),
			      __strlen_sse2_bsf)
	      IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE2),
			      __strlen_sse2)
	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ia32))

  /* Support sysdeps/i386/i686/multiarch/strncmp.S.  */
  IFUNC_IMPL (i, name, strncmp,
	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSE4_2),
			      __strncmp_sse4_2)
	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSSE3),
			      __strncmp_ssse3)
	      IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ia32))
#endif

  return i;
}
Beispiel #8
0
/* Multiple versions of sincosf
   Copyright (C) 2012-2015 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

#include <init-arch.h>

extern void __sincosf_sse2 (float, float *, float *);
extern void __sincosf_ia32 (float, float *, float *);
void __sincosf (float, float *, float *);

libm_ifunc (__sincosf,
	    HAS_CPU_FEATURE (SSE2) ? __sincosf_sse2 : __sincosf_ia32);
weak_alias (__sincosf, sincosf);

#define SINCOSF __sincosf_ia32
#include <sysdeps/ieee754/flt-32/s_sincosf.c>
Beispiel #9
0
/* Multiple versions of sinf
   Copyright (C) 2012-2017 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

#include <init-arch.h>

extern float __sinf_sse2 (float);
extern float __sinf_ia32 (float);
float __sinf (float);

libm_ifunc (__sinf, HAS_CPU_FEATURE (SSE2) ? __sinf_sse2 : __sinf_ia32);
weak_alias (__sinf, sinf);
#define SINF __sinf_ia32
#include <sysdeps/ieee754/flt-32/s_sinf.c>