(root)/
glibc-2.38/
sysdeps/
i386/
i686/
multiarch/
ifunc-impl-list.c
       1  /* Enumerate available IFUNC implementations of a function.  i686 version.
       2     Copyright (C) 2012-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       4  
       5     The GNU C Library is free software; you can redistribute it and/or
       6     modify it under the terms of the GNU Lesser General Public
       7     License as published by the Free Software Foundation; either
       8     version 2.1 of the License, or (at your option) any later version.
       9  
      10     The GNU C Library is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13     Lesser General Public License for more details.
      14  
      15     You should have received a copy of the GNU Lesser General Public
      16     License along with the GNU C Library; if not, see
      17     <https://www.gnu.org/licenses/>.  */
      18  
      19  #include <assert.h>
      20  #include <string.h>
      21  #include <wchar.h>
      22  #include <ifunc-impl-list.h>
      23  #include "init-arch.h"
      24  
      25  /* Fill ARRAY of MAX elements with IFUNC implementations for function
      26     NAME and return the number of valid entries.  */
      27  
      28  size_t
      29  __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
      30  			size_t max)
      31  {
      32    size_t i = max;
      33  
      34    /* Support sysdeps/i386/i686/multiarch/memchr.S.  */
      35    IFUNC_IMPL (i, name, memchr,
      36  	      IFUNC_IMPL_ADD (array, i, memchr, CPU_FEATURE_USABLE (SSE2),
      37  			      __memchr_sse2_bsf)
      38  	      IFUNC_IMPL_ADD (array, i, memchr, CPU_FEATURE_USABLE (SSE2),
      39  			      __memchr_sse2)
      40  	      IFUNC_IMPL_ADD (array, i, memchr, 1, __memchr_ia32))
      41  
      42    /* Support sysdeps/i386/i686/multiarch/memcmp.S.  */
      43    IFUNC_IMPL (i, name, memcmp,
      44  	      IFUNC_IMPL_ADD (array, i, memcmp, CPU_FEATURE_USABLE (SSE4_2),
      45  			      __memcmp_sse4_2)
      46  	      IFUNC_IMPL_ADD (array, i, memcmp, CPU_FEATURE_USABLE (SSSE3),
      47  			      __memcmp_ssse3)
      48  	      IFUNC_IMPL_ADD (array, i, memcmp, 1, __memcmp_ia32))
      49  
      50  #ifdef SHARED
      51    /* Support sysdeps/i386/i686/multiarch/memmove_chk.S.  */
      52    IFUNC_IMPL (i, name, __memmove_chk,
      53  	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
      54  			      CPU_FEATURE_USABLE (SSSE3),
      55  			      __memmove_chk_ssse3_rep)
      56  	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
      57  			      CPU_FEATURE_USABLE (SSSE3),
      58  			      __memmove_chk_ssse3)
      59  	      IFUNC_IMPL_ADD (array, i, __memmove_chk,
      60  			      CPU_FEATURE_USABLE (SSE2),
      61  			      __memmove_chk_sse2_unaligned)
      62  	      IFUNC_IMPL_ADD (array, i, __memmove_chk, 1,
      63  			      __memmove_chk_ia32))
      64  
      65    /* Support sysdeps/i386/i686/multiarch/memmove.S.  */
      66    IFUNC_IMPL (i, name, memmove,
      67  	      IFUNC_IMPL_ADD (array, i, memmove, CPU_FEATURE_USABLE (SSSE3),
      68  			      __memmove_ssse3_rep)
      69  	      IFUNC_IMPL_ADD (array, i, memmove, CPU_FEATURE_USABLE (SSSE3),
      70  			      __memmove_ssse3)
      71  	      IFUNC_IMPL_ADD (array, i, memmove, CPU_FEATURE_USABLE (SSE2),
      72  			      __memmove_sse2_unaligned)
      73  	      IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_ia32))
      74  #endif
      75  
      76    /* Support sysdeps/i386/i686/multiarch/memrchr.S.  */
      77    IFUNC_IMPL (i, name, memrchr,
      78  	      IFUNC_IMPL_ADD (array, i, memrchr, CPU_FEATURE_USABLE (SSE2),
      79  			      __memrchr_sse2_bsf)
      80  	      IFUNC_IMPL_ADD (array, i, memrchr, CPU_FEATURE_USABLE (SSE2),
      81  			      __memrchr_sse2)
      82  	      IFUNC_IMPL_ADD (array, i, memrchr, 1, __memrchr_ia32))
      83  
      84  #ifdef SHARED
      85    /* Support sysdeps/i386/i686/multiarch/memset_chk.S.  */
      86    IFUNC_IMPL (i, name, __memset_chk,
      87  	      IFUNC_IMPL_ADD (array, i, __memset_chk,
      88  			      CPU_FEATURE_USABLE (SSE2),
      89  			      __memset_chk_sse2_rep)
      90  	      IFUNC_IMPL_ADD (array, i, __memset_chk,
      91  			      CPU_FEATURE_USABLE (SSE2),
      92  			      __memset_chk_sse2)
      93  	      IFUNC_IMPL_ADD (array, i, __memset_chk, 1,
      94  			      __memset_chk_ia32))
      95  #endif
      96  
      97    /* Support sysdeps/i386/i686/multiarch/memset.S.  */
      98    IFUNC_IMPL (i, name, memset,
      99  	      IFUNC_IMPL_ADD (array, i, memset, CPU_FEATURE_USABLE (SSE2),
     100  			      __memset_sse2_rep)
     101  	      IFUNC_IMPL_ADD (array, i, memset, CPU_FEATURE_USABLE (SSE2),
     102  			      __memset_sse2)
     103  	      IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ia32))
     104  
     105    /* Support sysdeps/i386/i686/multiarch/rawmemchr.S.  */
     106    IFUNC_IMPL (i, name, rawmemchr,
     107  	      IFUNC_IMPL_ADD (array, i, rawmemchr, CPU_FEATURE_USABLE (SSE2),
     108  			      __rawmemchr_sse2_bsf)
     109  	      IFUNC_IMPL_ADD (array, i, rawmemchr, CPU_FEATURE_USABLE (SSE2),
     110  			      __rawmemchr_sse2)
     111  	      IFUNC_IMPL_ADD (array, i, rawmemchr, 1, __rawmemchr_ia32))
     112  
     113    /* Support sysdeps/i386/i686/multiarch/stpncpy.S.  */
     114    IFUNC_IMPL (i, name, stpncpy,
     115  	      IFUNC_IMPL_ADD (array, i, stpncpy, CPU_FEATURE_USABLE (SSSE3),
     116  			      __stpncpy_ssse3)
     117  	      IFUNC_IMPL_ADD (array, i, stpncpy, CPU_FEATURE_USABLE (SSE2),
     118  			      __stpncpy_sse2)
     119  	      IFUNC_IMPL_ADD (array, i, stpncpy, 1, __stpncpy_ia32))
     120  
     121    /* Support sysdeps/i386/i686/multiarch/stpcpy.S.  */
     122    IFUNC_IMPL (i, name, stpcpy,
     123  	      IFUNC_IMPL_ADD (array, i, stpcpy, CPU_FEATURE_USABLE (SSSE3),
     124  			      __stpcpy_ssse3)
     125  	      IFUNC_IMPL_ADD (array, i, stpcpy, CPU_FEATURE_USABLE (SSE2),
     126  			      __stpcpy_sse2)
     127  	      IFUNC_IMPL_ADD (array, i, stpcpy, 1, __stpcpy_ia32))
     128  
     129    /* Support sysdeps/i386/i686/multiarch/strcasecmp.S.  */
     130    IFUNC_IMPL (i, name, strcasecmp,
     131  	      IFUNC_IMPL_ADD (array, i, strcasecmp,
     132  			      CPU_FEATURE_USABLE (SSE4_2),
     133  			      __strcasecmp_sse4_2)
     134  	      IFUNC_IMPL_ADD (array, i, strcasecmp,
     135  			      CPU_FEATURE_USABLE (SSSE3),
     136  			      __strcasecmp_ssse3)
     137  	      IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ia32))
     138  
     139    /* Support sysdeps/i386/i686/multiarch/strcasecmp_l.S.  */
     140    IFUNC_IMPL (i, name, strcasecmp_l,
     141  	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
     142  			      CPU_FEATURE_USABLE (SSE4_2),
     143  			      __strcasecmp_l_sse4_2)
     144  	      IFUNC_IMPL_ADD (array, i, strcasecmp_l,
     145  			      CPU_FEATURE_USABLE (SSSE3),
     146  			      __strcasecmp_l_ssse3)
     147  	      IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
     148  			      __strcasecmp_l_ia32))
     149  
     150    /* Support sysdeps/i386/i686/multiarch/strcat.S.  */
     151    IFUNC_IMPL (i, name, strcat,
     152  	      IFUNC_IMPL_ADD (array, i, strcat, CPU_FEATURE_USABLE (SSSE3),
     153  			      __strcat_ssse3)
     154  	      IFUNC_IMPL_ADD (array, i, strcat, CPU_FEATURE_USABLE (SSE2),
     155  			      __strcat_sse2)
     156  	      IFUNC_IMPL_ADD (array, i, strcat, 1, __strcat_ia32))
     157  
     158    /* Support sysdeps/i386/i686/multiarch/strchr.S.  */
     159    IFUNC_IMPL (i, name, strchr,
     160  	      IFUNC_IMPL_ADD (array, i, strchr, CPU_FEATURE_USABLE (SSE2),
     161  			      __strchr_sse2_bsf)
     162  	      IFUNC_IMPL_ADD (array, i, strchr, CPU_FEATURE_USABLE (SSE2),
     163  			      __strchr_sse2)
     164  	      IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_ia32))
     165  
     166    /* Support sysdeps/i386/i686/multiarch/strcmp.S.  */
     167    IFUNC_IMPL (i, name, strcmp,
     168  	      IFUNC_IMPL_ADD (array, i, strcmp, CPU_FEATURE_USABLE (SSE4_2),
     169  			      __strcmp_sse4_2)
     170  	      IFUNC_IMPL_ADD (array, i, strcmp, CPU_FEATURE_USABLE (SSSE3),
     171  			      __strcmp_ssse3)
     172  	      IFUNC_IMPL_ADD (array, i, strcmp, 1, __strcmp_ia32))
     173  
     174    /* Support sysdeps/i386/i686/multiarch/strcpy.S.  */
     175    IFUNC_IMPL (i, name, strcpy,
     176  	      IFUNC_IMPL_ADD (array, i, strcpy, CPU_FEATURE_USABLE (SSSE3),
     177  			      __strcpy_ssse3)
     178  	      IFUNC_IMPL_ADD (array, i, strcpy, CPU_FEATURE_USABLE (SSE2),
     179  			      __strcpy_sse2)
     180  	      IFUNC_IMPL_ADD (array, i, strcpy, 1, __strcpy_ia32))
     181  
     182    /* Support sysdeps/i386/i686/multiarch/strcspn.S.  */
     183    IFUNC_IMPL (i, name, strcspn,
     184  	      IFUNC_IMPL_ADD (array, i, strcspn, CPU_FEATURE_USABLE (SSE4_2),
     185  			      __strcspn_sse42)
     186  	      IFUNC_IMPL_ADD (array, i, strcspn, 1, __strcspn_ia32))
     187  
     188    /* Support sysdeps/i386/i686/multiarch/strncase.S.  */
     189    IFUNC_IMPL (i, name, strncasecmp,
     190  	      IFUNC_IMPL_ADD (array, i, strncasecmp,
     191  			      CPU_FEATURE_USABLE (SSE4_2),
     192  			      __strncasecmp_sse4_2)
     193  	      IFUNC_IMPL_ADD (array, i, strncasecmp,
     194  			      CPU_FEATURE_USABLE (SSSE3),
     195  			      __strncasecmp_ssse3)
     196  	      IFUNC_IMPL_ADD (array, i, strncasecmp, 1,
     197  			      __strncasecmp_ia32))
     198  
     199    /* Support sysdeps/i386/i686/multiarch/strncase_l.S.  */
     200    IFUNC_IMPL (i, name, strncasecmp_l,
     201  	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
     202  			      CPU_FEATURE_USABLE (SSE4_2),
     203  			      __strncasecmp_l_sse4_2)
     204  	      IFUNC_IMPL_ADD (array, i, strncasecmp_l,
     205  			      CPU_FEATURE_USABLE (SSSE3),
     206  			      __strncasecmp_l_ssse3)
     207  	      IFUNC_IMPL_ADD (array, i, strncasecmp_l, 1,
     208  			      __strncasecmp_l_ia32))
     209  
     210    /* Support sysdeps/i386/i686/multiarch/strncat.S.  */
     211    IFUNC_IMPL (i, name, strncat,
     212  	      IFUNC_IMPL_ADD (array, i, strncat, CPU_FEATURE_USABLE (SSSE3),
     213  			      __strncat_ssse3)
     214  	      IFUNC_IMPL_ADD (array, i, strncat, CPU_FEATURE_USABLE (SSE2),
     215  			      __strncat_sse2)
     216  	      IFUNC_IMPL_ADD (array, i, strncat, 1, __strncat_ia32))
     217  
     218    /* Support sysdeps/i386/i686/multiarch/strncpy.S.  */
     219    IFUNC_IMPL (i, name, strncpy,
     220  	      IFUNC_IMPL_ADD (array, i, strncpy, CPU_FEATURE_USABLE (SSSE3),
     221  			      __strncpy_ssse3)
     222  	      IFUNC_IMPL_ADD (array, i, strncpy, CPU_FEATURE_USABLE (SSE2),
     223  			      __strncpy_sse2)
     224  	      IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_ia32))
     225  
     226    /* Support sysdeps/i386/i686/multiarch/strnlen.S.  */
     227    IFUNC_IMPL (i, name, strnlen,
     228  	      IFUNC_IMPL_ADD (array, i, strnlen, CPU_FEATURE_USABLE (SSE2),
     229  			      __strnlen_sse2)
     230  	      IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32))
     231  
     232    /* Support sysdeps/i386/i686/multiarch/strpbrk.S.  */
     233    IFUNC_IMPL (i, name, strpbrk,
     234  	      IFUNC_IMPL_ADD (array, i, strpbrk, CPU_FEATURE_USABLE (SSE4_2),
     235  			      __strpbrk_sse42)
     236  	      IFUNC_IMPL_ADD (array, i, strpbrk, 1, __strpbrk_ia32))
     237  
     238    /* Support sysdeps/i386/i686/multiarch/strrchr.S.  */
     239    IFUNC_IMPL (i, name, strrchr,
     240  	      IFUNC_IMPL_ADD (array, i, strrchr, CPU_FEATURE_USABLE (SSE2),
     241  			      __strrchr_sse2_bsf)
     242  	      IFUNC_IMPL_ADD (array, i, strrchr, CPU_FEATURE_USABLE (SSE2),
     243  			      __strrchr_sse2)
     244  	      IFUNC_IMPL_ADD (array, i, strrchr, 1, __strrchr_ia32))
     245  
     246    /* Support sysdeps/i386/i686/multiarch/strspn.S.  */
     247    IFUNC_IMPL (i, name, strspn,
     248  	      IFUNC_IMPL_ADD (array, i, strspn, CPU_FEATURE_USABLE (SSE4_2),
     249  			      __strspn_sse42)
     250  	      IFUNC_IMPL_ADD (array, i, strspn, 1, __strspn_ia32))
     251  
     252    /* Support sysdeps/i386/i686/multiarch/wcschr.S.  */
     253    IFUNC_IMPL (i, name, wcschr,
     254  	      IFUNC_IMPL_ADD (array, i, wcschr, CPU_FEATURE_USABLE (SSE2),
     255  			      __wcschr_sse2)
     256  	      IFUNC_IMPL_ADD (array, i, wcschr, 1, __wcschr_ia32))
     257  
     258    /* Support sysdeps/i386/i686/multiarch/wcscmp.S.  */
     259    IFUNC_IMPL (i, name, wcscmp,
     260  	      IFUNC_IMPL_ADD (array, i, wcscmp, CPU_FEATURE_USABLE (SSE2),
     261  			      __wcscmp_sse2)
     262  	      IFUNC_IMPL_ADD (array, i, wcscmp, 1, __wcscmp_ia32))
     263  
     264    /* Support sysdeps/i386/i686/multiarch/wcscpy.S.  */
     265    IFUNC_IMPL (i, name, wcscpy,
     266  	      IFUNC_IMPL_ADD (array, i, wcscpy, CPU_FEATURE_USABLE (SSSE3),
     267  			      __wcscpy_ssse3)
     268  	      IFUNC_IMPL_ADD (array, i, wcscpy, 1, __wcscpy_ia32))
     269  
     270    /* Support sysdeps/i386/i686/multiarch/wcslen.S.  */
     271    IFUNC_IMPL (i, name, wcslen,
     272  	      IFUNC_IMPL_ADD (array, i, wcslen, CPU_FEATURE_USABLE (SSE2),
     273  			      __wcslen_sse2)
     274  	      IFUNC_IMPL_ADD (array, i, wcslen, 1, __wcslen_ia32))
     275  
     276    /* Support sysdeps/i386/i686/multiarch/wcsrchr.S.  */
     277    IFUNC_IMPL (i, name, wcsrchr,
     278  	      IFUNC_IMPL_ADD (array, i, wcsrchr, CPU_FEATURE_USABLE (SSE2),
     279  			      __wcsrchr_sse2)
     280  	      IFUNC_IMPL_ADD (array, i, wcsrchr, 1, __wcsrchr_ia32))
     281  
     282    /* Support sysdeps/i386/i686/multiarch/wmemcmp.S.  */
     283    IFUNC_IMPL (i, name, wmemcmp,
     284  	      IFUNC_IMPL_ADD (array, i, wmemcmp, CPU_FEATURE_USABLE (SSE4_2),
     285  			      __wmemcmp_sse4_2)
     286  	      IFUNC_IMPL_ADD (array, i, wmemcmp, CPU_FEATURE_USABLE (SSSE3),
     287  			      __wmemcmp_ssse3)
     288  	      IFUNC_IMPL_ADD (array, i, wmemcmp, 1, __wmemcmp_ia32))
     289  
     290  #ifdef SHARED
     291    /* Support sysdeps/i386/i686/multiarch/memcpy_chk.S.  */
     292    IFUNC_IMPL (i, name, __memcpy_chk,
     293  	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
     294  			      CPU_FEATURE_USABLE (SSSE3),
     295  			      __memcpy_chk_ssse3_rep)
     296  	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
     297  			      CPU_FEATURE_USABLE (SSSE3),
     298  			      __memcpy_chk_ssse3)
     299  	      IFUNC_IMPL_ADD (array, i, __memcpy_chk,
     300  			      CPU_FEATURE_USABLE (SSE2),
     301  			      __memcpy_chk_sse2_unaligned)
     302  	      IFUNC_IMPL_ADD (array, i, __memcpy_chk, 1,
     303  			      __memcpy_chk_ia32))
     304  
     305    /* Support sysdeps/i386/i686/multiarch/memcpy.S.  */
     306    IFUNC_IMPL (i, name, memcpy,
     307  	      IFUNC_IMPL_ADD (array, i, memcpy, CPU_FEATURE_USABLE (SSSE3),
     308  			      __memcpy_ssse3_rep)
     309  	      IFUNC_IMPL_ADD (array, i, memcpy, CPU_FEATURE_USABLE (SSSE3),
     310  			      __memcpy_ssse3)
     311  	      IFUNC_IMPL_ADD (array, i, memcpy, CPU_FEATURE_USABLE (SSE2),
     312  			      __memcpy_sse2_unaligned)
     313  	      IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ia32))
     314  
     315    /* Support sysdeps/i386/i686/multiarch/mempcpy_chk.S.  */
     316    IFUNC_IMPL (i, name, __mempcpy_chk,
     317  	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
     318  			      CPU_FEATURE_USABLE (SSSE3),
     319  			      __mempcpy_chk_ssse3_rep)
     320  	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
     321  			      CPU_FEATURE_USABLE (SSSE3),
     322  			      __mempcpy_chk_ssse3)
     323  	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk,
     324  			      CPU_FEATURE_USABLE (SSE2),
     325  			      __mempcpy_chk_sse2_unaligned)
     326  	      IFUNC_IMPL_ADD (array, i, __mempcpy_chk, 1,
     327  			      __mempcpy_chk_ia32))
     328  
     329    /* Support sysdeps/i386/i686/multiarch/mempcpy.S.  */
     330    IFUNC_IMPL (i, name, mempcpy,
     331  	      IFUNC_IMPL_ADD (array, i, mempcpy, CPU_FEATURE_USABLE (SSSE3),
     332  			      __mempcpy_ssse3_rep)
     333  	      IFUNC_IMPL_ADD (array, i, mempcpy, CPU_FEATURE_USABLE (SSSE3),
     334  			      __mempcpy_ssse3)
     335  	      IFUNC_IMPL_ADD (array, i, mempcpy, CPU_FEATURE_USABLE (SSE2),
     336  			      __mempcpy_sse2_unaligned)
     337  	      IFUNC_IMPL_ADD (array, i, mempcpy, 1, __mempcpy_ia32))
     338  
     339    /* Support sysdeps/i386/i686/multiarch/strlen.S.  */
     340    IFUNC_IMPL (i, name, strlen,
     341  	      IFUNC_IMPL_ADD (array, i, strlen, CPU_FEATURE_USABLE (SSE2),
     342  			      __strlen_sse2_bsf)
     343  	      IFUNC_IMPL_ADD (array, i, strlen, CPU_FEATURE_USABLE (SSE2),
     344  			      __strlen_sse2)
     345  	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ia32))
     346  
     347    /* Support sysdeps/i386/i686/multiarch/strncmp.S.  */
     348    IFUNC_IMPL (i, name, strncmp,
     349  	      IFUNC_IMPL_ADD (array, i, strncmp, CPU_FEATURE_USABLE (SSE4_2),
     350  			      __strncmp_sse4_2)
     351  	      IFUNC_IMPL_ADD (array, i, strncmp, CPU_FEATURE_USABLE (SSSE3),
     352  			      __strncmp_ssse3)
     353  	      IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ia32))
     354  #endif
     355  
     356    return 0;
     357  }