Add basic support for direct_optab internal functions
[gcc.git] / gcc / internal-fn.def
1 /* Internal functions.
2 Copyright (C) 2011-2015 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
19
20 /* This file specifies a list of internal "functions". These functions
21 differ from built-in functions in that they have no linkage and cannot
22 be called directly by the user. They represent operations that are only
23 synthesised by GCC itself.
24
25 Internal functions are used instead of tree codes if the operation
26 and its operands are more naturally represented as a GIMPLE_CALL
27 than a GIMPLE_ASSIGN.
28
29 Each entry in this file has one of the forms:
30
31 DEF_INTERNAL_FN (NAME, FLAGS, FNSPEC)
32 DEF_INTERNAL_OPTAB_FN (NAME, FLAGS, OPTAB, TYPE)
33
34 where NAME is the name of the function, FLAGS is a set of
35 ECF_* flags and FNSPEC is a string describing functions fnspec.
36
37 DEF_INTERNAL_OPTAB_FN defines an internal function that maps to a
38 direct optab. The function should only be called with a given
39 set of types if the associated optab is available for the modes
40 of those types. OPTAB says what optab to use (without the trailing
41 "_optab") and TYPE categorizes the optab based on its inputs and
42 outputs. The possible types of optab are:
43
44 - mask_load: currently just maskload
45 - load_lanes: currently just vec_load_lanes
46
47 - mask_store: currently just maskstore
48 - store_lanes: currently just vec_store_lanes
49
50 Each entry must have a corresponding expander of the form:
51
52 void expand_NAME (gimple_call stmt)
53
54 where STMT is the statement that performs the call. These are generated
55 automatically for optab functions and call out to a function or macro
56 called expand_<TYPE>_optab_fn. */
57
58 #ifndef DEF_INTERNAL_FN
59 #define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC)
60 #endif
61
62 #ifndef DEF_INTERNAL_OPTAB_FN
63 #define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \
64 DEF_INTERNAL_FN (NAME, FLAGS | ECF_LEAF, NULL)
65 #endif
66
67 DEF_INTERNAL_OPTAB_FN (MASK_LOAD, ECF_PURE, maskload, mask_load)
68 DEF_INTERNAL_OPTAB_FN (LOAD_LANES, ECF_CONST, vec_load_lanes, load_lanes)
69
70 DEF_INTERNAL_OPTAB_FN (MASK_STORE, 0, maskstore, mask_store)
71 DEF_INTERNAL_OPTAB_FN (STORE_LANES, ECF_CONST, vec_store_lanes, store_lanes)
72
73 DEF_INTERNAL_FN (GOMP_SIMD_LANE, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
74 DEF_INTERNAL_FN (GOMP_SIMD_VF, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
75 DEF_INTERNAL_FN (GOMP_SIMD_LAST_LANE, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
76 DEF_INTERNAL_FN (GOMP_SIMD_ORDERED_START, ECF_LEAF | ECF_NOTHROW, NULL)
77 DEF_INTERNAL_FN (GOMP_SIMD_ORDERED_END, ECF_LEAF | ECF_NOTHROW, NULL)
78 DEF_INTERNAL_FN (LOOP_VECTORIZED, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
79 DEF_INTERNAL_FN (ANNOTATE, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
80 DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ".R.")
81 DEF_INTERNAL_FN (UBSAN_BOUNDS, ECF_LEAF | ECF_NOTHROW, NULL)
82 DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ".RR..")
83 DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
84 DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
85 DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
86 DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL)
87 DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
88 DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
89 DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, ".R...")
90 DEF_INTERNAL_FN (ADD_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
91 DEF_INTERNAL_FN (SUB_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
92 DEF_INTERNAL_FN (MUL_OVERFLOW, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
93 DEF_INTERNAL_FN (TSAN_FUNC_EXIT, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
94 DEF_INTERNAL_FN (VA_ARG, ECF_NOTHROW | ECF_LEAF, NULL)
95
96 /* An unduplicable, uncombinable function. Generally used to preserve
97 a CFG property in the face of jump threading, tail merging or
98 other such optimizations. The first argument distinguishes
99 between uses. See internal-fn.h for usage. */
100 DEF_INTERNAL_FN (UNIQUE, ECF_NOTHROW, NULL)
101
102 /* DIM_SIZE and DIM_POS return the size of a particular compute
103 dimension and the executing thread's position within that
104 dimension. DIM_POS is pure (and not const) so that it isn't
105 thought to clobber memory and can be gcse'd within a single
106 parallel region, but not across FORK/JOIN boundaries. They take a
107 single INTEGER_CST argument. */
108 DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, ".")
109 DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, ".")
110
111 /* OpenACC looping abstraction. See internal-fn.h for usage. */
112 DEF_INTERNAL_FN (GOACC_LOOP, ECF_PURE | ECF_NOTHROW, NULL)
113
114 /* OpenACC reduction abstraction. See internal-fn.h for usage. */
115 DEF_INTERNAL_FN (GOACC_REDUCTION, ECF_NOTHROW | ECF_LEAF, NULL)
116
117 #undef DEF_INTERNAL_OPTAB_FN
118 #undef DEF_INTERNAL_FN