LCOV - code coverage report
Current view: top level - gcc/config/i386 - i386-builtins.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 95.2 % 849 808
Test Date: 2024-04-13 14:00:49 Functions: 96.0 % 25 24
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Copyright (C) 1988-2024 Free Software Foundation, Inc.
       2                 :             : 
       3                 :             : This file is part of GCC.
       4                 :             : 
       5                 :             : GCC is free software; you can redistribute it and/or modify
       6                 :             : it under the terms of the GNU General Public License as published by
       7                 :             : the Free Software Foundation; either version 3, or (at your option)
       8                 :             : any later version.
       9                 :             : 
      10                 :             : GCC 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
      13                 :             : GNU General Public License for more details.
      14                 :             : 
      15                 :             : You should have received a copy of the GNU General Public License
      16                 :             : along with GCC; see the file COPYING3.  If not see
      17                 :             : <http://www.gnu.org/licenses/>.  */
      18                 :             : 
      19                 :             : #define IN_TARGET_CODE 1
      20                 :             : 
      21                 :             : #include "config.h"
      22                 :             : #include "system.h"
      23                 :             : #include "coretypes.h"
      24                 :             : #include "backend.h"
      25                 :             : #include "rtl.h"
      26                 :             : #include "tree.h"
      27                 :             : #include "memmodel.h"
      28                 :             : #include "gimple.h"
      29                 :             : #include "cfghooks.h"
      30                 :             : #include "cfgloop.h"
      31                 :             : #include "df.h"
      32                 :             : #include "tm_p.h"
      33                 :             : #include "stringpool.h"
      34                 :             : #include "expmed.h"
      35                 :             : #include "optabs.h"
      36                 :             : #include "regs.h"
      37                 :             : #include "emit-rtl.h"
      38                 :             : #include "recog.h"
      39                 :             : #include "cgraph.h"
      40                 :             : #include "diagnostic.h"
      41                 :             : #include "cfgbuild.h"
      42                 :             : #include "alias.h"
      43                 :             : #include "fold-const.h"
      44                 :             : #include "attribs.h"
      45                 :             : #include "calls.h"
      46                 :             : #include "stor-layout.h"
      47                 :             : #include "varasm.h"
      48                 :             : #include "output.h"
      49                 :             : #include "insn-attr.h"
      50                 :             : #include "flags.h"
      51                 :             : #include "except.h"
      52                 :             : #include "explow.h"
      53                 :             : #include "expr.h"
      54                 :             : #include "cfgrtl.h"
      55                 :             : #include "common/common-target.h"
      56                 :             : #include "langhooks.h"
      57                 :             : #include "reload.h"
      58                 :             : #include "gimplify.h"
      59                 :             : #include "dwarf2.h"
      60                 :             : #include "tm-constrs.h"
      61                 :             : #include "cselib.h"
      62                 :             : #include "sched-int.h"
      63                 :             : #include "opts.h"
      64                 :             : #include "tree-pass.h"
      65                 :             : #include "context.h"
      66                 :             : #include "pass_manager.h"
      67                 :             : #include "target-globals.h"
      68                 :             : #include "gimple-iterator.h"
      69                 :             : #include "shrink-wrap.h"
      70                 :             : #include "builtins.h"
      71                 :             : #include "rtl-iter.h"
      72                 :             : #include "tree-iterator.h"
      73                 :             : #include "dbgcnt.h"
      74                 :             : #include "case-cfn-macros.h"
      75                 :             : #include "dojump.h"
      76                 :             : #include "fold-const-call.h"
      77                 :             : #include "tree-vrp.h"
      78                 :             : #include "tree-ssanames.h"
      79                 :             : #include "selftest.h"
      80                 :             : #include "selftest-rtl.h"
      81                 :             : #include "print-rtl.h"
      82                 :             : #include "intl.h"
      83                 :             : #include "ifcvt.h"
      84                 :             : #include "symbol-summary.h"
      85                 :             : #include "sreal.h"
      86                 :             : #include "ipa-cp.h"
      87                 :             : #include "ipa-prop.h"
      88                 :             : #include "ipa-fnsummary.h"
      89                 :             : #include "wide-int-bitmask.h"
      90                 :             : #include "tree-vector-builder.h"
      91                 :             : #include "debug.h"
      92                 :             : #include "dwarf2out.h"
      93                 :             : #include "i386-builtins.h"
      94                 :             : #include "common/config/i386/i386-isas.h"
      95                 :             : 
      96                 :             : #undef BDESC
      97                 :             : #undef BDESC_FIRST
      98                 :             : #undef BDESC_END
      99                 :             : 
     100                 :             : /* Macros for verification of enum ix86_builtins order.  */
     101                 :             : #define BDESC_VERIFY(x, y, z) \
     102                 :             :   gcc_checking_assert ((x) == (enum ix86_builtins) ((y) + (z)))
     103                 :             : #define BDESC_VERIFYS(x, y, z) \
     104                 :             :   STATIC_ASSERT ((x) == (enum ix86_builtins) ((y) + (z)))
     105                 :             : 
     106                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_PCMPESTR_FIRST,
     107                 :             :                IX86_BUILTIN__BDESC_COMI_LAST, 1);
     108                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_PCMPISTR_FIRST,
     109                 :             :                IX86_BUILTIN__BDESC_PCMPESTR_LAST, 1);
     110                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_SPECIAL_ARGS_FIRST,
     111                 :             :                IX86_BUILTIN__BDESC_PCMPISTR_LAST, 1);
     112                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_PURE_ARGS_FIRST,
     113                 :             :                IX86_BUILTIN__BDESC_SPECIAL_ARGS_LAST, 1);
     114                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_ARGS_FIRST,
     115                 :             :                IX86_BUILTIN__BDESC_PURE_ARGS_LAST, 1);
     116                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_ROUND_ARGS_FIRST,
     117                 :             :                IX86_BUILTIN__BDESC_ARGS_LAST, 1);
     118                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_MULTI_ARG_FIRST,
     119                 :             :                IX86_BUILTIN__BDESC_ROUND_ARGS_LAST, 1);
     120                 :             : BDESC_VERIFYS (IX86_BUILTIN__BDESC_CET_FIRST,
     121                 :             :                IX86_BUILTIN__BDESC_MULTI_ARG_LAST, 1);
     122                 :             : BDESC_VERIFYS (IX86_BUILTIN_MAX,
     123                 :             :                IX86_BUILTIN__BDESC_CET_LAST, 1);
     124                 :             : 
     125                 :             : 
     126                 :             : /* Table for the ix86 builtin non-function types.  */
     127                 :             : static GTY(()) tree ix86_builtin_type_tab[(int) IX86_BT_LAST_CPTR + 1];
     128                 :             : 
     129                 :             : tree ix86_float16_type_node = NULL_TREE;
     130                 :             : tree ix86_bf16_type_node = NULL_TREE;
     131                 :             : 
     132                 :             : /* Retrieve an element from the above table, building some of
     133                 :             :    the types lazily.  */
     134                 :             : 
     135                 :             : static tree
     136                 :   319284294 : ix86_get_builtin_type (enum ix86_builtin_type tcode)
     137                 :             : {
     138                 :   319284294 :   unsigned int index;
     139                 :   319284294 :   tree type, itype;
     140                 :             : 
     141                 :   319284294 :   gcc_assert ((unsigned)tcode < ARRAY_SIZE(ix86_builtin_type_tab));
     142                 :             : 
     143                 :   319284294 :   type = ix86_builtin_type_tab[(int) tcode];
     144                 :   319284294 :   if (type != NULL)
     145                 :             :     return type;
     146                 :             : 
     147                 :    11885164 :   gcc_assert (tcode > IX86_BT_LAST_PRIM);
     148                 :    11885164 :   if (tcode <= IX86_BT_LAST_VECT)
     149                 :             :     {
     150                 :     5076830 :       machine_mode mode;
     151                 :             : 
     152                 :     5076830 :       index = tcode - IX86_BT_LAST_PRIM - 1;
     153                 :     5076830 :       itype = ix86_get_builtin_type (ix86_builtin_type_vect_base[index]);
     154                 :     5076830 :       mode = ix86_builtin_type_vect_mode[index];
     155                 :             : 
     156                 :     5076830 :       type = build_vector_type_for_mode (itype, mode);
     157                 :             :     }
     158                 :             :   else
     159                 :             :     {
     160                 :     6808334 :       int quals;
     161                 :             : 
     162                 :     6808334 :       index = tcode - IX86_BT_LAST_VECT - 1;
     163                 :     6808334 :       if (tcode <= IX86_BT_LAST_PTR)
     164                 :             :         quals = TYPE_UNQUALIFIED;
     165                 :             :       else
     166                 :     2843497 :         quals = TYPE_QUAL_CONST;
     167                 :             : 
     168                 :     6808334 :       itype = ix86_get_builtin_type (ix86_builtin_type_ptr_base[index]);
     169                 :     6808334 :       if (quals != TYPE_UNQUALIFIED)
     170                 :     2843497 :         itype = build_qualified_type (itype, quals);
     171                 :             : 
     172                 :     6808334 :       type = build_pointer_type (itype);
     173                 :             :     }
     174                 :             : 
     175                 :    11885164 :   ix86_builtin_type_tab[(int) tcode] = type;
     176                 :    11885164 :   return type;
     177                 :             : }
     178                 :             : 
     179                 :             : /* Table for the ix86 builtin function types.  */
     180                 :             : static GTY(()) tree ix86_builtin_func_type_tab[(int) IX86_BT_LAST_ALIAS + 1];
     181                 :             : 
     182                 :             : /* Retrieve an element from the above table, building some of
     183                 :             :    the types lazily.  */
     184                 :             : 
     185                 :             : static tree
     186                 :   280317564 : ix86_get_builtin_func_type (enum ix86_builtin_func_type tcode)
     187                 :             : {
     188                 :   280317564 :   tree type;
     189                 :             : 
     190                 :   280317564 :   gcc_assert ((unsigned)tcode < ARRAY_SIZE (ix86_builtin_func_type_tab));
     191                 :             : 
     192                 :   280317564 :   type = ix86_builtin_func_type_tab[(int) tcode];
     193                 :   280317564 :   if (type != NULL)
     194                 :             :     return type;
     195                 :             : 
     196                 :    91921546 :   if (tcode <= IX86_BT_LAST_FUNC)
     197                 :             :     {
     198                 :    83736746 :       unsigned start = ix86_builtin_func_start[(int) tcode];
     199                 :    83736746 :       unsigned after = ix86_builtin_func_start[(int) tcode + 1];
     200                 :    83736746 :       tree rtype, atype, args = void_list_node;
     201                 :    83736746 :       unsigned i;
     202                 :             : 
     203                 :    83736746 :       rtype = ix86_get_builtin_type (ix86_builtin_func_args[start]);
     204                 :   307399130 :       for (i = after - 1; i > start; --i)
     205                 :             :         {
     206                 :   223662384 :           atype = ix86_get_builtin_type (ix86_builtin_func_args[i]);
     207                 :   223662384 :           args = tree_cons (NULL, atype, args);
     208                 :             :         }
     209                 :             : 
     210                 :    83736746 :       type = build_function_type (rtype, args);
     211                 :             :     }
     212                 :             :   else
     213                 :             :     {
     214                 :     8184800 :       unsigned index = tcode - IX86_BT_LAST_FUNC - 1;
     215                 :     8184800 :       enum ix86_builtin_func_type icode;
     216                 :             : 
     217                 :     8184800 :       icode = ix86_builtin_func_alias_base[index];
     218                 :     8184800 :       type = ix86_get_builtin_func_type (icode);
     219                 :             :     }
     220                 :             : 
     221                 :    91921546 :   ix86_builtin_func_type_tab[(int) tcode] = type;
     222                 :    91921546 :   return type;
     223                 :             : }
     224                 :             : 
     225                 :             : /* Table for the ix86 builtin decls.  */
     226                 :             : static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX + 1];
     227                 :             : 
     228                 :             : struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX];
     229                 :             : 
     230                 :       44038 : tree get_ix86_builtin (enum ix86_builtins c)
     231                 :             : {
     232                 :       44038 :   return ix86_builtins[c];
     233                 :             : }
     234                 :             : 
     235                 :             : /* Bits that can still enable any inclusion of a builtin.  */
     236                 :             : HOST_WIDE_INT deferred_isa_values = 0;
     237                 :             : HOST_WIDE_INT deferred_isa_values2 = 0;
     238                 :             : 
     239                 :             : /* Add an ix86 target builtin function with CODE, NAME and TYPE.  Save the
     240                 :             :    MASK and MASK2 of which isa_flags and ix86_isa_flags2 to use in the
     241                 :             :    ix86_builtins_isa array.  Stores the function decl in the ix86_builtins
     242                 :             :    array.  Returns the function decl or NULL_TREE, if the builtin was not
     243                 :             :    added.
     244                 :             : 
     245                 :             :    If the front end has a special hook for builtin functions, delay adding
     246                 :             :    builtin functions that aren't in the current ISA until the ISA is changed
     247                 :             :    with function specific optimization.  Doing so, can save about 300K for the
     248                 :             :    default compiler.  When the builtin is expanded, check at that time whether
     249                 :             :    it is valid.
     250                 :             : 
     251                 :             :    If the front end doesn't have a special hook, record all builtins, even if
     252                 :             :    it isn't an instruction set in the current ISA in case the user uses
     253                 :             :    function specific options for a different ISA, so that we don't get scope
     254                 :             :    errors if a builtin is added in the middle of a function scope.  */
     255                 :             : 
     256                 :             : static inline tree
     257                 :   853151992 : def_builtin (HOST_WIDE_INT mask, HOST_WIDE_INT mask2,
     258                 :             :              const char *name,
     259                 :             :              enum ix86_builtin_func_type tcode,
     260                 :             :              enum ix86_builtins code)
     261                 :             : {
     262                 :   853151992 :   tree decl = NULL_TREE;
     263                 :             : 
     264                 :             :   /* An instruction may be 64bit only regardless of ISAs.  */
     265                 :   853151992 :   if (!(mask & OPTION_MASK_ISA_64BIT) || TARGET_64BIT)
     266                 :             :     {
     267                 :   852728723 :       ix86_builtins_isa[(int) code].isa = mask;
     268                 :   852728723 :       ix86_builtins_isa[(int) code].isa2 = mask2;
     269                 :             : 
     270                 :   852728723 :       mask &= ~OPTION_MASK_ISA_64BIT;
     271                 :             : 
     272                 :             :       /* Filter out the masks most often ored together with others.  */
     273                 :   852728723 :       if ((mask & ix86_isa_flags & OPTION_MASK_ISA_AVX512VL)
     274                 :     2051489 :           && mask != OPTION_MASK_ISA_AVX512VL)
     275                 :      728886 :         mask &= ~OPTION_MASK_ISA_AVX512VL;
     276                 :   852728723 :       if ((mask & ix86_isa_flags & OPTION_MASK_ISA_AVX512BW)
     277                 :      611776 :           && mask != OPTION_MASK_ISA_AVX512BW)
     278                 :      209232 :         mask &= ~OPTION_MASK_ISA_AVX512BW;
     279                 :             : 
     280                 :   852728723 :       if (((mask2 == 0 || (mask2 & ix86_isa_flags2) != 0)
     281                 :   593198820 :            && (mask == 0 || (mask & ix86_isa_flags) != 0))
     282                 :   748204065 :           || ((mask & OPTION_MASK_ISA_MMX) != 0 && TARGET_MMX_WITH_SSE)
     283                 :             :           /* "Unified" builtin used by either AVXVNNI/AVXIFMA/AES intrinsics
     284                 :             :              or AVX512VNNIVL/AVX512IFMAVL/VAESVL non-mask intrinsics should be
     285                 :             :              defined whenever avxvnni/avxifma/aes or avx512vnni/avx512ifma/vaes
     286                 :             :              && avx512vl exist.  */
     287                 :   748074203 :           || (mask2 == OPTION_MASK_ISA2_AVXVNNI)
     288                 :   748074203 :           || (mask2 == OPTION_MASK_ISA2_AVXIFMA)
     289                 :   744982459 :           || (mask2 == (OPTION_MASK_ISA2_AVXNECONVERT
     290                 :             :                         | OPTION_MASK_ISA2_AVX512BF16))
     291                 :   744467261 :           || ((mask2 & OPTION_MASK_ISA2_VAES) != 0)
     292                 :   740363073 :           || (lang_hooks.builtin_function
     293                 :   740363073 :               == lang_hooks.builtin_function_ext_scope))
     294                 :             :         {
     295                 :   261161177 :           tree type = ix86_get_builtin_func_type (tcode);
     296                 :   261161177 :           decl = add_builtin_function (name, type, code, BUILT_IN_MD,
     297                 :             :                                        NULL, NULL_TREE);
     298                 :   261161177 :           ix86_builtins[(int) code] = decl;
     299                 :   261161177 :           ix86_builtins_isa[(int) code].set_and_not_built_p = false;
     300                 :   261161177 :           if (!flag_non_call_exceptions)
     301                 :   260704931 :             TREE_NOTHROW (decl) = 1;
     302                 :   261161177 :           if (ix86_builtins[(int) IX86_BUILTIN_MAX] == NULL_TREE)
     303                 :      257672 :             ix86_builtins[(int) IX86_BUILTIN_MAX]
     304                 :      257672 :               = build_tree_list (get_identifier ("leaf"), NULL_TREE);
     305                 :   261161177 :           DECL_ATTRIBUTES (decl) = ix86_builtins[(int) IX86_BUILTIN_MAX];
     306                 :   261161177 :         }
     307                 :             :       else
     308                 :             :         {
     309                 :             :           /* Just MASK and MASK2 where set_and_not_built_p == true can potentially
     310                 :             :              include a builtin.  */
     311                 :   591567546 :           deferred_isa_values |= mask;
     312                 :   591567546 :           deferred_isa_values2 |= mask2;
     313                 :   591567546 :           ix86_builtins[(int) code] = NULL_TREE;
     314                 :   591567546 :           ix86_builtins_isa[(int) code].tcode = tcode;
     315                 :   591567546 :           ix86_builtins_isa[(int) code].name = name;
     316                 :   591567546 :           ix86_builtins_isa[(int) code].const_p = false;
     317                 :   591567546 :           ix86_builtins_isa[(int) code].pure_p = false;
     318                 :   591567546 :           ix86_builtins_isa[(int) code].set_and_not_built_p = true;
     319                 :             :         }
     320                 :             :     }
     321                 :             : 
     322                 :   853151992 :   return decl;
     323                 :             : }
     324                 :             : 
     325                 :             : /* Like def_builtin, but also marks the function decl "const".  */
     326                 :             : 
     327                 :             : static inline tree
     328                 :   728696416 : def_builtin_const (HOST_WIDE_INT mask, HOST_WIDE_INT mask2, const char *name,
     329                 :             :                    enum ix86_builtin_func_type tcode, enum ix86_builtins code)
     330                 :             : {
     331                 :   728696416 :   tree decl = def_builtin (mask, mask2, name, tcode, code);
     332                 :   728696416 :   if (decl)
     333                 :   225502401 :     TREE_READONLY (decl) = 1;
     334                 :             :   else
     335                 :   503194015 :     ix86_builtins_isa[(int) code].const_p = true;
     336                 :             : 
     337                 :   728696416 :   return decl;
     338                 :             : }
     339                 :             : 
     340                 :             : /* Like def_builtin, but also marks the function decl "pure".  */
     341                 :             : 
     342                 :             : static inline tree
     343                 :    15717992 : def_builtin_pure (HOST_WIDE_INT mask, HOST_WIDE_INT mask2, const char *name,
     344                 :             :                   enum ix86_builtin_func_type tcode, enum ix86_builtins code)
     345                 :             : {
     346                 :    15717992 :   tree decl = def_builtin (mask, mask2, name, tcode, code);
     347                 :    15717992 :   if (decl)
     348                 :     3586365 :     DECL_PURE_P (decl) = 1;
     349                 :             :   else
     350                 :    12131627 :     ix86_builtins_isa[(int) code].pure_p = true;
     351                 :             : 
     352                 :    15717992 :   return decl;
     353                 :             : }
     354                 :             : 
     355                 :             : /* Add any new builtin functions for a given ISA that may not have been
     356                 :             :    declared.  This saves a bit of space compared to adding all of the
     357                 :             :    declarations to the tree, even if we didn't use them.  */
     358                 :             : 
     359                 :             : void
     360                 :    46420505 : ix86_add_new_builtins (HOST_WIDE_INT isa, HOST_WIDE_INT isa2)
     361                 :             : {
     362                 :    46420505 :   isa &= ~OPTION_MASK_ISA_64BIT;
     363                 :             : 
     364                 :    46420505 :   if ((isa & deferred_isa_values) == 0
     365                 :    46244301 :       && (isa2 & deferred_isa_values2) == 0
     366                 :    46089261 :       && ((deferred_isa_values & OPTION_MASK_ISA_MMX) == 0
     367                 :       14372 :           || !(TARGET_64BIT && (isa & OPTION_MASK_ISA_SSE2) != 0)))
     368                 :             :     return;
     369                 :             : 
     370                 :             :   /* Bits in ISA value can be removed from potential isa values.  */
     371                 :      331244 :   deferred_isa_values &= ~isa;
     372                 :      331244 :   deferred_isa_values2 &= ~isa2;
     373                 :      331244 :   if (TARGET_64BIT && (isa & OPTION_MASK_ISA_SSE2) != 0)
     374                 :      159613 :     deferred_isa_values &= ~OPTION_MASK_ISA_MMX;
     375                 :             : 
     376                 :      331244 :   int i;
     377                 :      331244 :   tree saved_current_target_pragma = current_target_pragma;
     378                 :      331244 :   current_target_pragma = NULL_TREE;
     379                 :             : 
     380                 :  1100061324 :   for (i = 0; i < (int)IX86_BUILTIN_MAX; i++)
     381                 :             :     {
     382                 :  1099730080 :       if (((ix86_builtins_isa[i].isa & isa) != 0
     383                 :   841985750 :            || (ix86_builtins_isa[i].isa2 & isa2) != 0
     384                 :   736936339 :            || ((ix86_builtins_isa[i].isa & OPTION_MASK_ISA_MMX) != 0
     385                 :    16300008 :                && TARGET_64BIT
     386                 :    16167528 :                && (isa & OPTION_MASK_ISA_SSE2) != 0))
     387                 :   362814374 :           && ix86_builtins_isa[i].set_and_not_built_p)
     388                 :             :         {
     389                 :     9415747 :           tree decl, type;
     390                 :             : 
     391                 :             :           /* Don't define the builtin again.  */
     392                 :     9415747 :           ix86_builtins_isa[i].set_and_not_built_p = false;
     393                 :             : 
     394                 :     9415747 :           type = ix86_get_builtin_func_type (ix86_builtins_isa[i].tcode);
     395                 :     9415747 :           decl = add_builtin_function_ext_scope (ix86_builtins_isa[i].name,
     396                 :             :                                                  type, i, BUILT_IN_MD, NULL,
     397                 :             :                                                  NULL_TREE);
     398                 :             : 
     399                 :     9415747 :           ix86_builtins[i] = decl;
     400                 :     9415747 :           if (ix86_builtins_isa[i].const_p)
     401                 :     7907455 :             TREE_READONLY (decl) = 1;
     402                 :     9415747 :           if (ix86_builtins_isa[i].pure_p)
     403                 :      145105 :             DECL_PURE_P (decl) = 1;
     404                 :     9415747 :           if (!flag_non_call_exceptions)
     405                 :     9392290 :             TREE_NOTHROW (decl) = 1;
     406                 :     9415747 :           if (ix86_builtins[(int) IX86_BUILTIN_MAX] == NULL_TREE)
     407                 :           0 :             ix86_builtins[(int) IX86_BUILTIN_MAX]
     408                 :           0 :               = build_tree_list (get_identifier ("leaf"), NULL_TREE);
     409                 :     9415747 :           DECL_ATTRIBUTES (decl) = ix86_builtins[(int) IX86_BUILTIN_MAX];
     410                 :             :         }
     411                 :             :     }
     412                 :             : 
     413                 :      331244 :   current_target_pragma = saved_current_target_pragma;
     414                 :             : }
     415                 :             : 
     416                 :             : /* TM vector builtins.  */
     417                 :             : 
     418                 :             : /* Reuse the existing x86-specific `struct builtin_description' cause
     419                 :             :    we're lazy.  Add casts to make them fit.  */
     420                 :             : static const struct builtin_description bdesc_tm[] =
     421                 :             : {
     422                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_WM64", (enum ix86_builtins) BUILT_IN_TM_STORE_M64, UNKNOWN, VOID_FTYPE_PV2SI_V2SI },
     423                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_WaRM64", (enum ix86_builtins) BUILT_IN_TM_STORE_WAR_M64, UNKNOWN, VOID_FTYPE_PV2SI_V2SI },
     424                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_WaWM64", (enum ix86_builtins) BUILT_IN_TM_STORE_WAW_M64, UNKNOWN, VOID_FTYPE_PV2SI_V2SI },
     425                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_RM64", (enum ix86_builtins) BUILT_IN_TM_LOAD_M64, UNKNOWN, V2SI_FTYPE_PCV2SI },
     426                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_RaRM64", (enum ix86_builtins) BUILT_IN_TM_LOAD_RAR_M64, UNKNOWN, V2SI_FTYPE_PCV2SI },
     427                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_RaWM64", (enum ix86_builtins) BUILT_IN_TM_LOAD_RAW_M64, UNKNOWN, V2SI_FTYPE_PCV2SI },
     428                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_RfWM64", (enum ix86_builtins) BUILT_IN_TM_LOAD_RFW_M64, UNKNOWN, V2SI_FTYPE_PCV2SI },
     429                 :             : 
     430                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_WM128", (enum ix86_builtins) BUILT_IN_TM_STORE_M128, UNKNOWN, VOID_FTYPE_PV4SF_V4SF },
     431                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_WaRM128", (enum ix86_builtins) BUILT_IN_TM_STORE_WAR_M128, UNKNOWN, VOID_FTYPE_PV4SF_V4SF },
     432                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_WaWM128", (enum ix86_builtins) BUILT_IN_TM_STORE_WAW_M128, UNKNOWN, VOID_FTYPE_PV4SF_V4SF },
     433                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_RM128", (enum ix86_builtins) BUILT_IN_TM_LOAD_M128, UNKNOWN, V4SF_FTYPE_PCV4SF },
     434                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_RaRM128", (enum ix86_builtins) BUILT_IN_TM_LOAD_RAR_M128, UNKNOWN, V4SF_FTYPE_PCV4SF },
     435                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_RaWM128", (enum ix86_builtins) BUILT_IN_TM_LOAD_RAW_M128, UNKNOWN, V4SF_FTYPE_PCV4SF },
     436                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_RfWM128", (enum ix86_builtins) BUILT_IN_TM_LOAD_RFW_M128, UNKNOWN, V4SF_FTYPE_PCV4SF },
     437                 :             : 
     438                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_WM256", (enum ix86_builtins) BUILT_IN_TM_STORE_M256, UNKNOWN, VOID_FTYPE_PV8SF_V8SF },
     439                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_WaRM256", (enum ix86_builtins) BUILT_IN_TM_STORE_WAR_M256, UNKNOWN, VOID_FTYPE_PV8SF_V8SF },
     440                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_WaWM256", (enum ix86_builtins) BUILT_IN_TM_STORE_WAW_M256, UNKNOWN, VOID_FTYPE_PV8SF_V8SF },
     441                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_RM256", (enum ix86_builtins) BUILT_IN_TM_LOAD_M256, UNKNOWN, V8SF_FTYPE_PCV8SF },
     442                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_RaRM256", (enum ix86_builtins) BUILT_IN_TM_LOAD_RAR_M256, UNKNOWN, V8SF_FTYPE_PCV8SF },
     443                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_RaWM256", (enum ix86_builtins) BUILT_IN_TM_LOAD_RAW_M256, UNKNOWN, V8SF_FTYPE_PCV8SF },
     444                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_RfWM256", (enum ix86_builtins) BUILT_IN_TM_LOAD_RFW_M256, UNKNOWN, V8SF_FTYPE_PCV8SF },
     445                 :             : 
     446                 :             :   { OPTION_MASK_ISA_MMX, 0, CODE_FOR_nothing, "__builtin__ITM_LM64", (enum ix86_builtins) BUILT_IN_TM_LOG_M64, UNKNOWN, VOID_FTYPE_PCVOID },
     447                 :             :   { OPTION_MASK_ISA_SSE, 0, CODE_FOR_nothing, "__builtin__ITM_LM128", (enum ix86_builtins) BUILT_IN_TM_LOG_M128, UNKNOWN, VOID_FTYPE_PCVOID },
     448                 :             :   { OPTION_MASK_ISA_AVX, 0, CODE_FOR_nothing, "__builtin__ITM_LM256", (enum ix86_builtins) BUILT_IN_TM_LOG_M256, UNKNOWN, VOID_FTYPE_PCVOID },
     449                 :             : };
     450                 :             : 
     451                 :             : /* Initialize the transactional memory vector load/store builtins.  */
     452                 :             : 
     453                 :             : static void
     454                 :      257672 : ix86_init_tm_builtins (void)
     455                 :             : {
     456                 :      257672 :   enum ix86_builtin_func_type ftype;
     457                 :      257672 :   const struct builtin_description *d;
     458                 :      257672 :   size_t i;
     459                 :      257672 :   tree decl;
     460                 :      257672 :   tree attrs_load, attrs_type_load, attrs_store, attrs_type_store;
     461                 :      257672 :   tree attrs_log, attrs_type_log;
     462                 :             : 
     463                 :      257672 :   if (!flag_tm)
     464                 :             :     return;
     465                 :             : 
     466                 :             :   /* If there are no builtins defined, we must be compiling in a
     467                 :             :      language without trans-mem support.  */
     468                 :         613 :   if (!builtin_decl_explicit_p (BUILT_IN_TM_LOAD_1))
     469                 :             :     return;
     470                 :             : 
     471                 :             :   /* Use whatever attributes a normal TM load has.  */
     472                 :         612 :   decl = builtin_decl_explicit (BUILT_IN_TM_LOAD_1);
     473                 :         612 :   attrs_load = DECL_ATTRIBUTES (decl);
     474                 :         612 :   attrs_type_load = TYPE_ATTRIBUTES (TREE_TYPE (decl));
     475                 :             :   /* Use whatever attributes a normal TM store has.  */
     476                 :         612 :   decl = builtin_decl_explicit (BUILT_IN_TM_STORE_1);
     477                 :         612 :   attrs_store = DECL_ATTRIBUTES (decl);
     478                 :         612 :   attrs_type_store = TYPE_ATTRIBUTES (TREE_TYPE (decl));
     479                 :             :   /* Use whatever attributes a normal TM log has.  */
     480                 :         612 :   decl = builtin_decl_explicit (BUILT_IN_TM_LOG);
     481                 :         612 :   attrs_log = DECL_ATTRIBUTES (decl);
     482                 :         612 :   attrs_type_log = TYPE_ATTRIBUTES (TREE_TYPE (decl));
     483                 :             : 
     484                 :         612 :   for (i = 0, d = bdesc_tm;
     485                 :       15300 :        i < ARRAY_SIZE (bdesc_tm);
     486                 :       14688 :        i++, d++)
     487                 :             :     {
     488                 :       14688 :       if ((d->mask & ix86_isa_flags) != 0
     489                 :        4896 :           || ((d->mask & OPTION_MASK_ISA_MMX) != 0 && TARGET_MMX_WITH_SSE)
     490                 :        4896 :           || (lang_hooks.builtin_function
     491                 :        4896 :               == lang_hooks.builtin_function_ext_scope))
     492                 :             :         {
     493                 :        9808 :           tree type, attrs, attrs_type;
     494                 :        9808 :           enum built_in_function code = (enum built_in_function) d->code;
     495                 :             : 
     496                 :        9808 :           ftype = (enum ix86_builtin_func_type) d->flag;
     497                 :        9808 :           type = ix86_get_builtin_func_type (ftype);
     498                 :             : 
     499                 :        9808 :           if (BUILTIN_TM_LOAD_P (code))
     500                 :             :             {
     501                 :             :               attrs = attrs_load;
     502                 :             :               attrs_type = attrs_type_load;
     503                 :             :             }
     504                 :        4904 :           else if (BUILTIN_TM_STORE_P (code))
     505                 :             :             {
     506                 :             :               attrs = attrs_store;
     507                 :             :               attrs_type = attrs_type_store;
     508                 :             :             }
     509                 :             :           else
     510                 :             :             {
     511                 :        1226 :               attrs = attrs_log;
     512                 :        1226 :               attrs_type = attrs_type_log;
     513                 :             :             }
     514                 :       19616 :           decl = add_builtin_function (d->name, type, code, BUILT_IN_NORMAL,
     515                 :             :                                        /* The builtin without the prefix for
     516                 :             :                                           calling it directly.  */
     517                 :        9808 :                                        d->name + strlen ("__builtin_"),
     518                 :             :                                        attrs);
     519                 :             :           /* add_builtin_function() will set the DECL_ATTRIBUTES, now
     520                 :             :              set the TYPE_ATTRIBUTES.  */
     521                 :        9808 :           decl_attributes (&TREE_TYPE (decl), attrs_type, ATTR_FLAG_BUILT_IN);
     522                 :             : 
     523                 :        9808 :           set_builtin_decl (code, decl, false);
     524                 :             :         }
     525                 :             :     }
     526                 :             : }
     527                 :             : 
     528                 :             : /* Set up all the MMX/SSE builtins, even builtins for instructions that are not
     529                 :             :    in the current target ISA to allow the user to compile particular modules
     530                 :             :    with different target specific options that differ from the command line
     531                 :             :    options.  */
     532                 :             : static void
     533                 :      257672 : ix86_init_mmx_sse_builtins (void)
     534                 :             : {
     535                 :      257672 :   const struct builtin_description * d;
     536                 :      257672 :   enum ix86_builtin_func_type ftype;
     537                 :      257672 :   size_t i;
     538                 :             : 
     539                 :             :   /* Add all special builtins with variable number of operands.  */
     540                 :      257672 :   for (i = 0, d = bdesc_special_args;
     541                 :    86577792 :        i < ARRAY_SIZE (bdesc_special_args);
     542                 :    86320120 :        i++, d++)
     543                 :             :     {
     544                 :    86320120 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_SPECIAL_ARGS_FIRST, i);
     545                 :    86320120 :       if (d->name == 0)
     546                 :      257672 :         continue;
     547                 :             : 
     548                 :    86062448 :       ftype = (enum ix86_builtin_func_type) d->flag;
     549                 :    86062448 :       def_builtin (d->mask, d->mask2, d->name, ftype, d->code);
     550                 :             :     }
     551                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_SPECIAL_ARGS_LAST,
     552                 :             :                  IX86_BUILTIN__BDESC_SPECIAL_ARGS_FIRST,
     553                 :             :                  ARRAY_SIZE (bdesc_special_args) - 1);
     554                 :             : 
     555                 :             :   /* Add all pure builtins with variable number of operands.  */
     556                 :             :   for (i = 0, d = bdesc_pure_args;
     557                 :     2319048 :        i < ARRAY_SIZE (bdesc_pure_args);
     558                 :     2061376 :        i++, d++)
     559                 :             :     {
     560                 :     2061376 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_PURE_ARGS_FIRST, i);
     561                 :     2061376 :       if (d->name == 0)
     562                 :           0 :         continue;
     563                 :             : 
     564                 :     2061376 :       ftype = (enum ix86_builtin_func_type) d->flag;
     565                 :     2061376 :       def_builtin_pure (d->mask, d->mask2, d->name, ftype, d->code);
     566                 :             :     }
     567                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_PURE_ARGS_LAST,
     568                 :             :                  IX86_BUILTIN__BDESC_PURE_ARGS_FIRST,
     569                 :             :                  ARRAY_SIZE (bdesc_pure_args) - 1);
     570                 :             : 
     571                 :             :   /* Add all const builtins with variable number of operands.  */
     572                 :             :   for (i = 0, d = bdesc_args;
     573                 :   595222320 :        i < ARRAY_SIZE (bdesc_args);
     574                 :   594964648 :        i++, d++)
     575                 :             :     {
     576                 :   594964648 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_ARGS_FIRST, i);
     577                 :   594964648 :       if (d->name == 0)
     578                 :     4122752 :         continue;
     579                 :             : 
     580                 :   590841896 :       ftype = (enum ix86_builtin_func_type) d->flag;
     581                 :   590841896 :       def_builtin_const (d->mask, d->mask2, d->name, ftype, d->code);
     582                 :             :     }
     583                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_ARGS_LAST,
     584                 :             :                  IX86_BUILTIN__BDESC_ARGS_FIRST,
     585                 :             :                  ARRAY_SIZE (bdesc_args) - 1);
     586                 :             : 
     587                 :             :   /* Add all builtins with rounding.  */
     588                 :             :   for (i = 0, d = bdesc_round_args;
     589                 :    78074616 :        i < ARRAY_SIZE (bdesc_round_args);
     590                 :    77816944 :        i++, d++)
     591                 :             :     {
     592                 :    77816944 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_ROUND_ARGS_FIRST, i);
     593                 :    77816944 :       if (d->name == 0)
     594                 :           0 :         continue;
     595                 :             : 
     596                 :    77816944 :       ftype = (enum ix86_builtin_func_type) d->flag;
     597                 :    77816944 :       def_builtin_const (d->mask, d->mask2, d->name, ftype, d->code);
     598                 :             :     }
     599                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_ROUND_ARGS_LAST,
     600                 :             :                  IX86_BUILTIN__BDESC_ROUND_ARGS_FIRST,
     601                 :             :                  ARRAY_SIZE (bdesc_round_args) - 1);
     602                 :             : 
     603                 :             :   /* pcmpestr[im] insns.  */
     604                 :             :   for (i = 0, d = bdesc_pcmpestr;
     605                 :     2061376 :        i < ARRAY_SIZE (bdesc_pcmpestr);
     606                 :     1803704 :        i++, d++)
     607                 :             :     {
     608                 :     1803704 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_PCMPESTR_FIRST, i);
     609                 :     1803704 :       if (d->code == IX86_BUILTIN_PCMPESTRM128)
     610                 :             :         ftype = V16QI_FTYPE_V16QI_INT_V16QI_INT_INT;
     611                 :             :       else
     612                 :     1546032 :         ftype = INT_FTYPE_V16QI_INT_V16QI_INT_INT;
     613                 :     1803704 :       def_builtin_const (d->mask, d->mask2, d->name, ftype, d->code);
     614                 :             :     }
     615                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_PCMPESTR_LAST,
     616                 :             :                  IX86_BUILTIN__BDESC_PCMPESTR_FIRST,
     617                 :             :                  ARRAY_SIZE (bdesc_pcmpestr) - 1);
     618                 :             : 
     619                 :             :   /* pcmpistr[im] insns.  */
     620                 :             :   for (i = 0, d = bdesc_pcmpistr;
     621                 :     2061376 :        i < ARRAY_SIZE (bdesc_pcmpistr);
     622                 :     1803704 :        i++, d++)
     623                 :             :     {
     624                 :     1803704 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_PCMPISTR_FIRST, i);
     625                 :     1803704 :       if (d->code == IX86_BUILTIN_PCMPISTRM128)
     626                 :             :         ftype = V16QI_FTYPE_V16QI_V16QI_INT;
     627                 :             :       else
     628                 :     1546032 :         ftype = INT_FTYPE_V16QI_V16QI_INT;
     629                 :     1803704 :       def_builtin_const (d->mask, d->mask2, d->name, ftype, d->code);
     630                 :             :     }
     631                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_PCMPISTR_LAST,
     632                 :             :                  IX86_BUILTIN__BDESC_PCMPISTR_FIRST,
     633                 :             :                  ARRAY_SIZE (bdesc_pcmpistr) - 1);
     634                 :             : 
     635                 :             :   /* comi/ucomi insns.  */
     636                 :     6441800 :   for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
     637                 :             :     {
     638                 :     6184128 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_COMI_FIRST, i);
     639                 :     6184128 :       if (d->mask == OPTION_MASK_ISA_SSE2)
     640                 :             :         ftype = INT_FTYPE_V2DF_V2DF;
     641                 :             :       else
     642                 :     3092064 :         ftype = INT_FTYPE_V4SF_V4SF;
     643                 :     6184128 :       def_builtin_const (d->mask, d->mask2, d->name, ftype, d->code);
     644                 :             :     }
     645                 :      257672 :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_COMI_LAST,
     646                 :             :                  IX86_BUILTIN__BDESC_COMI_FIRST,
     647                 :             :                  ARRAY_SIZE (bdesc_comi) - 1);
     648                 :             : 
     649                 :             :   /* SSE */
     650                 :      257672 :   def_builtin (OPTION_MASK_ISA_SSE, 0,  "__builtin_ia32_ldmxcsr",
     651                 :             :                VOID_FTYPE_UNSIGNED, IX86_BUILTIN_LDMXCSR);
     652                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_SSE, 0, "__builtin_ia32_stmxcsr",
     653                 :             :                     UNSIGNED_FTYPE_VOID, IX86_BUILTIN_STMXCSR);
     654                 :             : 
     655                 :             :   /* SSE or 3DNow!A */
     656                 :      257672 :   def_builtin (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A
     657                 :             :                /* As it uses V4HImode, we have to require -mmmx too.  */
     658                 :             :                | OPTION_MASK_ISA_MMX, 0,
     659                 :             :                "__builtin_ia32_maskmovq", VOID_FTYPE_V8QI_V8QI_PCHAR,
     660                 :             :                IX86_BUILTIN_MASKMOVQ);
     661                 :             : 
     662                 :             :   /* SSE2 */
     663                 :      257672 :   def_builtin (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_maskmovdqu",
     664                 :             :                VOID_FTYPE_V16QI_V16QI_PCHAR, IX86_BUILTIN_MASKMOVDQU);
     665                 :             : 
     666                 :      257672 :   def_builtin (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_clflush",
     667                 :             :                VOID_FTYPE_PCVOID, IX86_BUILTIN_CLFLUSH);
     668                 :      257672 :   x86_mfence = def_builtin (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_mfence",
     669                 :             :                             VOID_FTYPE_VOID, IX86_BUILTIN_MFENCE);
     670                 :             : 
     671                 :             :   /* SSE3.  */
     672                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_MWAIT, "__builtin_ia32_monitor",
     673                 :             :                VOID_FTYPE_PCVOID_UNSIGNED_UNSIGNED, IX86_BUILTIN_MONITOR);
     674                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_MWAIT, "__builtin_ia32_mwait",
     675                 :             :                VOID_FTYPE_UNSIGNED_UNSIGNED, IX86_BUILTIN_MWAIT);
     676                 :             : 
     677                 :             :   /* AES */
     678                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2
     679                 :             :                      | OPTION_MASK_ISA_AVX512VL,
     680                 :             :                      OPTION_MASK_ISA2_VAES,
     681                 :             :                      "__builtin_ia32_aesenc128",
     682                 :             :                      V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESENC128);
     683                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2
     684                 :             :                      | OPTION_MASK_ISA_AVX512VL,
     685                 :             :                      OPTION_MASK_ISA2_VAES,
     686                 :             :                      "__builtin_ia32_aesenclast128",
     687                 :             :                      V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESENCLAST128);
     688                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2
     689                 :             :                      | OPTION_MASK_ISA_AVX512VL,
     690                 :             :                      OPTION_MASK_ISA2_VAES,
     691                 :             :                      "__builtin_ia32_aesdec128",
     692                 :             :                      V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESDEC128);
     693                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2
     694                 :             :                      | OPTION_MASK_ISA_AVX512VL,
     695                 :             :                      OPTION_MASK_ISA2_VAES,
     696                 :             :                      "__builtin_ia32_aesdeclast128",
     697                 :             :                      V2DI_FTYPE_V2DI_V2DI, IX86_BUILTIN_AESDECLAST128);
     698                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2, 0,
     699                 :             :                      "__builtin_ia32_aesimc128",
     700                 :             :                      V2DI_FTYPE_V2DI, IX86_BUILTIN_AESIMC128);
     701                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_AES | OPTION_MASK_ISA_SSE2, 0,
     702                 :             :                      "__builtin_ia32_aeskeygenassist128",
     703                 :             :                      V2DI_FTYPE_V2DI_INT, IX86_BUILTIN_AESKEYGENASSIST128);
     704                 :             : 
     705                 :             :   /* PCLMUL */
     706                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_PCLMUL | OPTION_MASK_ISA_SSE2, 0,
     707                 :             :                      "__builtin_ia32_pclmulqdq128",
     708                 :             :                      V2DI_FTYPE_V2DI_V2DI_INT, IX86_BUILTIN_PCLMULQDQ128);
     709                 :             : 
     710                 :             :   /* RDRND */
     711                 :      257672 :   def_builtin (OPTION_MASK_ISA_RDRND, 0, "__builtin_ia32_rdrand16_step",
     712                 :             :                INT_FTYPE_PUSHORT, IX86_BUILTIN_RDRAND16_STEP);
     713                 :      257672 :   def_builtin (OPTION_MASK_ISA_RDRND, 0,  "__builtin_ia32_rdrand32_step",
     714                 :             :                INT_FTYPE_PUNSIGNED, IX86_BUILTIN_RDRAND32_STEP);
     715                 :      257672 :   def_builtin (OPTION_MASK_ISA_RDRND | OPTION_MASK_ISA_64BIT, 0,
     716                 :             :                "__builtin_ia32_rdrand64_step", INT_FTYPE_PULONGLONG,
     717                 :             :                IX86_BUILTIN_RDRAND64_STEP);
     718                 :             : 
     719                 :             :   /* AVX2 */
     720                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv2df",
     721                 :             :                     V2DF_FTYPE_V2DF_PCDOUBLE_V4SI_V2DF_INT,
     722                 :             :                     IX86_BUILTIN_GATHERSIV2DF);
     723                 :             : 
     724                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv4df",
     725                 :             :                     V4DF_FTYPE_V4DF_PCDOUBLE_V4SI_V4DF_INT,
     726                 :             :                     IX86_BUILTIN_GATHERSIV4DF);
     727                 :             : 
     728                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv2df",
     729                 :             :                     V2DF_FTYPE_V2DF_PCDOUBLE_V2DI_V2DF_INT,
     730                 :             :                     IX86_BUILTIN_GATHERDIV2DF);
     731                 :             : 
     732                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv4df",
     733                 :             :                     V4DF_FTYPE_V4DF_PCDOUBLE_V4DI_V4DF_INT,
     734                 :             :                     IX86_BUILTIN_GATHERDIV4DF);
     735                 :             : 
     736                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv4sf",
     737                 :             :                     V4SF_FTYPE_V4SF_PCFLOAT_V4SI_V4SF_INT,
     738                 :             :                     IX86_BUILTIN_GATHERSIV4SF);
     739                 :             : 
     740                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv8sf",
     741                 :             :                     V8SF_FTYPE_V8SF_PCFLOAT_V8SI_V8SF_INT,
     742                 :             :                     IX86_BUILTIN_GATHERSIV8SF);
     743                 :             : 
     744                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv4sf",
     745                 :             :                     V4SF_FTYPE_V4SF_PCFLOAT_V2DI_V4SF_INT,
     746                 :             :                     IX86_BUILTIN_GATHERDIV4SF);
     747                 :             : 
     748                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv4sf256",
     749                 :             :                     V4SF_FTYPE_V4SF_PCFLOAT_V4DI_V4SF_INT,
     750                 :             :                     IX86_BUILTIN_GATHERDIV8SF);
     751                 :             : 
     752                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv2di",
     753                 :             :                     V2DI_FTYPE_V2DI_PCINT64_V4SI_V2DI_INT,
     754                 :             :                     IX86_BUILTIN_GATHERSIV2DI);
     755                 :             : 
     756                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv4di",
     757                 :             :                     V4DI_FTYPE_V4DI_PCINT64_V4SI_V4DI_INT,
     758                 :             :                     IX86_BUILTIN_GATHERSIV4DI);
     759                 :             : 
     760                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv2di",
     761                 :             :                     V2DI_FTYPE_V2DI_PCINT64_V2DI_V2DI_INT,
     762                 :             :                     IX86_BUILTIN_GATHERDIV2DI);
     763                 :             : 
     764                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv4di",
     765                 :             :                     V4DI_FTYPE_V4DI_PCINT64_V4DI_V4DI_INT,
     766                 :             :                     IX86_BUILTIN_GATHERDIV4DI);
     767                 :             : 
     768                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv4si",
     769                 :             :                     V4SI_FTYPE_V4SI_PCINT_V4SI_V4SI_INT,
     770                 :             :                     IX86_BUILTIN_GATHERSIV4SI);
     771                 :             : 
     772                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gathersiv8si",
     773                 :             :                     V8SI_FTYPE_V8SI_PCINT_V8SI_V8SI_INT,
     774                 :             :                     IX86_BUILTIN_GATHERSIV8SI);
     775                 :             : 
     776                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv4si",
     777                 :             :                     V4SI_FTYPE_V4SI_PCINT_V2DI_V4SI_INT,
     778                 :             :                     IX86_BUILTIN_GATHERDIV4SI);
     779                 :             : 
     780                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatherdiv4si256",
     781                 :             :                     V4SI_FTYPE_V4SI_PCINT_V4DI_V4SI_INT,
     782                 :             :                     IX86_BUILTIN_GATHERDIV8SI);
     783                 :             : 
     784                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatheraltsiv4df ",
     785                 :             :                     V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_V4DF_INT,
     786                 :             :                     IX86_BUILTIN_GATHERALTSIV4DF);
     787                 :             : 
     788                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatheraltdiv8sf ",
     789                 :             :                     V8SF_FTYPE_V8SF_PCFLOAT_V4DI_V8SF_INT,
     790                 :             :                     IX86_BUILTIN_GATHERALTDIV8SF);
     791                 :             : 
     792                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatheraltsiv4di ",
     793                 :             :                     V4DI_FTYPE_V4DI_PCINT64_V8SI_V4DI_INT,
     794                 :             :                     IX86_BUILTIN_GATHERALTSIV4DI);
     795                 :             : 
     796                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX2, 0, "__builtin_ia32_gatheraltdiv8si ",
     797                 :             :                     V8SI_FTYPE_V8SI_PCINT_V4DI_V8SI_INT,
     798                 :             :                     IX86_BUILTIN_GATHERALTDIV8SI);
     799                 :             : 
     800                 :             :   /* AVX512F */
     801                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     802                 :             :                     "__builtin_ia32_gathersiv16sf",
     803                 :             :                     V16SF_FTYPE_V16SF_PCVOID_V16SI_HI_INT,
     804                 :             :                     IX86_BUILTIN_GATHER3SIV16SF);
     805                 :             : 
     806                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     807                 :             :                     "__builtin_ia32_gathersiv8df",
     808                 :             :                     V8DF_FTYPE_V8DF_PCVOID_V8SI_QI_INT,
     809                 :             :                     IX86_BUILTIN_GATHER3SIV8DF);
     810                 :             : 
     811                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     812                 :             :                     "__builtin_ia32_gatherdiv16sf",
     813                 :             :                     V8SF_FTYPE_V8SF_PCVOID_V8DI_QI_INT,
     814                 :             :                     IX86_BUILTIN_GATHER3DIV16SF);
     815                 :             : 
     816                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     817                 :             :                     "__builtin_ia32_gatherdiv8df",
     818                 :             :                     V8DF_FTYPE_V8DF_PCVOID_V8DI_QI_INT,
     819                 :             :                     IX86_BUILTIN_GATHER3DIV8DF);
     820                 :             : 
     821                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     822                 :             :                     "__builtin_ia32_gathersiv16si",
     823                 :             :                     V16SI_FTYPE_V16SI_PCVOID_V16SI_HI_INT,
     824                 :             :                     IX86_BUILTIN_GATHER3SIV16SI);
     825                 :             : 
     826                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     827                 :             :                     "__builtin_ia32_gathersiv8di",
     828                 :             :                     V8DI_FTYPE_V8DI_PCVOID_V8SI_QI_INT,
     829                 :             :                     IX86_BUILTIN_GATHER3SIV8DI);
     830                 :             : 
     831                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     832                 :             :                     "__builtin_ia32_gatherdiv16si",
     833                 :             :                     V8SI_FTYPE_V8SI_PCVOID_V8DI_QI_INT,
     834                 :             :                     IX86_BUILTIN_GATHER3DIV16SI);
     835                 :             : 
     836                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     837                 :             :                     "__builtin_ia32_gatherdiv8di",
     838                 :             :                     V8DI_FTYPE_V8DI_PCVOID_V8DI_QI_INT,
     839                 :             :                     IX86_BUILTIN_GATHER3DIV8DI);
     840                 :             : 
     841                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     842                 :             :                     "__builtin_ia32_gather3altsiv8df ",
     843                 :             :                     V8DF_FTYPE_V8DF_PCDOUBLE_V16SI_QI_INT,
     844                 :             :                     IX86_BUILTIN_GATHER3ALTSIV8DF);
     845                 :             : 
     846                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     847                 :             :                     "__builtin_ia32_gather3altdiv16sf ",
     848                 :             :                     V16SF_FTYPE_V16SF_PCFLOAT_V8DI_HI_INT,
     849                 :             :                     IX86_BUILTIN_GATHER3ALTDIV16SF);
     850                 :             : 
     851                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     852                 :             :                     "__builtin_ia32_gather3altsiv8di ",
     853                 :             :                     V8DI_FTYPE_V8DI_PCINT64_V16SI_QI_INT,
     854                 :             :                     IX86_BUILTIN_GATHER3ALTSIV8DI);
     855                 :             : 
     856                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     857                 :             :                     "__builtin_ia32_gather3altdiv16si ",
     858                 :             :                     V16SI_FTYPE_V16SI_PCINT_V8DI_HI_INT,
     859                 :             :                     IX86_BUILTIN_GATHER3ALTDIV16SI);
     860                 :             : 
     861                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     862                 :             :                "__builtin_ia32_scattersiv16sf",
     863                 :             :                VOID_FTYPE_PVOID_HI_V16SI_V16SF_INT,
     864                 :             :                IX86_BUILTIN_SCATTERSIV16SF);
     865                 :             : 
     866                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     867                 :             :                "__builtin_ia32_scattersiv8df",
     868                 :             :                VOID_FTYPE_PVOID_QI_V8SI_V8DF_INT,
     869                 :             :                IX86_BUILTIN_SCATTERSIV8DF);
     870                 :             : 
     871                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     872                 :             :                "__builtin_ia32_scatterdiv16sf",
     873                 :             :                VOID_FTYPE_PVOID_QI_V8DI_V8SF_INT,
     874                 :             :                IX86_BUILTIN_SCATTERDIV16SF);
     875                 :             : 
     876                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     877                 :             :                "__builtin_ia32_scatterdiv8df",
     878                 :             :                VOID_FTYPE_PVOID_QI_V8DI_V8DF_INT,
     879                 :             :                IX86_BUILTIN_SCATTERDIV8DF);
     880                 :             : 
     881                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     882                 :             :                "__builtin_ia32_scattersiv16si",
     883                 :             :                VOID_FTYPE_PVOID_HI_V16SI_V16SI_INT,
     884                 :             :                IX86_BUILTIN_SCATTERSIV16SI);
     885                 :             : 
     886                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     887                 :             :                "__builtin_ia32_scattersiv8di",
     888                 :             :                VOID_FTYPE_PVOID_QI_V8SI_V8DI_INT,
     889                 :             :                IX86_BUILTIN_SCATTERSIV8DI);
     890                 :             : 
     891                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     892                 :             :                "__builtin_ia32_scatterdiv16si",
     893                 :             :                VOID_FTYPE_PVOID_QI_V8DI_V8SI_INT,
     894                 :             :                IX86_BUILTIN_SCATTERDIV16SI);
     895                 :             : 
     896                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
     897                 :             :                "__builtin_ia32_scatterdiv8di",
     898                 :             :                VOID_FTYPE_PVOID_QI_V8DI_V8DI_INT,
     899                 :             :                IX86_BUILTIN_SCATTERDIV8DI);
     900                 :             : 
     901                 :             :   /* AVX512VL */
     902                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv2df",
     903                 :             :                     V2DF_FTYPE_V2DF_PCVOID_V4SI_QI_INT,
     904                 :             :                     IX86_BUILTIN_GATHER3SIV2DF);
     905                 :             : 
     906                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv4df",
     907                 :             :                     V4DF_FTYPE_V4DF_PCVOID_V4SI_QI_INT,
     908                 :             :                     IX86_BUILTIN_GATHER3SIV4DF);
     909                 :             : 
     910                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div2df",
     911                 :             :                     V2DF_FTYPE_V2DF_PCVOID_V2DI_QI_INT,
     912                 :             :                     IX86_BUILTIN_GATHER3DIV2DF);
     913                 :             : 
     914                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div4df",
     915                 :             :                     V4DF_FTYPE_V4DF_PCVOID_V4DI_QI_INT,
     916                 :             :                     IX86_BUILTIN_GATHER3DIV4DF);
     917                 :             : 
     918                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv4sf",
     919                 :             :                     V4SF_FTYPE_V4SF_PCVOID_V4SI_QI_INT,
     920                 :             :                     IX86_BUILTIN_GATHER3SIV4SF);
     921                 :             : 
     922                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv8sf",
     923                 :             :                     V8SF_FTYPE_V8SF_PCVOID_V8SI_QI_INT,
     924                 :             :                     IX86_BUILTIN_GATHER3SIV8SF);
     925                 :             : 
     926                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div4sf",
     927                 :             :                     V4SF_FTYPE_V4SF_PCVOID_V2DI_QI_INT,
     928                 :             :                     IX86_BUILTIN_GATHER3DIV4SF);
     929                 :             : 
     930                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div8sf",
     931                 :             :                     V4SF_FTYPE_V4SF_PCVOID_V4DI_QI_INT,
     932                 :             :                     IX86_BUILTIN_GATHER3DIV8SF);
     933                 :             : 
     934                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv2di",
     935                 :             :                     V2DI_FTYPE_V2DI_PCVOID_V4SI_QI_INT,
     936                 :             :                     IX86_BUILTIN_GATHER3SIV2DI);
     937                 :             : 
     938                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv4di",
     939                 :             :                     V4DI_FTYPE_V4DI_PCVOID_V4SI_QI_INT,
     940                 :             :                     IX86_BUILTIN_GATHER3SIV4DI);
     941                 :             : 
     942                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div2di",
     943                 :             :                     V2DI_FTYPE_V2DI_PCVOID_V2DI_QI_INT,
     944                 :             :                     IX86_BUILTIN_GATHER3DIV2DI);
     945                 :             : 
     946                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div4di",
     947                 :             :                     V4DI_FTYPE_V4DI_PCVOID_V4DI_QI_INT,
     948                 :             :                     IX86_BUILTIN_GATHER3DIV4DI);
     949                 :             : 
     950                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv4si",
     951                 :             :                     V4SI_FTYPE_V4SI_PCVOID_V4SI_QI_INT,
     952                 :             :                     IX86_BUILTIN_GATHER3SIV4SI);
     953                 :             : 
     954                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3siv8si",
     955                 :             :                     V8SI_FTYPE_V8SI_PCVOID_V8SI_QI_INT,
     956                 :             :                     IX86_BUILTIN_GATHER3SIV8SI);
     957                 :             : 
     958                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div4si",
     959                 :             :                     V4SI_FTYPE_V4SI_PCVOID_V2DI_QI_INT,
     960                 :             :                     IX86_BUILTIN_GATHER3DIV4SI);
     961                 :             : 
     962                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3div8si",
     963                 :             :                     V4SI_FTYPE_V4SI_PCVOID_V4DI_QI_INT,
     964                 :             :                     IX86_BUILTIN_GATHER3DIV8SI);
     965                 :             : 
     966                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3altsiv4df ",
     967                 :             :                     V4DF_FTYPE_V4DF_PCDOUBLE_V8SI_QI_INT,
     968                 :             :                     IX86_BUILTIN_GATHER3ALTSIV4DF);
     969                 :             : 
     970                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3altdiv8sf ",
     971                 :             :                     V8SF_FTYPE_V8SF_PCFLOAT_V4DI_QI_INT,
     972                 :             :                     IX86_BUILTIN_GATHER3ALTDIV8SF);
     973                 :             : 
     974                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3altsiv4di ",
     975                 :             :                     V4DI_FTYPE_V4DI_PCINT64_V8SI_QI_INT,
     976                 :             :                     IX86_BUILTIN_GATHER3ALTSIV4DI);
     977                 :             : 
     978                 :      257672 :   def_builtin_pure (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_gather3altdiv8si ",
     979                 :             :                     V8SI_FTYPE_V8SI_PCINT_V4DI_QI_INT,
     980                 :             :                     IX86_BUILTIN_GATHER3ALTDIV8SI);
     981                 :             : 
     982                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv8sf",
     983                 :             :                VOID_FTYPE_PVOID_QI_V8SI_V8SF_INT,
     984                 :             :                IX86_BUILTIN_SCATTERSIV8SF);
     985                 :             : 
     986                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv4sf",
     987                 :             :                VOID_FTYPE_PVOID_QI_V4SI_V4SF_INT,
     988                 :             :                IX86_BUILTIN_SCATTERSIV4SF);
     989                 :             : 
     990                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv4df",
     991                 :             :                VOID_FTYPE_PVOID_QI_V4SI_V4DF_INT,
     992                 :             :                IX86_BUILTIN_SCATTERSIV4DF);
     993                 :             : 
     994                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv2df",
     995                 :             :                VOID_FTYPE_PVOID_QI_V4SI_V2DF_INT,
     996                 :             :                IX86_BUILTIN_SCATTERSIV2DF);
     997                 :             : 
     998                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv8sf",
     999                 :             :                VOID_FTYPE_PVOID_QI_V4DI_V4SF_INT,
    1000                 :             :                IX86_BUILTIN_SCATTERDIV8SF);
    1001                 :             : 
    1002                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv4sf",
    1003                 :             :                VOID_FTYPE_PVOID_QI_V2DI_V4SF_INT,
    1004                 :             :                IX86_BUILTIN_SCATTERDIV4SF);
    1005                 :             : 
    1006                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv4df",
    1007                 :             :                VOID_FTYPE_PVOID_QI_V4DI_V4DF_INT,
    1008                 :             :                IX86_BUILTIN_SCATTERDIV4DF);
    1009                 :             : 
    1010                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv2df",
    1011                 :             :                VOID_FTYPE_PVOID_QI_V2DI_V2DF_INT,
    1012                 :             :                IX86_BUILTIN_SCATTERDIV2DF);
    1013                 :             : 
    1014                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv8si",
    1015                 :             :                VOID_FTYPE_PVOID_QI_V8SI_V8SI_INT,
    1016                 :             :                IX86_BUILTIN_SCATTERSIV8SI);
    1017                 :             : 
    1018                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv4si",
    1019                 :             :                VOID_FTYPE_PVOID_QI_V4SI_V4SI_INT,
    1020                 :             :                IX86_BUILTIN_SCATTERSIV4SI);
    1021                 :             : 
    1022                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv4di",
    1023                 :             :                VOID_FTYPE_PVOID_QI_V4SI_V4DI_INT,
    1024                 :             :                IX86_BUILTIN_SCATTERSIV4DI);
    1025                 :             : 
    1026                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scattersiv2di",
    1027                 :             :                VOID_FTYPE_PVOID_QI_V4SI_V2DI_INT,
    1028                 :             :                IX86_BUILTIN_SCATTERSIV2DI);
    1029                 :             : 
    1030                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv8si",
    1031                 :             :                VOID_FTYPE_PVOID_QI_V4DI_V4SI_INT,
    1032                 :             :                IX86_BUILTIN_SCATTERDIV8SI);
    1033                 :             : 
    1034                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv4si",
    1035                 :             :                VOID_FTYPE_PVOID_QI_V2DI_V4SI_INT,
    1036                 :             :                IX86_BUILTIN_SCATTERDIV4SI);
    1037                 :             : 
    1038                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv4di",
    1039                 :             :                VOID_FTYPE_PVOID_QI_V4DI_V4DI_INT,
    1040                 :             :                IX86_BUILTIN_SCATTERDIV4DI);
    1041                 :             : 
    1042                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatterdiv2di",
    1043                 :             :                VOID_FTYPE_PVOID_QI_V2DI_V2DI_INT,
    1044                 :             :                IX86_BUILTIN_SCATTERDIV2DI);
    1045                 :             : 
    1046                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
    1047                 :             :                "__builtin_ia32_scatteraltsiv8df ",
    1048                 :             :                VOID_FTYPE_PDOUBLE_QI_V16SI_V8DF_INT,
    1049                 :             :                IX86_BUILTIN_SCATTERALTSIV8DF);
    1050                 :             : 
    1051                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
    1052                 :             :                "__builtin_ia32_scatteraltdiv16sf ",
    1053                 :             :                VOID_FTYPE_PFLOAT_HI_V8DI_V16SF_INT,
    1054                 :             :                IX86_BUILTIN_SCATTERALTDIV16SF);
    1055                 :             : 
    1056                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
    1057                 :             :                "__builtin_ia32_scatteraltsiv8di ",
    1058                 :             :                VOID_FTYPE_PLONGLONG_QI_V16SI_V8DI_INT,
    1059                 :             :                IX86_BUILTIN_SCATTERALTSIV8DI);
    1060                 :             : 
    1061                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512F, OPTION_MASK_ISA2_EVEX512,
    1062                 :             :                "__builtin_ia32_scatteraltdiv16si ",
    1063                 :             :                VOID_FTYPE_PINT_HI_V8DI_V16SI_INT,
    1064                 :             :                IX86_BUILTIN_SCATTERALTDIV16SI);
    1065                 :             : 
    1066                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltsiv4df ",
    1067                 :             :                VOID_FTYPE_PDOUBLE_QI_V8SI_V4DF_INT,
    1068                 :             :                IX86_BUILTIN_SCATTERALTSIV4DF);
    1069                 :             : 
    1070                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltdiv8sf ",
    1071                 :             :                VOID_FTYPE_PFLOAT_QI_V4DI_V8SF_INT,
    1072                 :             :                IX86_BUILTIN_SCATTERALTDIV8SF);
    1073                 :             : 
    1074                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltsiv4di ",
    1075                 :             :                VOID_FTYPE_PLONGLONG_QI_V8SI_V4DI_INT,
    1076                 :             :                IX86_BUILTIN_SCATTERALTSIV4DI);
    1077                 :             : 
    1078                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltdiv8si ",
    1079                 :             :                VOID_FTYPE_PINT_QI_V4DI_V8SI_INT,
    1080                 :             :                IX86_BUILTIN_SCATTERALTDIV8SI);
    1081                 :             : 
    1082                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltsiv2df ",
    1083                 :             :                VOID_FTYPE_PDOUBLE_QI_V4SI_V2DF_INT,
    1084                 :             :                IX86_BUILTIN_SCATTERALTSIV2DF);
    1085                 :             : 
    1086                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltdiv4sf ",
    1087                 :             :                VOID_FTYPE_PFLOAT_QI_V2DI_V4SF_INT,
    1088                 :             :                IX86_BUILTIN_SCATTERALTDIV4SF);
    1089                 :             : 
    1090                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltsiv2di ",
    1091                 :             :                VOID_FTYPE_PLONGLONG_QI_V4SI_V2DI_INT,
    1092                 :             :                IX86_BUILTIN_SCATTERALTSIV2DI);
    1093                 :             : 
    1094                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512VL, 0, "__builtin_ia32_scatteraltdiv4si ",
    1095                 :             :                VOID_FTYPE_PINT_QI_V2DI_V4SI_INT,
    1096                 :             :                IX86_BUILTIN_SCATTERALTDIV4SI);
    1097                 :             : 
    1098                 :             :   /* AVX512PF */
    1099                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_gatherpfdpd",
    1100                 :             :                VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
    1101                 :             :                IX86_BUILTIN_GATHERPFDPD);
    1102                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_gatherpfdps",
    1103                 :             :                VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
    1104                 :             :                IX86_BUILTIN_GATHERPFDPS);
    1105                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_gatherpfqpd",
    1106                 :             :                VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
    1107                 :             :                IX86_BUILTIN_GATHERPFQPD);
    1108                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_gatherpfqps",
    1109                 :             :                VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
    1110                 :             :                IX86_BUILTIN_GATHERPFQPS);
    1111                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_scatterpfdpd",
    1112                 :             :                VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
    1113                 :             :                IX86_BUILTIN_SCATTERPFDPD);
    1114                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_scatterpfdps",
    1115                 :             :                VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
    1116                 :             :                IX86_BUILTIN_SCATTERPFDPS);
    1117                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_scatterpfqpd",
    1118                 :             :                VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
    1119                 :             :                IX86_BUILTIN_SCATTERPFQPD);
    1120                 :      257672 :   def_builtin (OPTION_MASK_ISA_AVX512PF, 0, "__builtin_ia32_scatterpfqps",
    1121                 :             :                VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
    1122                 :             :                IX86_BUILTIN_SCATTERPFQPS);
    1123                 :             : 
    1124                 :             :   /* SHA */
    1125                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha1msg1",
    1126                 :             :                      V4SI_FTYPE_V4SI_V4SI, IX86_BUILTIN_SHA1MSG1);
    1127                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha1msg2",
    1128                 :             :                      V4SI_FTYPE_V4SI_V4SI, IX86_BUILTIN_SHA1MSG2);
    1129                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha1nexte",
    1130                 :             :                      V4SI_FTYPE_V4SI_V4SI, IX86_BUILTIN_SHA1NEXTE);
    1131                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha1rnds4",
    1132                 :             :                      V4SI_FTYPE_V4SI_V4SI_INT, IX86_BUILTIN_SHA1RNDS4);
    1133                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha256msg1",
    1134                 :             :                      V4SI_FTYPE_V4SI_V4SI, IX86_BUILTIN_SHA256MSG1);
    1135                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha256msg2",
    1136                 :             :                      V4SI_FTYPE_V4SI_V4SI, IX86_BUILTIN_SHA256MSG2);
    1137                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SHA, 0, "__builtin_ia32_sha256rnds2",
    1138                 :             :                      V4SI_FTYPE_V4SI_V4SI_V4SI, IX86_BUILTIN_SHA256RNDS2);
    1139                 :             : 
    1140                 :             :   /* RTM.  */
    1141                 :      257672 :   def_builtin (OPTION_MASK_ISA_RTM, 0, "__builtin_ia32_xabort",
    1142                 :             :                VOID_FTYPE_UNSIGNED, IX86_BUILTIN_XABORT);
    1143                 :             : 
    1144                 :             :   /* MMX access to the vec_init patterns.  */
    1145                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_MMX, 0,
    1146                 :             :                      "__builtin_ia32_vec_init_v2si",
    1147                 :             :                      V2SI_FTYPE_INT_INT, IX86_BUILTIN_VEC_INIT_V2SI);
    1148                 :             : 
    1149                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_MMX, 0,
    1150                 :             :                      "__builtin_ia32_vec_init_v4hi",
    1151                 :             :                      V4HI_FTYPE_HI_HI_HI_HI,
    1152                 :             :                      IX86_BUILTIN_VEC_INIT_V4HI);
    1153                 :             : 
    1154                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_MMX, 0,
    1155                 :             :                      "__builtin_ia32_vec_init_v8qi",
    1156                 :             :                      V8QI_FTYPE_QI_QI_QI_QI_QI_QI_QI_QI,
    1157                 :             :                      IX86_BUILTIN_VEC_INIT_V8QI);
    1158                 :             : 
    1159                 :             :   /* Access to the vec_extract patterns.  */
    1160                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_vec_ext_v2df",
    1161                 :             :                      DOUBLE_FTYPE_V2DF_INT, IX86_BUILTIN_VEC_EXT_V2DF);
    1162                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_vec_ext_v2di",
    1163                 :             :                      DI_FTYPE_V2DI_INT, IX86_BUILTIN_VEC_EXT_V2DI);
    1164                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE, 0, "__builtin_ia32_vec_ext_v4sf",
    1165                 :             :                      FLOAT_FTYPE_V4SF_INT, IX86_BUILTIN_VEC_EXT_V4SF);
    1166                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_vec_ext_v4si",
    1167                 :             :                      SI_FTYPE_V4SI_INT, IX86_BUILTIN_VEC_EXT_V4SI);
    1168                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_vec_ext_v8hi",
    1169                 :             :                      HI_FTYPE_V8HI_INT, IX86_BUILTIN_VEC_EXT_V8HI);
    1170                 :             : 
    1171                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A
    1172                 :             :                      /* As it uses V4HImode, we have to require -mmmx too.  */
    1173                 :             :                      | OPTION_MASK_ISA_MMX, 0,
    1174                 :             :                      "__builtin_ia32_vec_ext_v4hi",
    1175                 :             :                      HI_FTYPE_V4HI_INT, IX86_BUILTIN_VEC_EXT_V4HI);
    1176                 :             : 
    1177                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_MMX, 0,
    1178                 :             :                      "__builtin_ia32_vec_ext_v2si",
    1179                 :             :                      SI_FTYPE_V2SI_INT, IX86_BUILTIN_VEC_EXT_V2SI);
    1180                 :             : 
    1181                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_vec_ext_v16qi",
    1182                 :             :                      QI_FTYPE_V16QI_INT, IX86_BUILTIN_VEC_EXT_V16QI);
    1183                 :             : 
    1184                 :             :   /* Access to the vec_set patterns.  */
    1185                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE4_1 | OPTION_MASK_ISA_64BIT, 0,
    1186                 :             :                      "__builtin_ia32_vec_set_v2di",
    1187                 :             :                      V2DI_FTYPE_V2DI_DI_INT, IX86_BUILTIN_VEC_SET_V2DI);
    1188                 :             : 
    1189                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE4_1, 0, "__builtin_ia32_vec_set_v4sf",
    1190                 :             :                      V4SF_FTYPE_V4SF_FLOAT_INT, IX86_BUILTIN_VEC_SET_V4SF);
    1191                 :             : 
    1192                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE4_1, 0, "__builtin_ia32_vec_set_v4si",
    1193                 :             :                      V4SI_FTYPE_V4SI_SI_INT, IX86_BUILTIN_VEC_SET_V4SI);
    1194                 :             : 
    1195                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE2, 0, "__builtin_ia32_vec_set_v8hi",
    1196                 :             :                      V8HI_FTYPE_V8HI_HI_INT, IX86_BUILTIN_VEC_SET_V8HI);
    1197                 :             : 
    1198                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A
    1199                 :             :                      /* As it uses V4HImode, we have to require -mmmx too.  */
    1200                 :             :                      | OPTION_MASK_ISA_MMX, 0,
    1201                 :             :                      "__builtin_ia32_vec_set_v4hi",
    1202                 :             :                      V4HI_FTYPE_V4HI_HI_INT, IX86_BUILTIN_VEC_SET_V4HI);
    1203                 :             : 
    1204                 :      257672 :   def_builtin_const (OPTION_MASK_ISA_SSE4_1, 0, "__builtin_ia32_vec_set_v16qi",
    1205                 :             :                      V16QI_FTYPE_V16QI_QI_INT, IX86_BUILTIN_VEC_SET_V16QI);
    1206                 :             : 
    1207                 :             :   /* RDSEED */
    1208                 :      257672 :   def_builtin (OPTION_MASK_ISA_RDSEED, 0, "__builtin_ia32_rdseed_hi_step",
    1209                 :             :                INT_FTYPE_PUSHORT, IX86_BUILTIN_RDSEED16_STEP);
    1210                 :      257672 :   def_builtin (OPTION_MASK_ISA_RDSEED, 0, "__builtin_ia32_rdseed_si_step",
    1211                 :             :                INT_FTYPE_PUNSIGNED, IX86_BUILTIN_RDSEED32_STEP);
    1212                 :      257672 :   def_builtin (OPTION_MASK_ISA_RDSEED | OPTION_MASK_ISA_64BIT, 0,
    1213                 :             :                "__builtin_ia32_rdseed_di_step",
    1214                 :             :                INT_FTYPE_PULONGLONG, IX86_BUILTIN_RDSEED64_STEP);
    1215                 :             : 
    1216                 :             :   /* ADCX */
    1217                 :      257672 :   def_builtin (0, 0, "__builtin_ia32_addcarryx_u32",
    1218                 :             :                UCHAR_FTYPE_UCHAR_UINT_UINT_PUNSIGNED, IX86_BUILTIN_ADDCARRYX32);
    1219                 :      257672 :   def_builtin (OPTION_MASK_ISA_64BIT, 0,
    1220                 :             :                "__builtin_ia32_addcarryx_u64",
    1221                 :             :                UCHAR_FTYPE_UCHAR_ULONGLONG_ULONGLONG_PULONGLONG,
    1222                 :             :                IX86_BUILTIN_ADDCARRYX64);
    1223                 :             : 
    1224                 :             :   /* SBB */
    1225                 :      257672 :   def_builtin (0, 0, "__builtin_ia32_sbb_u32",
    1226                 :             :                UCHAR_FTYPE_UCHAR_UINT_UINT_PUNSIGNED, IX86_BUILTIN_SBB32);
    1227                 :      257672 :   def_builtin (OPTION_MASK_ISA_64BIT, 0,
    1228                 :             :                "__builtin_ia32_sbb_u64",
    1229                 :             :                UCHAR_FTYPE_UCHAR_ULONGLONG_ULONGLONG_PULONGLONG,
    1230                 :             :                IX86_BUILTIN_SBB64);
    1231                 :             : 
    1232                 :             :   /* Read/write FLAGS.  */
    1233                 :      257672 :   if (TARGET_64BIT)
    1234                 :             :     {
    1235                 :      252175 :       def_builtin (OPTION_MASK_ISA_64BIT, 0, "__builtin_ia32_readeflags_u64",
    1236                 :             :                    UINT64_FTYPE_VOID, IX86_BUILTIN_READ_FLAGS);
    1237                 :      252175 :       def_builtin (OPTION_MASK_ISA_64BIT, 0, "__builtin_ia32_writeeflags_u64",
    1238                 :             :                    VOID_FTYPE_UINT64, IX86_BUILTIN_WRITE_FLAGS);
    1239                 :             :     }
    1240                 :             :   else
    1241                 :             :     {
    1242                 :        5497 :       def_builtin (0, 0, "__builtin_ia32_readeflags_u32",
    1243                 :             :                    UNSIGNED_FTYPE_VOID, IX86_BUILTIN_READ_FLAGS);
    1244                 :        5497 :       def_builtin (0, 0, "__builtin_ia32_writeeflags_u32",
    1245                 :             :                    VOID_FTYPE_UNSIGNED, IX86_BUILTIN_WRITE_FLAGS);
    1246                 :             :     }
    1247                 :             : 
    1248                 :             :   /* CLFLUSHOPT.  */
    1249                 :      257672 :   def_builtin (OPTION_MASK_ISA_CLFLUSHOPT, 0, "__builtin_ia32_clflushopt",
    1250                 :             :                VOID_FTYPE_PCVOID, IX86_BUILTIN_CLFLUSHOPT);
    1251                 :             : 
    1252                 :             :   /* CLWB.  */
    1253                 :      257672 :   def_builtin (OPTION_MASK_ISA_CLWB, 0, "__builtin_ia32_clwb",
    1254                 :             :                VOID_FTYPE_PCVOID, IX86_BUILTIN_CLWB);
    1255                 :             : 
    1256                 :             :   /* MONITORX and MWAITX.  */
    1257                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_MWAITX, "__builtin_ia32_monitorx",
    1258                 :             :                 VOID_FTYPE_PCVOID_UNSIGNED_UNSIGNED, IX86_BUILTIN_MONITORX);
    1259                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_MWAITX, "__builtin_ia32_mwaitx",
    1260                 :             :                 VOID_FTYPE_UNSIGNED_UNSIGNED_UNSIGNED, IX86_BUILTIN_MWAITX);
    1261                 :             : 
    1262                 :             :   /* CLZERO.  */
    1263                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_CLZERO, "__builtin_ia32_clzero",
    1264                 :             :                 VOID_FTYPE_PCVOID, IX86_BUILTIN_CLZERO);
    1265                 :             : 
    1266                 :             :   /* WAITPKG.  */
    1267                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_WAITPKG, "__builtin_ia32_umonitor",
    1268                 :             :                VOID_FTYPE_PVOID, IX86_BUILTIN_UMONITOR);
    1269                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_WAITPKG, "__builtin_ia32_umwait",
    1270                 :             :                UINT8_FTYPE_UNSIGNED_UINT64, IX86_BUILTIN_UMWAIT);
    1271                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_WAITPKG, "__builtin_ia32_tpause",
    1272                 :             :                UINT8_FTYPE_UNSIGNED_UINT64, IX86_BUILTIN_TPAUSE);
    1273                 :             : 
    1274                 :             :   /* UINTR.  */
    1275                 :      257672 :   def_builtin (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_UINTR,
    1276                 :             :                "__builtin_ia32_testui",
    1277                 :             :                UINT8_FTYPE_VOID, IX86_BUILTIN_TESTUI);
    1278                 :             : 
    1279                 :             :   /* USER_MSR.  */
    1280                 :      257672 :   def_builtin (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_USER_MSR,
    1281                 :             :                "__builtin_ia32_urdmsr", UINT64_FTYPE_UINT64,
    1282                 :             :                IX86_BUILTIN_URDMSR);
    1283                 :      257672 :   def_builtin (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_USER_MSR,
    1284                 :             :                "__builtin_ia32_uwrmsr", VOID_FTYPE_UINT64_UINT64,
    1285                 :             :                IX86_BUILTIN_UWRMSR);
    1286                 :             : 
    1287                 :             :   /* CLDEMOTE.  */
    1288                 :      257672 :   def_builtin (0, OPTION_MASK_ISA2_CLDEMOTE, "__builtin_ia32_cldemote",
    1289                 :             :                VOID_FTYPE_PCVOID, IX86_BUILTIN_CLDEMOTE);
    1290                 :             : 
    1291                 :             :   /* Add FMA4 multi-arg argument instructions */
    1292                 :    42258208 :   for (i = 0, d = bdesc_multi_arg; i < ARRAY_SIZE (bdesc_multi_arg); i++, d++)
    1293                 :             :     {
    1294                 :    41742864 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_MULTI_ARG_FIRST, i);
    1295                 :    41742864 :       if (d->name == 0)
    1296                 :           0 :         continue;
    1297                 :             : 
    1298                 :    41742864 :       ftype = (enum ix86_builtin_func_type) d->flag;
    1299                 :    41742864 :       def_builtin_const (d->mask, d->mask2, d->name, ftype, d->code);
    1300                 :             :     }
    1301                 :             :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_MULTI_ARG_LAST,
    1302                 :             :                  IX86_BUILTIN__BDESC_MULTI_ARG_FIRST,
    1303                 :             :                  ARRAY_SIZE (bdesc_multi_arg) - 1);
    1304                 :             : 
    1305                 :             :   /* Add CET inrinsics.  */
    1306                 :     3349736 :   for (i = 0, d = bdesc_cet; i < ARRAY_SIZE (bdesc_cet); i++, d++)
    1307                 :             :     {
    1308                 :     3092064 :       BDESC_VERIFY (d->code, IX86_BUILTIN__BDESC_CET_FIRST, i);
    1309                 :     3092064 :       if (d->name == 0)
    1310                 :           0 :         continue;
    1311                 :             : 
    1312                 :     3092064 :       ftype = (enum ix86_builtin_func_type) d->flag;
    1313                 :     3092064 :       def_builtin (d->mask, d->mask2, d->name, ftype, d->code);
    1314                 :             :     }
    1315                 :      257672 :   BDESC_VERIFYS (IX86_BUILTIN__BDESC_CET_LAST,
    1316                 :             :                  IX86_BUILTIN__BDESC_CET_FIRST,
    1317                 :             :                  ARRAY_SIZE (bdesc_cet) - 1);
    1318                 :      257672 : }
    1319                 :             : 
    1320                 :             : #undef BDESC_VERIFY
    1321                 :             : #undef BDESC_VERIFYS
    1322                 :             : 
    1323                 :             : /* Make builtins to detect cpu type and features supported.  NAME is
    1324                 :             :    the builtin name, CODE is the builtin code, and FTYPE is the function
    1325                 :             :    type of the builtin.  */
    1326                 :             : 
    1327                 :             : static void
    1328                 :      773016 : make_cpu_type_builtin (const char* name, int code,
    1329                 :             :                        enum ix86_builtin_func_type ftype, bool is_const)
    1330                 :             : {
    1331                 :      773016 :   tree decl;
    1332                 :      773016 :   tree type;
    1333                 :             : 
    1334                 :      773016 :   type = ix86_get_builtin_func_type (ftype);
    1335                 :      773016 :   decl = add_builtin_function (name, type, code, BUILT_IN_MD,
    1336                 :             :                                NULL, NULL_TREE);
    1337                 :      773016 :   gcc_assert (decl != NULL_TREE);
    1338                 :      773016 :   ix86_builtins[(int) code] = decl;
    1339                 :      773016 :   TREE_READONLY (decl) = is_const;
    1340                 :      773016 : }
    1341                 :             : 
    1342                 :             : /* Make builtins to get CPU type and features supported.  The created
    1343                 :             :    builtins are :
    1344                 :             : 
    1345                 :             :    __builtin_cpu_init (), to detect cpu type and features,
    1346                 :             :    __builtin_cpu_is ("<CPUNAME>"), to check if cpu is of type <CPUNAME>,
    1347                 :             :    __builtin_cpu_supports ("<FEATURE>"), to check if cpu supports <FEATURE>
    1348                 :             :    */
    1349                 :             : 
    1350                 :             : static void
    1351                 :      257672 : ix86_init_platform_type_builtins (void)
    1352                 :             : {
    1353                 :      257672 :   make_cpu_type_builtin ("__builtin_cpu_init", IX86_BUILTIN_CPU_INIT,
    1354                 :             :                          INT_FTYPE_VOID, false);
    1355                 :      257672 :   make_cpu_type_builtin ("__builtin_cpu_is", IX86_BUILTIN_CPU_IS,
    1356                 :             :                          INT_FTYPE_PCCHAR, true);
    1357                 :      257672 :   make_cpu_type_builtin ("__builtin_cpu_supports", IX86_BUILTIN_CPU_SUPPORTS,
    1358                 :             :                          INT_FTYPE_PCCHAR, true);
    1359                 :      257672 : }
    1360                 :             : 
    1361                 :             : /* Internal method for ix86_init_builtins.  */
    1362                 :             : 
    1363                 :             : static void
    1364                 :      252103 : ix86_init_builtins_va_builtins_abi (void)
    1365                 :             : {
    1366                 :      252103 :   tree ms_va_ref, sysv_va_ref;
    1367                 :      252103 :   tree fnvoid_va_end_ms, fnvoid_va_end_sysv;
    1368                 :      252103 :   tree fnvoid_va_start_ms, fnvoid_va_start_sysv;
    1369                 :      252103 :   tree fnvoid_va_copy_ms, fnvoid_va_copy_sysv;
    1370                 :      252103 :   tree fnattr_ms = NULL_TREE, fnattr_sysv = NULL_TREE;
    1371                 :             : 
    1372                 :      252103 :   if (!TARGET_64BIT)
    1373                 :             :     return;
    1374                 :      252103 :   fnattr_ms = build_tree_list (get_identifier ("ms_abi"), NULL_TREE);
    1375                 :      252103 :   fnattr_sysv = build_tree_list (get_identifier ("sysv_abi"), NULL_TREE);
    1376                 :      252103 :   ms_va_ref = build_reference_type (ms_va_list_type_node);
    1377                 :      252103 :   sysv_va_ref = build_pointer_type (TREE_TYPE (sysv_va_list_type_node));
    1378                 :             : 
    1379                 :      252103 :   fnvoid_va_end_ms = build_function_type_list (void_type_node, ms_va_ref,
    1380                 :             :                                                NULL_TREE);
    1381                 :      252103 :   fnvoid_va_start_ms
    1382                 :      252103 :     = build_varargs_function_type_list (void_type_node, ms_va_ref, NULL_TREE);
    1383                 :      252103 :   fnvoid_va_end_sysv
    1384                 :      252103 :     = build_function_type_list (void_type_node, sysv_va_ref, NULL_TREE);
    1385                 :      252103 :   fnvoid_va_start_sysv
    1386                 :      252103 :     = build_varargs_function_type_list (void_type_node, sysv_va_ref,
    1387                 :             :                                         NULL_TREE);
    1388                 :      252103 :   fnvoid_va_copy_ms
    1389                 :      252103 :     = build_function_type_list (void_type_node, ms_va_ref,
    1390                 :             :                                 ms_va_list_type_node, NULL_TREE);
    1391                 :      252103 :   fnvoid_va_copy_sysv
    1392                 :      252103 :     = build_function_type_list (void_type_node, sysv_va_ref,
    1393                 :             :                                 sysv_va_ref, NULL_TREE);
    1394                 :             : 
    1395                 :      252103 :   add_builtin_function ("__builtin_ms_va_start", fnvoid_va_start_ms,
    1396                 :             :                         BUILT_IN_VA_START, BUILT_IN_NORMAL, NULL, fnattr_ms);
    1397                 :      252103 :   add_builtin_function ("__builtin_ms_va_end", fnvoid_va_end_ms,
    1398                 :             :                         BUILT_IN_VA_END, BUILT_IN_NORMAL, NULL, fnattr_ms);
    1399                 :      252103 :   add_builtin_function ("__builtin_ms_va_copy", fnvoid_va_copy_ms,
    1400                 :             :                         BUILT_IN_VA_COPY, BUILT_IN_NORMAL, NULL, fnattr_ms);
    1401                 :      252103 :   add_builtin_function ("__builtin_sysv_va_start", fnvoid_va_start_sysv,
    1402                 :             :                         BUILT_IN_VA_START, BUILT_IN_NORMAL, NULL, fnattr_sysv);
    1403                 :      252103 :   add_builtin_function ("__builtin_sysv_va_end", fnvoid_va_end_sysv,
    1404                 :             :                         BUILT_IN_VA_END, BUILT_IN_NORMAL, NULL, fnattr_sysv);
    1405                 :      252103 :   add_builtin_function ("__builtin_sysv_va_copy", fnvoid_va_copy_sysv,
    1406                 :             :                         BUILT_IN_VA_COPY, BUILT_IN_NORMAL, NULL, fnattr_sysv);
    1407                 :             : }
    1408                 :             : 
    1409                 :             : static void
    1410                 :      257672 : ix86_register_float16_builtin_type (void)
    1411                 :             : {
    1412                 :             :   /* Provide the _Float16 type and float16_type_node if needed so that
    1413                 :             :      it can be used in AVX512FP16 intrinsics and builtins.  */
    1414                 :      257672 :   if (!float16_type_node)
    1415                 :             :     {
    1416                 :           0 :       ix86_float16_type_node = make_node (REAL_TYPE);
    1417                 :           0 :       TYPE_PRECISION (ix86_float16_type_node) = 16;
    1418                 :           0 :       SET_TYPE_MODE (ix86_float16_type_node, HFmode);
    1419                 :           0 :       layout_type (ix86_float16_type_node);
    1420                 :             :     }
    1421                 :             :   else
    1422                 :      257672 :     ix86_float16_type_node = float16_type_node;
    1423                 :             : 
    1424                 :      257672 :   if (!maybe_get_identifier ("_Float16"))
    1425                 :       51299 :     lang_hooks.types.register_builtin_type (ix86_float16_type_node,
    1426                 :             :                                             "_Float16");
    1427                 :      257672 : }
    1428                 :             : 
    1429                 :             : static void
    1430                 :      257672 : ix86_register_bf16_builtin_type (void)
    1431                 :             : {
    1432                 :      257672 :   if (bfloat16_type_node == NULL_TREE)
    1433                 :             :     {
    1434                 :           0 :       ix86_bf16_type_node = make_node (REAL_TYPE);
    1435                 :           0 :       TYPE_PRECISION (ix86_bf16_type_node) = 16;
    1436                 :           0 :       SET_TYPE_MODE (ix86_bf16_type_node, BFmode);
    1437                 :           0 :       layout_type (ix86_bf16_type_node);
    1438                 :             :     }
    1439                 :             :   else
    1440                 :      257672 :     ix86_bf16_type_node = bfloat16_type_node;
    1441                 :             : 
    1442                 :      257672 :   if (!maybe_get_identifier ("__bf16"))
    1443                 :      257672 :     lang_hooks.types.register_builtin_type (ix86_bf16_type_node, "__bf16");
    1444                 :      257672 : }
    1445                 :             : 
    1446                 :             : static void
    1447                 :      257672 : ix86_init_builtin_types (void)
    1448                 :             : {
    1449                 :      257672 :   tree float80_type_node, const_string_type_node;
    1450                 :             : 
    1451                 :             :   /* The __float80 type.  */
    1452                 :      257672 :   float80_type_node = long_double_type_node;
    1453                 :      257672 :   if (TYPE_MODE (float80_type_node) != XFmode)
    1454                 :             :     {
    1455                 :          22 :       if (float64x_type_node != NULL_TREE
    1456                 :          22 :           && TYPE_MODE (float64x_type_node) == XFmode)
    1457                 :           0 :         float80_type_node = float64x_type_node;
    1458                 :             :       else
    1459                 :             :         {
    1460                 :             :           /* The __float80 type.  */
    1461                 :          22 :           float80_type_node = make_node (REAL_TYPE);
    1462                 :             : 
    1463                 :          22 :           TYPE_PRECISION (float80_type_node) = 80;
    1464                 :          22 :           layout_type (float80_type_node);
    1465                 :             :         }
    1466                 :             :     }
    1467                 :      257672 :   lang_hooks.types.register_builtin_type (float80_type_node, "__float80");
    1468                 :             : 
    1469                 :             :   /* The __float128 type.  The node has already been created as
    1470                 :             :      _Float128, so for C we only need to register the __float128 name for
    1471                 :             :      it.  For C++, we create a distinct type which will mangle differently
    1472                 :             :      (g) vs. _Float128 (DF128_) and behave backwards compatibly.  */
    1473                 :      257672 :   if (float128t_type_node == NULL_TREE)
    1474                 :             :     {
    1475                 :      101073 :       float128t_type_node = make_node (REAL_TYPE);
    1476                 :      101073 :       TYPE_PRECISION (float128t_type_node)
    1477                 :      101073 :         = TYPE_PRECISION (float128_type_node);
    1478                 :      101073 :       SET_TYPE_MODE (float128t_type_node, TYPE_MODE (float128_type_node));
    1479                 :      101073 :       layout_type (float128t_type_node);
    1480                 :             :     }
    1481                 :      257672 :   lang_hooks.types.register_builtin_type (float128t_type_node, "__float128");
    1482                 :             : 
    1483                 :      257672 :   ix86_register_float16_builtin_type ();
    1484                 :             : 
    1485                 :      257672 :   ix86_register_bf16_builtin_type ();
    1486                 :             : 
    1487                 :      257672 :   const_string_type_node
    1488                 :      257672 :     = build_pointer_type (build_qualified_type
    1489                 :             :                           (char_type_node, TYPE_QUAL_CONST));
    1490                 :             : 
    1491                 :             :   /* This macro is built by i386-builtin-types.awk.  */
    1492                 :      257672 :   DEFINE_BUILTIN_PRIMITIVE_TYPES;
    1493                 :      257672 : }
    1494                 :             : 
    1495                 :             : void
    1496                 :      257672 : ix86_init_builtins (void)
    1497                 :             : {
    1498                 :      257672 :   tree ftype, decl;
    1499                 :             : 
    1500                 :      257672 :   ix86_init_builtin_types ();
    1501                 :             : 
    1502                 :             :   /* Builtins to get CPU type and features. */
    1503                 :      257672 :   ix86_init_platform_type_builtins ();
    1504                 :             : 
    1505                 :             :   /* TFmode support builtins.  */
    1506                 :      257672 :   def_builtin_const (0, 0, "__builtin_infq",
    1507                 :             :                      FLOAT128_FTYPE_VOID, IX86_BUILTIN_INFQ);
    1508                 :      257672 :   def_builtin_const (0, 0, "__builtin_huge_valq",
    1509                 :             :                      FLOAT128_FTYPE_VOID, IX86_BUILTIN_HUGE_VALQ);
    1510                 :             : 
    1511                 :      257672 :   ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_CONST_STRING);
    1512                 :      257672 :   decl = add_builtin_function ("__builtin_nanq", ftype, IX86_BUILTIN_NANQ,
    1513                 :             :                                BUILT_IN_MD, "nanq", NULL_TREE);
    1514                 :      257672 :   TREE_READONLY (decl) = 1;
    1515                 :      257672 :   ix86_builtins[(int) IX86_BUILTIN_NANQ] = decl;
    1516                 :             : 
    1517                 :      257672 :   decl = add_builtin_function ("__builtin_nansq", ftype, IX86_BUILTIN_NANSQ,
    1518                 :             :                                BUILT_IN_MD, "nansq", NULL_TREE);
    1519                 :      257672 :   TREE_READONLY (decl) = 1;
    1520                 :      257672 :   ix86_builtins[(int) IX86_BUILTIN_NANSQ] = decl;
    1521                 :             : 
    1522                 :             :   /* We will expand them to normal call if SSE isn't available since
    1523                 :             :      they are used by libgcc. */
    1524                 :      257672 :   ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128);
    1525                 :      257672 :   decl = add_builtin_function ("__builtin_fabsq", ftype, IX86_BUILTIN_FABSQ,
    1526                 :             :                                BUILT_IN_MD, "__fabstf2", NULL_TREE);
    1527                 :      257672 :   TREE_READONLY (decl) = 1;
    1528                 :      257672 :   ix86_builtins[(int) IX86_BUILTIN_FABSQ] = decl;
    1529                 :             : 
    1530                 :      257672 :   ftype = ix86_get_builtin_func_type (FLOAT128_FTYPE_FLOAT128_FLOAT128);
    1531                 :      257672 :   decl = add_builtin_function ("__builtin_copysignq", ftype,
    1532                 :             :                                IX86_BUILTIN_COPYSIGNQ, BUILT_IN_MD,
    1533                 :             :                                "__copysigntf3", NULL_TREE);
    1534                 :      257672 :   TREE_READONLY (decl) = 1;
    1535                 :      257672 :   ix86_builtins[(int) IX86_BUILTIN_COPYSIGNQ] = decl;
    1536                 :             : 
    1537                 :      257672 :   ix86_init_tm_builtins ();
    1538                 :      257672 :   ix86_init_mmx_sse_builtins ();
    1539                 :             : 
    1540                 :      257672 :   if (TARGET_LP64)
    1541                 :      252103 :     ix86_init_builtins_va_builtins_abi ();
    1542                 :             : 
    1543                 :             : #ifdef SUBTARGET_INIT_BUILTINS
    1544                 :             :   SUBTARGET_INIT_BUILTINS;
    1545                 :             : #endif
    1546                 :      257672 : }
    1547                 :             : 
    1548                 :             : /* Return the ix86 builtin for CODE.  */
    1549                 :             : 
    1550                 :             : tree
    1551                 :        2229 : ix86_builtin_decl (unsigned code, bool)
    1552                 :             : {
    1553                 :        2229 :   if (code >= IX86_BUILTIN_MAX)
    1554                 :           0 :     return error_mark_node;
    1555                 :             : 
    1556                 :        2229 :   return ix86_builtins[code];
    1557                 :             : }
    1558                 :             : 
    1559                 :             : /* This returns the target-specific builtin with code CODE if
    1560                 :             :    current_function_decl has visibility on this builtin, which is checked
    1561                 :             :    using isa flags.  Returns NULL_TREE otherwise.  */
    1562                 :             : 
    1563                 :        2099 : static tree ix86_get_builtin (enum ix86_builtins code)
    1564                 :             : {
    1565                 :        2099 :   struct cl_target_option *opts;
    1566                 :        2099 :   tree target_tree = NULL_TREE;
    1567                 :             : 
    1568                 :             :   /* Determine the isa flags of current_function_decl.  */
    1569                 :             : 
    1570                 :        2099 :   if (current_function_decl)
    1571                 :        2099 :     target_tree = DECL_FUNCTION_SPECIFIC_TARGET (current_function_decl);
    1572                 :             : 
    1573                 :        2099 :   if (target_tree == NULL)
    1574                 :        1865 :     target_tree = target_option_default_node;
    1575                 :             : 
    1576                 :        2099 :   opts = TREE_TARGET_OPTION (target_tree);
    1577                 :             : 
    1578                 :        2099 :   if ((ix86_builtins_isa[(int) code].isa & opts->x_ix86_isa_flags)
    1579                 :           0 :       || (ix86_builtins_isa[(int) code].isa2 & opts->x_ix86_isa_flags2))
    1580                 :        2099 :     return ix86_builtin_decl (code, true);
    1581                 :             :   else
    1582                 :             :     return NULL_TREE;
    1583                 :             : }
    1584                 :             : 
    1585                 :             : /* Vectorization library interface and handlers.  */
    1586                 :             : tree (*ix86_veclib_handler) (combined_fn, tree, tree);
    1587                 :             : 
    1588                 :             : /* Returns a function decl for a vectorized version of the combined function
    1589                 :             :    with combined_fn code FN and the result vector type TYPE, or NULL_TREE
    1590                 :             :    if it is not available.  */
    1591                 :             : 
    1592                 :             : tree
    1593                 :        5108 : ix86_builtin_vectorized_function (unsigned int fn, tree type_out,
    1594                 :             :                                   tree type_in)
    1595                 :             : {
    1596                 :        5108 :   machine_mode in_mode, out_mode;
    1597                 :        5108 :   int in_n, out_n;
    1598                 :             : 
    1599                 :        5108 :   if (TREE_CODE (type_out) != VECTOR_TYPE
    1600                 :        5108 :       || TREE_CODE (type_in) != VECTOR_TYPE)
    1601                 :             :     return NULL_TREE;
    1602                 :             : 
    1603                 :        5108 :   out_mode = TYPE_MODE (TREE_TYPE (type_out));
    1604                 :        5108 :   out_n = TYPE_VECTOR_SUBPARTS (type_out);
    1605                 :        5108 :   in_mode = TYPE_MODE (TREE_TYPE (type_in));
    1606                 :        5108 :   in_n = TYPE_VECTOR_SUBPARTS (type_in);
    1607                 :             : 
    1608                 :        5108 :   switch (fn)
    1609                 :             :     {
    1610                 :          17 :     CASE_CFN_IFLOOR:
    1611                 :          17 :     CASE_CFN_LFLOOR:
    1612                 :             :       /* The round insn does not trap on denormals.  */
    1613                 :          17 :       if (flag_trapping_math || !TARGET_SSE4_1)
    1614                 :             :         break;
    1615                 :             : 
    1616                 :             :       /* PR106910, currently vectorizer doesn't go direct internal fn way
    1617                 :             :          when out_n != in_n, so let's still keep this.
    1618                 :             :          Otherwise, it relies on expander of
    1619                 :             :          lceilmn2/lfloormn2/lroundmn2/lrintmn2.  */
    1620                 :          17 :       if (out_mode == SImode && in_mode == DFmode)
    1621                 :             :         {
    1622                 :          17 :           if (out_n == 4 && in_n == 2)
    1623                 :          10 :             return ix86_get_builtin (IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX);
    1624                 :           7 :           else if (out_n == 8 && in_n == 4)
    1625                 :           3 :             return ix86_get_builtin (IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX256);
    1626                 :           4 :           else if (out_n == 16 && in_n == 8)
    1627                 :           4 :             return ix86_get_builtin (IX86_BUILTIN_FLOORPD_VEC_PACK_SFIX512);
    1628                 :             :         }
    1629                 :             :       break;
    1630                 :             : 
    1631                 :          17 :     CASE_CFN_ICEIL:
    1632                 :          17 :     CASE_CFN_LCEIL:
    1633                 :             :       /* The round insn does not trap on denormals.  */
    1634                 :          17 :       if (flag_trapping_math || !TARGET_SSE4_1)
    1635                 :             :         break;
    1636                 :             : 
    1637                 :          17 :       if (out_mode == SImode && in_mode == DFmode)
    1638                 :             :         {
    1639                 :          17 :           if (out_n == 4 && in_n == 2)
    1640                 :          10 :             return ix86_get_builtin (IX86_BUILTIN_CEILPD_VEC_PACK_SFIX);
    1641                 :           7 :           else if (out_n == 8 && in_n == 4)
    1642                 :           3 :             return ix86_get_builtin (IX86_BUILTIN_CEILPD_VEC_PACK_SFIX256);
    1643                 :           4 :           else if (out_n == 16 && in_n == 8)
    1644                 :           4 :             return ix86_get_builtin (IX86_BUILTIN_CEILPD_VEC_PACK_SFIX512);
    1645                 :             :         }
    1646                 :             :       break;
    1647                 :             : 
    1648                 :          47 :     CASE_CFN_IRINT:
    1649                 :          47 :     CASE_CFN_LRINT:
    1650                 :          47 :       if (out_mode == SImode && in_mode == DFmode)
    1651                 :             :         {
    1652                 :          17 :           if (out_n == 4 && in_n == 2)
    1653                 :          10 :             return ix86_get_builtin (IX86_BUILTIN_VEC_PACK_SFIX);
    1654                 :           7 :           else if (out_n == 8 && in_n == 4)
    1655                 :           3 :             return ix86_get_builtin (IX86_BUILTIN_VEC_PACK_SFIX256);
    1656                 :           4 :           else if (out_n == 16 && in_n == 8)
    1657                 :           4 :             return ix86_get_builtin (IX86_BUILTIN_VEC_PACK_SFIX512);
    1658                 :             :         }
    1659                 :             :       break;
    1660                 :             : 
    1661                 :          33 :     CASE_CFN_IROUND:
    1662                 :          33 :     CASE_CFN_LROUND:
    1663                 :             :       /* The round insn does not trap on denormals.  */
    1664                 :          33 :       if (flag_trapping_math || !TARGET_SSE4_1)
    1665                 :             :         break;
    1666                 :             : 
    1667                 :          17 :       if (out_mode == SImode && in_mode == DFmode)
    1668                 :             :         {
    1669                 :          17 :           if (out_n == 4 && in_n == 2)
    1670                 :          10 :             return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX);
    1671                 :           7 :           else if (out_n == 8 && in_n == 4)
    1672                 :           3 :             return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX256);
    1673                 :           4 :           else if (out_n == 16 && in_n == 8)
    1674                 :           4 :             return ix86_get_builtin (IX86_BUILTIN_ROUNDPD_AZ_VEC_PACK_SFIX512);
    1675                 :             :         }
    1676                 :             :       break;
    1677                 :             : 
    1678                 :             : 
    1679                 :             :     default:
    1680                 :             :       break;
    1681                 :             :     }
    1682                 :             : 
    1683                 :             :   /* Dispatch to a handler for a vectorization library.  */
    1684                 :        5040 :   if (ix86_veclib_handler)
    1685                 :          14 :     return ix86_veclib_handler (combined_fn (fn), type_out, type_in);
    1686                 :             : 
    1687                 :             :   return NULL_TREE;
    1688                 :             : }
    1689                 :             : 
    1690                 :             : /* Returns a decl of a function that implements gather load with
    1691                 :             :    memory type MEM_VECTYPE and index type INDEX_VECTYPE and SCALE.
    1692                 :             :    Return NULL_TREE if it is not available.  */
    1693                 :             : 
    1694                 :             : tree
    1695                 :      105681 : ix86_vectorize_builtin_gather (const_tree mem_vectype,
    1696                 :             :                                const_tree index_type, int scale)
    1697                 :             : {
    1698                 :      105681 :   bool si;
    1699                 :      105681 :   enum ix86_builtins code;
    1700                 :      105681 :   const machine_mode mode = TYPE_MODE (TREE_TYPE (mem_vectype));
    1701                 :             : 
    1702                 :      201538 :   if ((!TARGET_AVX512F || !TARGET_EVEX512) && GET_MODE_SIZE (mode) == 64)
    1703                 :             :     return NULL_TREE;
    1704                 :             : 
    1705                 :      105681 :   if (! TARGET_AVX2
    1706                 :      105681 :       || (known_eq (TYPE_VECTOR_SUBPARTS (mem_vectype), 2u)
    1707                 :       13345 :           ? !TARGET_USE_GATHER_2PARTS
    1708                 :       10485 :           : (known_eq (TYPE_VECTOR_SUBPARTS (mem_vectype), 4u)
    1709                 :       10485 :              ? !TARGET_USE_GATHER_4PARTS
    1710                 :        6691 :              : !TARGET_USE_GATHER_8PARTS)))
    1711                 :      102926 :     return NULL_TREE;
    1712                 :             : 
    1713                 :        2755 :   if ((TREE_CODE (index_type) != INTEGER_TYPE
    1714                 :         164 :        && !POINTER_TYPE_P (index_type))
    1715                 :        2919 :       || (TYPE_MODE (index_type) != SImode
    1716                 :         899 :           && TYPE_MODE (index_type) != DImode))
    1717                 :           0 :     return NULL_TREE;
    1718                 :             : 
    1719                 :        2783 :   if (TYPE_PRECISION (index_type) > POINTER_SIZE)
    1720                 :             :     return NULL_TREE;
    1721                 :             : 
    1722                 :             :   /* v*gather* insn sign extends index to pointer mode.  */
    1723                 :        2755 :   if (TYPE_PRECISION (index_type) < POINTER_SIZE
    1724                 :        2755 :       && TYPE_UNSIGNED (index_type))
    1725                 :             :     return NULL_TREE;
    1726                 :             : 
    1727                 :        2235 :   if (scale <= 0
    1728                 :        2235 :       || scale > 8
    1729                 :        2181 :       || (scale & (scale - 1)) != 0)
    1730                 :             :     return NULL_TREE;
    1731                 :             : 
    1732                 :        2181 :   si = TYPE_MODE (index_type) == SImode;
    1733                 :        2181 :   switch (TYPE_MODE (mem_vectype))
    1734                 :             :     {
    1735                 :         119 :     case E_V2DFmode:
    1736                 :         119 :       if (TARGET_AVX512VL)
    1737                 :          94 :         code = si ? IX86_BUILTIN_GATHER3SIV2DF : IX86_BUILTIN_GATHER3DIV2DF;
    1738                 :             :       else
    1739                 :          25 :         code = si ? IX86_BUILTIN_GATHERSIV2DF : IX86_BUILTIN_GATHERDIV2DF;
    1740                 :             :       break;
    1741                 :         204 :     case E_V4DFmode:
    1742                 :         204 :       if (TARGET_AVX512VL)
    1743                 :          69 :         code = si ? IX86_BUILTIN_GATHER3ALTSIV4DF : IX86_BUILTIN_GATHER3DIV4DF;
    1744                 :             :       else
    1745                 :         135 :         code = si ? IX86_BUILTIN_GATHERALTSIV4DF : IX86_BUILTIN_GATHERDIV4DF;
    1746                 :             :       break;
    1747                 :         137 :     case E_V2DImode:
    1748                 :         137 :       if (TARGET_AVX512VL)
    1749                 :         107 :         code = si ? IX86_BUILTIN_GATHER3SIV2DI : IX86_BUILTIN_GATHER3DIV2DI;
    1750                 :             :       else
    1751                 :          30 :         code = si ? IX86_BUILTIN_GATHERSIV2DI : IX86_BUILTIN_GATHERDIV2DI;
    1752                 :             :       break;
    1753                 :         159 :     case E_V4DImode:
    1754                 :         159 :       if (TARGET_AVX512VL)
    1755                 :          75 :         code = si ? IX86_BUILTIN_GATHER3ALTSIV4DI : IX86_BUILTIN_GATHER3DIV4DI;
    1756                 :             :       else
    1757                 :          84 :         code = si ? IX86_BUILTIN_GATHERALTSIV4DI : IX86_BUILTIN_GATHERDIV4DI;
    1758                 :             :       break;
    1759                 :         188 :     case E_V4SFmode:
    1760                 :         188 :       if (TARGET_AVX512VL)
    1761                 :          94 :         code = si ? IX86_BUILTIN_GATHER3SIV4SF : IX86_BUILTIN_GATHER3DIV4SF;
    1762                 :             :       else
    1763                 :          94 :         code = si ? IX86_BUILTIN_GATHERSIV4SF : IX86_BUILTIN_GATHERDIV4SF;
    1764                 :             :       break;
    1765                 :         194 :     case E_V8SFmode:
    1766                 :         194 :       if (TARGET_AVX512VL)
    1767                 :          64 :         code = si ? IX86_BUILTIN_GATHER3SIV8SF : IX86_BUILTIN_GATHER3ALTDIV8SF;
    1768                 :             :       else
    1769                 :         130 :         code = si ? IX86_BUILTIN_GATHERSIV8SF : IX86_BUILTIN_GATHERALTDIV8SF;
    1770                 :             :       break;
    1771                 :         196 :     case E_V4SImode:
    1772                 :         196 :       if (TARGET_AVX512VL)
    1773                 :          99 :         code = si ? IX86_BUILTIN_GATHER3SIV4SI : IX86_BUILTIN_GATHER3DIV4SI;
    1774                 :             :       else
    1775                 :          97 :         code = si ? IX86_BUILTIN_GATHERSIV4SI : IX86_BUILTIN_GATHERDIV4SI;
    1776                 :             :       break;
    1777                 :         170 :     case E_V8SImode:
    1778                 :         170 :       if (TARGET_AVX512VL)
    1779                 :          69 :         code = si ? IX86_BUILTIN_GATHER3SIV8SI : IX86_BUILTIN_GATHER3ALTDIV8SI;
    1780                 :             :       else
    1781                 :         101 :         code = si ? IX86_BUILTIN_GATHERSIV8SI : IX86_BUILTIN_GATHERALTDIV8SI;
    1782                 :             :       break;
    1783                 :         168 :     case E_V8DFmode:
    1784                 :         168 :       code = si ? IX86_BUILTIN_GATHER3ALTSIV8DF : IX86_BUILTIN_GATHER3DIV8DF;
    1785                 :             :       break;
    1786                 :         147 :     case E_V8DImode:
    1787                 :         147 :       code = si ? IX86_BUILTIN_GATHER3ALTSIV8DI : IX86_BUILTIN_GATHER3DIV8DI;
    1788                 :             :       break;
    1789                 :         199 :     case E_V16SFmode:
    1790                 :         199 :       code = si ? IX86_BUILTIN_GATHER3SIV16SF : IX86_BUILTIN_GATHER3ALTDIV16SF;
    1791                 :             :       break;
    1792                 :         150 :     case E_V16SImode:
    1793                 :         150 :       code = si ? IX86_BUILTIN_GATHER3SIV16SI : IX86_BUILTIN_GATHER3ALTDIV16SI;
    1794                 :             :       break;
    1795                 :             :     default:
    1796                 :             :       return NULL_TREE;
    1797                 :             :     }
    1798                 :             : 
    1799                 :        2031 :   return ix86_get_builtin (code);
    1800                 :             : }
    1801                 :             : 
    1802                 :             : /* Returns a code for a target-specific builtin that implements
    1803                 :             :    reciprocal of the function, or NULL_TREE if not available.  */
    1804                 :             : 
    1805                 :             : tree
    1806                 :           0 : ix86_builtin_reciprocal (tree fndecl)
    1807                 :             : {
    1808                 :           0 :   enum ix86_builtins fn_code
    1809                 :           0 :     = (enum ix86_builtins) DECL_MD_FUNCTION_CODE (fndecl);
    1810                 :           0 :   switch (fn_code)
    1811                 :             :     {
    1812                 :             :       /* Vectorized version of sqrt to rsqrt conversion.  */
    1813                 :           0 :     case IX86_BUILTIN_SQRTPS_NR:
    1814                 :           0 :       return ix86_get_builtin (IX86_BUILTIN_RSQRTPS_NR);
    1815                 :             : 
    1816                 :           0 :     case IX86_BUILTIN_SQRTPS_NR256:
    1817                 :           0 :       return ix86_get_builtin (IX86_BUILTIN_RSQRTPS_NR256);
    1818                 :             : 
    1819                 :             :     default:
    1820                 :             :       return NULL_TREE;
    1821                 :             :     }
    1822                 :             : }
    1823                 :             : 
    1824                 :             : /* This parses the attribute arguments to target in DECL and determines
    1825                 :             :    the right builtin to use to match the platform specification.
    1826                 :             :    It returns the priority value for this version decl.  If PREDICATE_LIST
    1827                 :             :    is not NULL, it stores the list of cpu features that need to be checked
    1828                 :             :    before dispatching this function.  */
    1829                 :             : 
    1830                 :             : unsigned int
    1831                 :        2965 : get_builtin_code_for_version (tree decl, tree *predicate_list)
    1832                 :             : {
    1833                 :        2965 :   tree attrs;
    1834                 :        2965 :   struct cl_target_option cur_target;
    1835                 :        2965 :   tree target_node;
    1836                 :        2965 :   struct cl_target_option *new_target;
    1837                 :        2965 :   const char *arg_str = NULL;
    1838                 :        2965 :   const char *attrs_str = NULL;
    1839                 :        2965 :   char *tok_str = NULL;
    1840                 :        2965 :   char *token;
    1841                 :             : 
    1842                 :        2965 :   enum feature_priority priority = P_NONE;
    1843                 :             : 
    1844                 :        2965 :   static unsigned int NUM_FEATURES = ARRAY_SIZE (isa_names_table);
    1845                 :             : 
    1846                 :        2965 :   unsigned int i;
    1847                 :             : 
    1848                 :        2965 :   tree predicate_chain = NULL_TREE;
    1849                 :        2965 :   tree predicate_decl, predicate_arg;
    1850                 :             : 
    1851                 :        2965 :   attrs = lookup_attribute ("target", DECL_ATTRIBUTES (decl));
    1852                 :        2965 :   gcc_assert (attrs != NULL);
    1853                 :             : 
    1854                 :        2965 :   attrs = TREE_VALUE (TREE_VALUE (attrs));
    1855                 :             : 
    1856                 :        2965 :   gcc_assert (TREE_CODE (attrs) == STRING_CST);
    1857                 :        2965 :   attrs_str = TREE_STRING_POINTER (attrs);
    1858                 :             : 
    1859                 :             :   /* Return priority zero for default function.  */
    1860                 :        2965 :   if (strcmp (attrs_str, "default") == 0)
    1861                 :             :     return 0;
    1862                 :             : 
    1863                 :             :   /* Handle arch= if specified.  For priority, set it to be 1 more than
    1864                 :             :      the best instruction set the processor can handle.  For instance, if
    1865                 :             :      there is a version for atom and a version for ssse3 (the highest ISA
    1866                 :             :      priority for atom), the atom version must be checked for dispatch
    1867                 :             :      before the ssse3 version. */
    1868                 :        2722 :   if (strstr (attrs_str, "arch=") != NULL)
    1869                 :             :     {
    1870                 :         980 :       cl_target_option_save (&cur_target, &global_options,
    1871                 :             :                              &global_options_set);
    1872                 :         980 :       target_node
    1873                 :         980 :         = ix86_valid_target_attribute_tree (decl, attrs, &global_options,
    1874                 :             :                                             &global_options_set, 0);
    1875                 :             :     
    1876                 :         980 :       gcc_assert (target_node);
    1877                 :         980 :       if (target_node == error_mark_node)
    1878                 :             :         return 0;
    1879                 :         980 :       new_target = TREE_TARGET_OPTION (target_node);
    1880                 :         980 :       gcc_assert (new_target);
    1881                 :         980 :       enum ix86_builtins builtin_fn = IX86_BUILTIN_CPU_IS;
    1882                 :             : 
    1883                 :             :       /* Special case x86-64 micro-level architectures.  */
    1884                 :         980 :       const char *arch_name = attrs_str + strlen ("arch=");
    1885                 :         980 :       if (startswith (arch_name, "x86-64"))
    1886                 :             :         {
    1887                 :          68 :           arg_str = arch_name;
    1888                 :          68 :           builtin_fn = IX86_BUILTIN_CPU_SUPPORTS;
    1889                 :          68 :           if (strcmp (arch_name, "x86-64") == 0)
    1890                 :             :             priority = P_X86_64_BASELINE;
    1891                 :          51 :           else if (strcmp (arch_name, "x86-64-v2") == 0)
    1892                 :             :             priority = P_X86_64_V2;
    1893                 :          34 :           else if (strcmp (arch_name, "x86-64-v3") == 0)
    1894                 :             :             priority = P_X86_64_V3;
    1895                 :          21 :           else if (strcmp (arch_name, "x86-64-v4") == 0)
    1896                 :          21 :             priority = P_X86_64_V4;
    1897                 :             :         }
    1898                 :         912 :       else if (new_target->arch_specified && new_target->arch > 0)
    1899                 :       53354 :         for (i = 0; i < pta_size; i++)
    1900                 :       53354 :           if (processor_alias_table[i].processor == new_target->arch)
    1901                 :             :             {
    1902                 :         912 :               const pta *arch_info = &processor_alias_table[i];
    1903                 :         912 :               switch (arch_info->priority)
    1904                 :             :                 {
    1905                 :         607 :                 default:
    1906                 :         607 :                   arg_str = arch_info->name;
    1907                 :         607 :                   priority = arch_info->priority;
    1908                 :         607 :                   break;
    1909                 :         297 :                 case P_PROC_DYNAMIC:
    1910                 :         297 :                   switch (new_target->arch)
    1911                 :             :                     {
    1912                 :         140 :                     case PROCESSOR_NEHALEM:
    1913                 :         140 :                       if (TARGET_PCLMUL_P (new_target->x_ix86_isa_flags))
    1914                 :             :                         {
    1915                 :             :                           arg_str = "westmere";
    1916                 :             :                           priority = P_PCLMUL;
    1917                 :             :                         }
    1918                 :             :                       else
    1919                 :             :                         {
    1920                 :             :                           /* We translate "arch=corei7" and "arch=nehalem"
    1921                 :             :                              to "corei7" so that it will be mapped to
    1922                 :             :                              M_INTEL_COREI7 as cpu type to cover all
    1923                 :             :                              M_INTEL_COREI7_XXXs.  */
    1924                 :         124 :                           arg_str = "corei7";
    1925                 :         124 :                           priority = P_PROC_SSE4_2;
    1926                 :             :                         }
    1927                 :             :                       break;
    1928                 :          42 :                     case PROCESSOR_SANDYBRIDGE:
    1929                 :          42 :                       if (TARGET_F16C_P (new_target->x_ix86_isa_flags))
    1930                 :             :                         arg_str = "ivybridge";
    1931                 :             :                       else
    1932                 :          22 :                         arg_str = "sandybridge";
    1933                 :             :                       priority = P_PROC_AVX;
    1934                 :             :                       break;
    1935                 :          71 :                     case PROCESSOR_HASWELL:
    1936                 :          71 :                       if (TARGET_ADX_P (new_target->x_ix86_isa_flags))
    1937                 :             :                         arg_str = "broadwell";
    1938                 :             :                       else
    1939                 :          59 :                         arg_str = "haswell";
    1940                 :             :                       priority = P_PROC_AVX2;
    1941                 :             :                       break;
    1942                 :             :                     case PROCESSOR_AMDFAM10:
    1943                 :             :                       arg_str = "amdfam10h";
    1944                 :             :                       priority = P_PROC_SSE4_A;
    1945                 :             :                       break;
    1946                 :           0 :                     default:
    1947                 :           0 :                       gcc_unreachable ();
    1948                 :             :                     }
    1949                 :             :                   break;
    1950                 :             :                 case P_NONE:
    1951                 :             :                   break;
    1952                 :             :                 }
    1953                 :             :               break;
    1954                 :             :             }
    1955                 :             : 
    1956                 :         980 :       cl_target_option_restore (&global_options, &global_options_set,
    1957                 :             :                                 &cur_target);
    1958                 :             :         
    1959                 :         980 :       if (predicate_list && arg_str == NULL)
    1960                 :             :         {
    1961                 :           0 :           error_at (DECL_SOURCE_LOCATION (decl),
    1962                 :             :                     "no dispatcher found for the versioning attributes");
    1963                 :           0 :           return 0;
    1964                 :             :         }
    1965                 :             :     
    1966                 :         980 :       if (predicate_list)
    1967                 :             :         {
    1968                 :         348 :           predicate_decl = ix86_builtins [(int) builtin_fn];
    1969                 :             :           /* For a C string literal the length includes the trailing NULL.  */
    1970                 :         348 :           predicate_arg = build_string_literal (strlen (arg_str) + 1, arg_str);
    1971                 :         348 :           predicate_chain = tree_cons (predicate_decl, predicate_arg,
    1972                 :             :                                        predicate_chain);
    1973                 :             :         }
    1974                 :             :     }
    1975                 :             : 
    1976                 :             :   /* Process feature name.  */
    1977                 :        2722 :   tok_str =  (char *) xmalloc (strlen (attrs_str) + 1);
    1978                 :        2722 :   strcpy (tok_str, attrs_str);
    1979                 :        2722 :   token = strtok (tok_str, ",");
    1980                 :        2722 :   predicate_decl = ix86_builtins [(int) IX86_BUILTIN_CPU_SUPPORTS];
    1981                 :             : 
    1982                 :        5428 :   while (token != NULL)
    1983                 :             :     {
    1984                 :             :       /* Do not process "arch="  */
    1985                 :        2922 :       if (startswith (token, "arch="))
    1986                 :             :         {
    1987                 :         980 :           token = strtok (NULL, ",");
    1988                 :         980 :           continue;
    1989                 :             :         }
    1990                 :       50012 :       for (i = 0; i < NUM_FEATURES; ++i)
    1991                 :             :         {
    1992                 :       49812 :           if (strcmp (token, isa_names_table[i].name) == 0)
    1993                 :             :             {
    1994                 :        1742 :               if (predicate_list)
    1995                 :             :                 {
    1996                 :         950 :                   predicate_arg = build_string_literal (
    1997                 :         475 :                                   strlen (isa_names_table[i].name) + 1,
    1998                 :             :                                   isa_names_table[i].name);
    1999                 :         475 :                   predicate_chain = tree_cons (predicate_decl, predicate_arg,
    2000                 :             :                                                predicate_chain);
    2001                 :             :                 }
    2002                 :             :               /* Find the maximum priority feature.  */
    2003                 :        1742 :               if (isa_names_table[i].priority > priority)
    2004                 :        1394 :                 priority = isa_names_table[i].priority;
    2005                 :             : 
    2006                 :             :               break;
    2007                 :             :             }
    2008                 :             :         }
    2009                 :        1942 :       if (predicate_list && priority == P_NONE)
    2010                 :             :         {
    2011                 :         216 :           error_at (DECL_SOURCE_LOCATION (decl),
    2012                 :             :                     "ISA %qs is not supported in %<target%> attribute, "
    2013                 :             :                     "use %<arch=%> syntax", token);
    2014                 :         216 :           return 0;
    2015                 :             :         }
    2016                 :        1726 :       token = strtok (NULL, ",");
    2017                 :             :     }
    2018                 :        2506 :   free (tok_str);
    2019                 :             : 
    2020                 :        2506 :   if (predicate_list && predicate_chain == NULL_TREE)
    2021                 :             :     {
    2022                 :           0 :       error_at (DECL_SOURCE_LOCATION (decl),
    2023                 :             :                 "no dispatcher found for the versioning attributes: %s",
    2024                 :             :                 attrs_str);
    2025                 :           0 :       return 0;
    2026                 :             :     }
    2027                 :        2506 :   else if (predicate_list)
    2028                 :             :     {
    2029                 :         639 :       predicate_chain = nreverse (predicate_chain);
    2030                 :         639 :       *predicate_list = predicate_chain;
    2031                 :             :     }
    2032                 :             : 
    2033                 :             :   return priority; 
    2034                 :             : }
    2035                 :             : 
    2036                 :             : /* This builds the processor_model struct type defined in
    2037                 :             :    libgcc/config/i386/cpuinfo.c  */
    2038                 :             : 
    2039                 :             : static tree
    2040                 :         419 : build_processor_model_struct (void)
    2041                 :             : {
    2042                 :         419 :   const char *field_name[] = {"__cpu_vendor", "__cpu_type", "__cpu_subtype",
    2043                 :             :                               "__cpu_features"};
    2044                 :         419 :   tree field = NULL_TREE, field_chain = NULL_TREE;
    2045                 :         419 :   int i;
    2046                 :         419 :   tree type = make_node (RECORD_TYPE);
    2047                 :             : 
    2048                 :             :   /* The first 3 fields are unsigned int.  */
    2049                 :        2095 :   for (i = 0; i < 3; ++i)
    2050                 :             :     {
    2051                 :        1257 :       field = build_decl (UNKNOWN_LOCATION, FIELD_DECL,
    2052                 :             :                           get_identifier (field_name[i]), unsigned_type_node);
    2053                 :        1257 :       if (field_chain != NULL_TREE)
    2054                 :         838 :         DECL_CHAIN (field) = field_chain;
    2055                 :        1257 :       field_chain = field;
    2056                 :             :     }
    2057                 :             : 
    2058                 :             :   /* The last field is an array of unsigned integers of size one.  */
    2059                 :         419 :   field = build_decl (UNKNOWN_LOCATION, FIELD_DECL,
    2060                 :             :                       get_identifier (field_name[3]),
    2061                 :             :                       build_array_type (unsigned_type_node,
    2062                 :             :                                         build_index_type (size_one_node)));
    2063                 :         419 :   if (field_chain != NULL_TREE)
    2064                 :         419 :     DECL_CHAIN (field) = field_chain;
    2065                 :         419 :   field_chain = field;
    2066                 :             : 
    2067                 :         419 :   finish_builtin_struct (type, "__processor_model", field_chain, NULL_TREE);
    2068                 :         419 :   return type;
    2069                 :             : }
    2070                 :             : 
    2071                 :             : /* Returns a extern, comdat VAR_DECL of type TYPE and name NAME. */
    2072                 :             : 
    2073                 :             : static tree
    2074                 :         481 : make_var_decl (tree type, const char *name)
    2075                 :             : {
    2076                 :         481 :   tree new_decl;
    2077                 :             : 
    2078                 :         481 :   new_decl = build_decl (UNKNOWN_LOCATION,
    2079                 :             :                          VAR_DECL,
    2080                 :             :                          get_identifier(name),
    2081                 :             :                          type);
    2082                 :             : 
    2083                 :         481 :   DECL_EXTERNAL (new_decl) = 1;
    2084                 :         481 :   TREE_STATIC (new_decl) = 1;
    2085                 :         481 :   TREE_PUBLIC (new_decl) = 1;
    2086                 :         481 :   DECL_INITIAL (new_decl) = 0;
    2087                 :         481 :   DECL_ARTIFICIAL (new_decl) = 0;
    2088                 :         481 :   DECL_PRESERVE_P (new_decl) = 1;
    2089                 :             : 
    2090                 :         481 :   make_decl_one_only (new_decl, DECL_ASSEMBLER_NAME (new_decl));
    2091                 :         481 :   assemble_variable (new_decl, 0, 0, 0);
    2092                 :             : 
    2093                 :         481 :   return new_decl;
    2094                 :             : }
    2095                 :             : 
    2096                 :             : static GTY(()) tree ix86_cpu_model_type_node;
    2097                 :             : static GTY(()) tree ix86_cpu_model_var;
    2098                 :             : static GTY(()) tree ix86_cpu_features2_type_node;
    2099                 :             : static GTY(()) tree ix86_cpu_features2_var;
    2100                 :             : 
    2101                 :             : /* FNDECL is a __builtin_cpu_is or a __builtin_cpu_supports call that is folded
    2102                 :             :    into an integer defined in libgcc/config/i386/cpuinfo.c */
    2103                 :             : 
    2104                 :             : tree
    2105                 :        6956 : fold_builtin_cpu (tree fndecl, tree *args)
    2106                 :             : {
    2107                 :        6956 :   unsigned int i;
    2108                 :        6956 :   enum ix86_builtins fn_code
    2109                 :        6956 :     = (enum ix86_builtins) DECL_MD_FUNCTION_CODE (fndecl);
    2110                 :        6956 :   tree param_string_cst = NULL;
    2111                 :             : 
    2112                 :        6956 :   if (ix86_cpu_model_var == nullptr)
    2113                 :             :     {
    2114                 :             :       /* Build a single __cpu_model variable for all references to
    2115                 :             :          __cpu_model so that GIMPLE level optimizers can CSE the loads
    2116                 :             :          of __cpu_model and optimize bit-operations properly.  */
    2117                 :         419 :       ix86_cpu_model_type_node = build_processor_model_struct ();
    2118                 :         419 :       ix86_cpu_model_var = make_var_decl (ix86_cpu_model_type_node,
    2119                 :             :                                           "__cpu_model");
    2120                 :         419 :       varpool_node::add (ix86_cpu_model_var);
    2121                 :             :     }
    2122                 :             : 
    2123                 :        6956 :   gcc_assert ((args != NULL) && (*args != NULL));
    2124                 :             : 
    2125                 :             :   param_string_cst = *args;
    2126                 :             :   while (param_string_cst
    2127                 :       20868 :          && TREE_CODE (param_string_cst) !=  STRING_CST)
    2128                 :             :     {
    2129                 :             :       /* *args must be a expr that can contain other EXPRS leading to a
    2130                 :             :          STRING_CST.   */
    2131                 :       13912 :       if (!EXPR_P (param_string_cst))
    2132                 :             :         {
    2133                 :           0 :           error ("parameter to builtin must be a string constant or literal");
    2134                 :           0 :           return integer_zero_node;
    2135                 :             :         }
    2136                 :       13912 :       param_string_cst = TREE_OPERAND (EXPR_CHECK (param_string_cst), 0);
    2137                 :             :     }
    2138                 :             : 
    2139                 :        6956 :   gcc_assert (param_string_cst);
    2140                 :             : 
    2141                 :        6956 :   if (fn_code == IX86_BUILTIN_CPU_IS)
    2142                 :             :     {
    2143                 :             :       tree ref;
    2144                 :             :       tree field;
    2145                 :             :       tree final;
    2146                 :             : 
    2147                 :      235967 :       unsigned int field_val = 0;
    2148                 :             : 
    2149                 :      235967 :       for (i = 0; i < num_arch_names; i++)
    2150                 :      235967 :         if (processor_alias_table[i].model != 0
    2151                 :      235967 :             && strcmp (processor_alias_table[i].name,
    2152                 :       99954 :                        TREE_STRING_POINTER (param_string_cst)) == 0)
    2153                 :             :           break;
    2154                 :             : 
    2155                 :        3800 :       if (i == num_arch_names)
    2156                 :             :         {
    2157                 :           0 :           error ("parameter to builtin not valid: %s",
    2158                 :           0 :                  TREE_STRING_POINTER (param_string_cst));
    2159                 :           0 :           return integer_zero_node;
    2160                 :             :         }
    2161                 :             : 
    2162                 :        3800 :       field = TYPE_FIELDS (ix86_cpu_model_type_node);
    2163                 :        3800 :       field_val = processor_alias_table[i].model;
    2164                 :             : 
    2165                 :             :       /* CPU types are stored in the next field.  */
    2166                 :        3800 :       if (field_val > M_CPU_TYPE_START
    2167                 :        3800 :           && field_val < M_CPU_SUBTYPE_START)
    2168                 :             :         {
    2169                 :        1894 :           field = DECL_CHAIN (field);
    2170                 :        1894 :           field_val -= M_CPU_TYPE_START;
    2171                 :             :         }
    2172                 :             : 
    2173                 :             :       /* CPU subtypes are stored in the next field.  */
    2174                 :        3800 :       if (field_val > M_CPU_SUBTYPE_START)
    2175                 :             :         {
    2176                 :        1802 :           field = DECL_CHAIN ( DECL_CHAIN (field));
    2177                 :        1802 :           field_val -= M_CPU_SUBTYPE_START;
    2178                 :             :         }
    2179                 :             : 
    2180                 :             :       /* Get the appropriate field in __cpu_model.  */
    2181                 :        3800 :       ref = build3 (COMPONENT_REF, TREE_TYPE (field), ix86_cpu_model_var,
    2182                 :             :                     field, NULL_TREE);
    2183                 :             : 
    2184                 :             :       /* Check the value.  */
    2185                 :        3800 :       final = build2 (EQ_EXPR, unsigned_type_node, ref,
    2186                 :             :                       build_int_cstu (unsigned_type_node, field_val));
    2187                 :        3800 :       return build1 (NOP_EXPR, integer_type_node, final);
    2188                 :             :     }
    2189                 :        3156 :   else if (fn_code == IX86_BUILTIN_CPU_SUPPORTS)
    2190                 :             :     {
    2191                 :             :       tree ref;
    2192                 :             :       tree array_elt;
    2193                 :             :       tree field;
    2194                 :             :       tree final;
    2195                 :             : 
    2196                 :       63497 :       unsigned int field_val = 0;
    2197                 :             :       unsigned int NUM_ISA_NAMES = ARRAY_SIZE (isa_names_table);
    2198                 :             : 
    2199                 :       63497 :       for (i = 0; i < NUM_ISA_NAMES; i++)
    2200                 :       63497 :         if (strcmp (isa_names_table[i].name,
    2201                 :       63497 :             TREE_STRING_POINTER (param_string_cst)) == 0)
    2202                 :             :           break;
    2203                 :             : 
    2204                 :        3156 :       if (i == NUM_ISA_NAMES)
    2205                 :             :         {
    2206                 :           0 :           error ("parameter to builtin not valid: %s",
    2207                 :           0 :                  TREE_STRING_POINTER (param_string_cst));
    2208                 :           0 :           return integer_zero_node;
    2209                 :             :         }
    2210                 :             : 
    2211                 :        3156 :       unsigned feature = isa_names_table[i].feature;
    2212                 :        3156 :       if (feature >= INT_TYPE_SIZE)
    2213                 :             :         {
    2214                 :         378 :           if (ix86_cpu_features2_var == nullptr)
    2215                 :             :             {
    2216                 :             :               /* Build a single __cpu_features2 variable for all
    2217                 :             :                  references to __cpu_features2 so that GIMPLE level
    2218                 :             :                  optimizers can CSE the loads of __cpu_features2 and
    2219                 :             :                  optimize bit-operations properly.  */
    2220                 :          62 :               tree index_type
    2221                 :          62 :                 = build_index_type (size_int (SIZE_OF_CPU_FEATURES));
    2222                 :          62 :               ix86_cpu_features2_type_node
    2223                 :          62 :                 = build_array_type (unsigned_type_node, index_type);
    2224                 :          62 :               ix86_cpu_features2_var
    2225                 :          62 :                 = make_var_decl (ix86_cpu_features2_type_node,
    2226                 :             :                                  "__cpu_features2");
    2227                 :          62 :               varpool_node::add (ix86_cpu_features2_var);
    2228                 :             :             }
    2229                 :             : 
    2230                 :             :           /* Skip __cpu_features[0].  */
    2231                 :         378 :           feature -= INT_TYPE_SIZE;
    2232                 :         378 :           tree index = size_int (feature / INT_TYPE_SIZE);
    2233                 :         378 :           feature = feature % INT_TYPE_SIZE;
    2234                 :         378 :           array_elt = build4 (ARRAY_REF, unsigned_type_node,
    2235                 :             :                               ix86_cpu_features2_var,
    2236                 :             :                               index, NULL_TREE, NULL_TREE);
    2237                 :             :           /* Return __cpu_features2[index] & field_val  */
    2238                 :             :         }
    2239                 :             :       else
    2240                 :             :         {
    2241                 :        2778 :           field = TYPE_FIELDS (ix86_cpu_model_type_node);
    2242                 :             :           /* Get the last field, which is __cpu_features.  */
    2243                 :       11112 :           while (DECL_CHAIN (field))
    2244                 :        8334 :             field = DECL_CHAIN (field);
    2245                 :             : 
    2246                 :             :           /* Get the appropriate field: __cpu_model.__cpu_features  */
    2247                 :        2778 :           ref = build3 (COMPONENT_REF, TREE_TYPE (field), ix86_cpu_model_var,
    2248                 :             :                         field, NULL_TREE);
    2249                 :             : 
    2250                 :             :           /* Access the 0th element of __cpu_features array.  */
    2251                 :        2778 :           array_elt = build4 (ARRAY_REF, unsigned_type_node, ref,
    2252                 :             :                               integer_zero_node, NULL_TREE, NULL_TREE);
    2253                 :             : 
    2254                 :             :           /* Return __cpu_model.__cpu_features[0] & field_val  */
    2255                 :             :         }
    2256                 :             : 
    2257                 :        3156 :       field_val = 1U << feature;
    2258                 :        3156 :       final = build2 (BIT_AND_EXPR, unsigned_type_node, array_elt,
    2259                 :             :                       build_int_cstu (unsigned_type_node, field_val));
    2260                 :        3156 :       if (feature == INT_TYPE_SIZE - 1)
    2261                 :          60 :         return build2 (NE_EXPR, integer_type_node, final,
    2262                 :          60 :                        build_int_cst (unsigned_type_node, 0));
    2263                 :             :       else
    2264                 :        3096 :         return build1 (NOP_EXPR, integer_type_node, final);
    2265                 :             :     }
    2266                 :           0 :   gcc_unreachable ();
    2267                 :             : }
    2268                 :             : 
    2269                 :             : #include "gt-i386-builtins.h"
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.