1 /* Copyright (C
) 2016-2019 Free Software Foundation
, Inc.
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
)
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
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
/>.
*/
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
}
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
),
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
),
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
,
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
),
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
,
52 DEF_BUILTIN (SQRTVF
, 3 /*CODE_FOR_sqrtvf
*/,
54 _A2 (GCN_BTI_V64SF
, GCN_BTI_V64SF
),
57 DEF_BUILTIN (SQRTF
, 3 /*CODE_FOR_sqrtf
*/,
59 _A2 (GCN_BTI_SF
, GCN_BTI_SF
),
62 DEF_BUILTIN (CMP_SWAP
, -1,
64 _A4 (GCN_BTI_UINT
, GCN_BTI_VOIDPTR
, GCN_BTI_UINT
, GCN_BTI_UINT
),
67 DEF_BUILTIN (CMP_SWAPLL
, -1,
70 GCN_BTI_VOIDPTR
, GCN_BTI_LLUINT
, GCN_BTI_LLUINT
),
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.
*/
79 DEF_BUILTIN_BINOP_INT_FP (ADD
, add
, "add")
80 DEF_BUILTIN_BINOP_INT_FP (SUB
, sub
, "sub")
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")
88 DEF_BUILTIN (OMP_DIM_SIZE
, CODE_FOR_oacc_dim_size
,
90 _A2 (GCN_BTI_INT
, GCN_BTI_INT
),
92 DEF_BUILTIN (OMP_DIM_POS
, CODE_FOR_oacc_dim_pos
,
94 _A2 (GCN_BTI_INT
, GCN_BTI_INT
),
99 DEF_BUILTIN (ACC_SINGLE_START
, -1, "single_start", B_INSN
, _A1 (GCN_BTI_BOOL
),
100 gcn_expand_builtin_1
)
102 DEF_BUILTIN (ACC_SINGLE_COPY_START
, -1, "single_copy_start", B_INSN
,
103 _A1 (GCN_BTI_LDS_VOIDPTR
), gcn_expand_builtin_1
)
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
)
108 DEF_BUILTIN (ACC_BARRIER
, -1, "acc_barrier", B_INSN
, _A1 (GCN_BTI_VOID
),
109 gcn_expand_builtin_1
)