Home | History | Annotate | Line # | Download | only in gcn
      1 /* Copyright (C) 2016-2022 Free Software Foundation, Inc.
      2 
      3    This file is free software; you can redistribute it and/or modify it under
      4    the terms of the GNU General Public License as published by the Free
      5    Software Foundation; either version 3 of the License, or (at your option)
      6    any later version.
      7 
      8    This file is distributed in the hope that it will be useful, but WITHOUT
      9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     10    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     11    for more details.
     12 
     13    You should have received a copy of the GNU General Public License
     14    along with GCC; see the file COPYING3.  If not see
     15    <http://www.gnu.org/licenses/>.  */
     16 
     17 /* The first argument to these macros is the return type of the builtin,
     18    the rest are arguments of the builtin.  */
     19 #define _A1(a)	       {a, GCN_BTI_END_OF_PARAMS}
     20 #define _A2(a,b)       {a, b, GCN_BTI_END_OF_PARAMS}
     21 #define _A3(a,b,c)     {a, b, c, GCN_BTI_END_OF_PARAMS}
     22 #define _A4(a,b,c,d)   {a, b, c, d, GCN_BTI_END_OF_PARAMS}
     23 #define _A5(a,b,c,d,e) {a, b, c, d, e, GCN_BTI_END_OF_PARAMS}
     24 
     25 DEF_BUILTIN (FLAT_LOAD_INT32, 1 /*CODE_FOR_flat_load_v64si*/,
     26 	     "flat_load_int32", B_INSN,
     27 	     _A3 (GCN_BTI_V64SI, GCN_BTI_EXEC, GCN_BTI_V64SI),
     28 	     gcn_expand_builtin_1)
     29 
     30 DEF_BUILTIN (FLAT_LOAD_PTR_INT32, 2 /*CODE_FOR_flat_load_ptr_v64si */,
     31 	     "flat_load_ptr_int32", B_INSN,
     32 	     _A4 (GCN_BTI_V64SI, GCN_BTI_EXEC, GCN_BTI_SIPTR, GCN_BTI_V64SI),
     33 	     gcn_expand_builtin_1)
     34 
     35 DEF_BUILTIN (FLAT_STORE_PTR_INT32, 3 /*CODE_FOR_flat_store_ptr_v64si */,
     36 	     "flat_store_ptr_int32", B_INSN,
     37 	     _A5 (GCN_BTI_VOID, GCN_BTI_EXEC, GCN_BTI_SIPTR, GCN_BTI_V64SI,
     38 		  GCN_BTI_V64SI),
     39 	     gcn_expand_builtin_1)
     40 
     41 DEF_BUILTIN (FLAT_LOAD_PTR_FLOAT, 2 /*CODE_FOR_flat_load_ptr_v64sf */,
     42 	     "flat_load_ptr_float", B_INSN,
     43 	     _A4 (GCN_BTI_V64SF, GCN_BTI_EXEC, GCN_BTI_SFPTR, GCN_BTI_V64SI),
     44 	     gcn_expand_builtin_1)
     45 
     46 DEF_BUILTIN (FLAT_STORE_PTR_FLOAT, 3 /*CODE_FOR_flat_store_ptr_v64sf */,
     47 	     "flat_store_ptr_float", B_INSN,
     48 	     _A5 (GCN_BTI_VOID, GCN_BTI_EXEC, GCN_BTI_SFPTR, GCN_BTI_V64SI,
     49 		  GCN_BTI_V64SF),
     50 	     gcn_expand_builtin_1)
     51 
     52 DEF_BUILTIN (SQRTVF, 3 /*CODE_FOR_sqrtvf */,
     53 	     "sqrtvf", B_INSN,
     54 	     _A2 (GCN_BTI_V64SF, GCN_BTI_V64SF),
     55 	     gcn_expand_builtin_1)
     56 
     57 DEF_BUILTIN (SQRTF, 3 /*CODE_FOR_sqrtf */,
     58 	     "sqrtf", B_INSN,
     59 	     _A2 (GCN_BTI_SF, GCN_BTI_SF),
     60 	     gcn_expand_builtin_1)
     61 
     62 DEF_BUILTIN (CMP_SWAP, -1,
     63 	    "cmp_swap", B_INSN,
     64 	    _A4 (GCN_BTI_UINT, GCN_BTI_VOIDPTR, GCN_BTI_UINT, GCN_BTI_UINT),
     65 	     gcn_expand_builtin_1)
     66 
     67 DEF_BUILTIN (CMP_SWAPLL, -1,
     68 	    "cmp_swapll", B_INSN,
     69 	    _A4 (GCN_BTI_LLUINT,
     70 		 GCN_BTI_VOIDPTR, GCN_BTI_LLUINT, GCN_BTI_LLUINT),
     71 	    gcn_expand_builtin_1)
     72 
     73 /* DEF_BUILTIN_BINOP_INT_FP creates many variants of a builtin function for a
     74    given operation.  The first argument will give base to the identifier of a
     75    particular builtin, the second will be used to form the name of the patter
     76    used to expand it to and the third will be used to create the user-visible
     77    builtin identifier.  */
     78 
     79 DEF_BUILTIN_BINOP_INT_FP (ADD, add, "add")
     80 DEF_BUILTIN_BINOP_INT_FP (SUB, sub, "sub")
     81 
     82 DEF_BUILTIN_BINOP_INT_FP (AND, and, "and")
     83 DEF_BUILTIN_BINOP_INT_FP (IOR, ior, "or")
     84 DEF_BUILTIN_BINOP_INT_FP (XOR, xor, "xor")
     85 
     86 /* OpenMP.  */
     87 
     88 DEF_BUILTIN (OMP_DIM_SIZE, CODE_FOR_oacc_dim_size,
     89 	     "dim_size", B_INSN,
     90 	     _A2 (GCN_BTI_INT, GCN_BTI_INT),
     91 	     gcn_expand_builtin_1)
     92 DEF_BUILTIN (OMP_DIM_POS, CODE_FOR_oacc_dim_pos,
     93 	     "dim_pos", B_INSN,
     94 	     _A2 (GCN_BTI_INT, GCN_BTI_INT),
     95 	     gcn_expand_builtin_1)
     96 
     97 /* OpenACC.  */
     98 
     99 DEF_BUILTIN (ACC_SINGLE_START, -1, "single_start", B_INSN, _A1 (GCN_BTI_BOOL),
    100 	     gcn_expand_builtin_1)
    101 
    102 DEF_BUILTIN (ACC_SINGLE_COPY_START, -1, "single_copy_start", B_INSN,
    103 	     _A1 (GCN_BTI_LDS_VOIDPTR), gcn_expand_builtin_1)
    104 
    105 DEF_BUILTIN (ACC_SINGLE_COPY_END, -1, "single_copy_end", B_INSN,
    106 	     _A2 (GCN_BTI_VOID, GCN_BTI_LDS_VOIDPTR), gcn_expand_builtin_1)
    107 
    108 DEF_BUILTIN (ACC_BARRIER, -1, "acc_barrier", B_INSN, _A1 (GCN_BTI_VOID),
    109 	     gcn_expand_builtin_1)
    110 
    111 
    112 #undef _A1
    113 #undef _A2
    114 #undef _A3
    115 #undef _A4
    116 #undef _A5
    117