blob: 62e94108a73555ce50785b795b3cc9ab4c258537 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- Intrinsics.td - Defines all LLVM intrinsics ---------*- tablegen -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8//
9// This file defines properties of all LLVM intrinsics.
10//
11//===----------------------------------------------------------------------===//
12
13include "llvm/CodeGen/ValueTypes.td"
14include "llvm/CodeGen/SDNodeProperties.td"
15
16//===----------------------------------------------------------------------===//
17// Properties we keep track of for intrinsics.
18//===----------------------------------------------------------------------===//
19
20class IntrinsicProperty;
21
22// Intr*Mem - Memory properties. If no property is set, the worst case
23// is assumed (it may read and write any memory it can get access to and it may
24// have other side effects).
25
26// IntrNoMem - The intrinsic does not access memory or have any other side
27// effects. It may be CSE'd deleted if dead, etc.
28def IntrNoMem : IntrinsicProperty;
29
30// IntrReadMem - This intrinsic only reads from memory. It does not write to
31// memory and has no other side effects. Therefore, it cannot be moved across
32// potentially aliasing stores. However, it can be reordered otherwise and can
33// be deleted if dead.
34def IntrReadMem : IntrinsicProperty;
35
36// IntrWriteMem - This intrinsic only writes to memory, but does not read from
37// memory, and has no other side effects. This means dead stores before calls
38// to this intrinsics may be removed.
39def IntrWriteMem : IntrinsicProperty;
40
41// IntrArgMemOnly - This intrinsic only accesses memory that its pointer-typed
42// argument(s) points to, but may access an unspecified amount. Other than
43// reads from and (possibly volatile) writes to memory, it has no side effects.
44def IntrArgMemOnly : IntrinsicProperty;
45
46// IntrInaccessibleMemOnly -- This intrinsic only accesses memory that is not
47// accessible by the module being compiled. This is a weaker form of IntrNoMem.
48def IntrInaccessibleMemOnly : IntrinsicProperty;
49
50// IntrInaccessibleMemOrArgMemOnly -- This intrinsic only accesses memory that
51// its pointer-typed arguments point to or memory that is not accessible
52// by the module being compiled. This is a weaker form of IntrArgMemOnly.
53def IntrInaccessibleMemOrArgMemOnly : IntrinsicProperty;
54
55// Commutative - This intrinsic is commutative: X op Y == Y op X.
56def Commutative : IntrinsicProperty;
57
58// Throws - This intrinsic can throw.
59def Throws : IntrinsicProperty;
60
61// NoCapture - The specified argument pointer is not captured by the intrinsic.
62class NoCapture<int argNo> : IntrinsicProperty {
63 int ArgNo = argNo;
64}
65
66// Returned - The specified argument is always the return value of the
67// intrinsic.
68class Returned<int argNo> : IntrinsicProperty {
69 int ArgNo = argNo;
70}
71
Andrew Walbran3d2c1972020-04-07 12:24:26 +010072// ImmArg - The specified argument must be an immediate.
73class ImmArg<int argNo> : IntrinsicProperty {
74 int ArgNo = argNo;
75}
76
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010077// ReadOnly - The specified argument pointer is not written to through the
78// pointer by the intrinsic.
79class ReadOnly<int argNo> : IntrinsicProperty {
80 int ArgNo = argNo;
81}
82
83// WriteOnly - The intrinsic does not read memory through the specified
84// argument pointer.
85class WriteOnly<int argNo> : IntrinsicProperty {
86 int ArgNo = argNo;
87}
88
89// ReadNone - The specified argument pointer is not dereferenced by the
90// intrinsic.
91class ReadNone<int argNo> : IntrinsicProperty {
92 int ArgNo = argNo;
93}
94
95def IntrNoReturn : IntrinsicProperty;
96
Andrew Walbran16937d02019-10-22 13:54:20 +010097// IntrCold - Calls to this intrinsic are cold.
98// Parallels the cold attribute on LLVM IR functions.
99def IntrCold : IntrinsicProperty;
100
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100101// IntrNoduplicate - Calls to this intrinsic cannot be duplicated.
102// Parallels the noduplicate attribute on LLVM IR functions.
103def IntrNoDuplicate : IntrinsicProperty;
104
105// IntrConvergent - Calls to this intrinsic are convergent and may not be made
106// control-dependent on any additional values.
107// Parallels the convergent attribute on LLVM IR functions.
108def IntrConvergent : IntrinsicProperty;
109
110// This property indicates that the intrinsic is safe to speculate.
111def IntrSpeculatable : IntrinsicProperty;
112
113// This property can be used to override the 'has no other side effects'
114// language of the IntrNoMem, IntrReadMem, IntrWriteMem, and IntrArgMemOnly
115// intrinsic properties. By default, intrinsics are assumed to have side
116// effects, so this property is only necessary if you have defined one of
117// the memory properties listed above.
118// For this property, 'side effects' has the same meaning as 'side effects'
119// defined by the hasSideEffects property of the TableGen Instruction class.
120def IntrHasSideEffects : IntrinsicProperty;
121
122//===----------------------------------------------------------------------===//
123// Types used by intrinsics.
124//===----------------------------------------------------------------------===//
125
126class LLVMType<ValueType vt> {
127 ValueType VT = vt;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100128 int isAny = 0;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100129}
130
131class LLVMQualPointerType<LLVMType elty, int addrspace>
132 : LLVMType<iPTR>{
133 LLVMType ElTy = elty;
134 int AddrSpace = addrspace;
135}
136
137class LLVMPointerType<LLVMType elty>
138 : LLVMQualPointerType<elty, 0>;
139
140class LLVMAnyPointerType<LLVMType elty>
141 : LLVMType<iPTRAny>{
142 LLVMType ElTy = elty;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100143
144 let isAny = 1;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100145}
146
147// Match the type of another intrinsic parameter. Number is an index into the
148// list of overloaded types for the intrinsic, excluding all the fixed types.
149// The Number value must refer to a previously listed type. For example:
150// Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_anyfloat_ty, LLVMMatchType<0>]>
151// has two overloaded types, the 2nd and 3rd arguments. LLVMMatchType<0>
152// refers to the first overloaded type, which is the 2nd argument.
153class LLVMMatchType<int num>
154 : LLVMType<OtherVT>{
155 int Number = num;
156}
157
158// Match the type of another intrinsic parameter that is expected to be based on
159// an integral type (i.e. either iN or <N x iM>), but change the scalar size to
160// be twice as wide or half as wide as the other type. This is only useful when
161// the intrinsic is overloaded, so the matched type should be declared as iAny.
162class LLVMExtendedType<int num> : LLVMMatchType<num>;
163class LLVMTruncatedType<int num> : LLVMMatchType<num>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100164
165// Match the scalar/vector of another intrinsic parameter but with a different
166// element type. Either both are scalars or both are vectors with the same
167// number of elements.
168class LLVMScalarOrSameVectorWidth<int idx, LLVMType elty>
169 : LLVMMatchType<idx> {
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100170 ValueType ElTy = elty.VT;
171}
Andrew Walbran16937d02019-10-22 13:54:20 +0100172
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100173class LLVMPointerTo<int num> : LLVMMatchType<num>;
174class LLVMPointerToElt<int num> : LLVMMatchType<num>;
175class LLVMVectorOfAnyPointersToElt<int num> : LLVMMatchType<num>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100176class LLVMVectorElementType<int num> : LLVMMatchType<num>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100177
178// Match the type of another intrinsic parameter that is expected to be a
179// vector type, but change the element count to be half as many
180class LLVMHalfElementsVectorType<int num> : LLVMMatchType<num>;
181
182def llvm_void_ty : LLVMType<isVoid>;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100183let isAny = 1 in {
184 def llvm_any_ty : LLVMType<Any>;
185 def llvm_anyint_ty : LLVMType<iAny>;
186 def llvm_anyfloat_ty : LLVMType<fAny>;
187 def llvm_anyvector_ty : LLVMType<vAny>;
188}
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100189def llvm_i1_ty : LLVMType<i1>;
190def llvm_i8_ty : LLVMType<i8>;
191def llvm_i16_ty : LLVMType<i16>;
192def llvm_i32_ty : LLVMType<i32>;
193def llvm_i64_ty : LLVMType<i64>;
194def llvm_half_ty : LLVMType<f16>;
195def llvm_float_ty : LLVMType<f32>;
196def llvm_double_ty : LLVMType<f64>;
197def llvm_f80_ty : LLVMType<f80>;
198def llvm_f128_ty : LLVMType<f128>;
199def llvm_ppcf128_ty : LLVMType<ppcf128>;
200def llvm_ptr_ty : LLVMPointerType<llvm_i8_ty>; // i8*
201def llvm_ptrptr_ty : LLVMPointerType<llvm_ptr_ty>; // i8**
202def llvm_anyptr_ty : LLVMAnyPointerType<llvm_i8_ty>; // (space)i8*
203def llvm_empty_ty : LLVMType<OtherVT>; // { }
204def llvm_descriptor_ty : LLVMPointerType<llvm_empty_ty>; // { }*
205def llvm_metadata_ty : LLVMType<MetadataVT>; // !{...}
206def llvm_token_ty : LLVMType<token>; // token
207
208def llvm_x86mmx_ty : LLVMType<x86mmx>;
209def llvm_ptrx86mmx_ty : LLVMPointerType<llvm_x86mmx_ty>; // <1 x i64>*
210
211def llvm_v2i1_ty : LLVMType<v2i1>; // 2 x i1
212def llvm_v4i1_ty : LLVMType<v4i1>; // 4 x i1
213def llvm_v8i1_ty : LLVMType<v8i1>; // 8 x i1
214def llvm_v16i1_ty : LLVMType<v16i1>; // 16 x i1
215def llvm_v32i1_ty : LLVMType<v32i1>; // 32 x i1
216def llvm_v64i1_ty : LLVMType<v64i1>; // 64 x i1
217def llvm_v512i1_ty : LLVMType<v512i1>; // 512 x i1
218def llvm_v1024i1_ty : LLVMType<v1024i1>; //1024 x i1
219
220def llvm_v1i8_ty : LLVMType<v1i8>; // 1 x i8
221def llvm_v2i8_ty : LLVMType<v2i8>; // 2 x i8
222def llvm_v4i8_ty : LLVMType<v4i8>; // 4 x i8
223def llvm_v8i8_ty : LLVMType<v8i8>; // 8 x i8
224def llvm_v16i8_ty : LLVMType<v16i8>; // 16 x i8
225def llvm_v32i8_ty : LLVMType<v32i8>; // 32 x i8
226def llvm_v64i8_ty : LLVMType<v64i8>; // 64 x i8
227def llvm_v128i8_ty : LLVMType<v128i8>; //128 x i8
228def llvm_v256i8_ty : LLVMType<v256i8>; //256 x i8
229
230def llvm_v1i16_ty : LLVMType<v1i16>; // 1 x i16
231def llvm_v2i16_ty : LLVMType<v2i16>; // 2 x i16
232def llvm_v4i16_ty : LLVMType<v4i16>; // 4 x i16
233def llvm_v8i16_ty : LLVMType<v8i16>; // 8 x i16
234def llvm_v16i16_ty : LLVMType<v16i16>; // 16 x i16
235def llvm_v32i16_ty : LLVMType<v32i16>; // 32 x i16
236def llvm_v64i16_ty : LLVMType<v64i16>; // 64 x i16
237def llvm_v128i16_ty : LLVMType<v128i16>; //128 x i16
238
239def llvm_v1i32_ty : LLVMType<v1i32>; // 1 x i32
240def llvm_v2i32_ty : LLVMType<v2i32>; // 2 x i32
241def llvm_v4i32_ty : LLVMType<v4i32>; // 4 x i32
242def llvm_v8i32_ty : LLVMType<v8i32>; // 8 x i32
243def llvm_v16i32_ty : LLVMType<v16i32>; // 16 x i32
244def llvm_v32i32_ty : LLVMType<v32i32>; // 32 x i32
245def llvm_v64i32_ty : LLVMType<v64i32>; // 64 x i32
246
247def llvm_v1i64_ty : LLVMType<v1i64>; // 1 x i64
248def llvm_v2i64_ty : LLVMType<v2i64>; // 2 x i64
249def llvm_v4i64_ty : LLVMType<v4i64>; // 4 x i64
250def llvm_v8i64_ty : LLVMType<v8i64>; // 8 x i64
251def llvm_v16i64_ty : LLVMType<v16i64>; // 16 x i64
252def llvm_v32i64_ty : LLVMType<v32i64>; // 32 x i64
253
254def llvm_v1i128_ty : LLVMType<v1i128>; // 1 x i128
255
256def llvm_v2f16_ty : LLVMType<v2f16>; // 2 x half (__fp16)
257def llvm_v4f16_ty : LLVMType<v4f16>; // 4 x half (__fp16)
258def llvm_v8f16_ty : LLVMType<v8f16>; // 8 x half (__fp16)
259def llvm_v1f32_ty : LLVMType<v1f32>; // 1 x float
260def llvm_v2f32_ty : LLVMType<v2f32>; // 2 x float
261def llvm_v4f32_ty : LLVMType<v4f32>; // 4 x float
262def llvm_v8f32_ty : LLVMType<v8f32>; // 8 x float
263def llvm_v16f32_ty : LLVMType<v16f32>; // 16 x float
264def llvm_v1f64_ty : LLVMType<v1f64>; // 1 x double
265def llvm_v2f64_ty : LLVMType<v2f64>; // 2 x double
266def llvm_v4f64_ty : LLVMType<v4f64>; // 4 x double
267def llvm_v8f64_ty : LLVMType<v8f64>; // 8 x double
268
269def llvm_vararg_ty : LLVMType<isVoid>; // this means vararg here
270
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100271//===----------------------------------------------------------------------===//
272// Intrinsic Definitions.
273//===----------------------------------------------------------------------===//
274
275// Intrinsic class - This is used to define one LLVM intrinsic. The name of the
276// intrinsic definition should start with "int_", then match the LLVM intrinsic
277// name with the "llvm." prefix removed, and all "."s turned into "_"s. For
278// example, llvm.bswap.i16 -> int_bswap_i16.
279//
280// * RetTypes is a list containing the return types expected for the
281// intrinsic.
282// * ParamTypes is a list containing the parameter types expected for the
283// intrinsic.
284// * Properties can be set to describe the behavior of the intrinsic.
285//
286class Intrinsic<list<LLVMType> ret_types,
287 list<LLVMType> param_types = [],
288 list<IntrinsicProperty> intr_properties = [],
289 string name = "",
290 list<SDNodeProperty> sd_properties = []> : SDPatternOperator {
291 string LLVMName = name;
292 string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
293 list<LLVMType> RetTypes = ret_types;
294 list<LLVMType> ParamTypes = param_types;
295 list<IntrinsicProperty> IntrProperties = intr_properties;
296 let Properties = sd_properties;
297
298 bit isTarget = 0;
299}
300
301/// GCCBuiltin - If this intrinsic exactly corresponds to a GCC builtin, this
302/// specifies the name of the builtin. This provides automatic CBE and CFE
303/// support.
304class GCCBuiltin<string name> {
305 string GCCBuiltinName = name;
306}
307
308class MSBuiltin<string name> {
309 string MSBuiltinName = name;
310}
311
312
313//===--------------- Variable Argument Handling Intrinsics ----------------===//
314//
315
316def int_vastart : Intrinsic<[], [llvm_ptr_ty], [], "llvm.va_start">;
317def int_vacopy : Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty], [],
318 "llvm.va_copy">;
319def int_vaend : Intrinsic<[], [llvm_ptr_ty], [], "llvm.va_end">;
320
321//===------------------- Garbage Collection Intrinsics --------------------===//
322//
323def int_gcroot : Intrinsic<[],
324 [llvm_ptrptr_ty, llvm_ptr_ty]>;
325def int_gcread : Intrinsic<[llvm_ptr_ty],
326 [llvm_ptr_ty, llvm_ptrptr_ty],
327 [IntrReadMem, IntrArgMemOnly]>;
328def int_gcwrite : Intrinsic<[],
329 [llvm_ptr_ty, llvm_ptr_ty, llvm_ptrptr_ty],
330 [IntrArgMemOnly, NoCapture<1>, NoCapture<2>]>;
331
Andrew Walbran16937d02019-10-22 13:54:20 +0100332//===------------------- ObjC ARC runtime Intrinsics --------------------===//
333//
334// Note these are to support the Objective-C ARC optimizer which wants to
335// eliminate retain and releases where possible.
336
337def int_objc_autorelease : Intrinsic<[llvm_ptr_ty],
338 [llvm_ptr_ty]>;
339def int_objc_autoreleasePoolPop : Intrinsic<[], [llvm_ptr_ty]>;
340def int_objc_autoreleasePoolPush : Intrinsic<[llvm_ptr_ty], []>;
341def int_objc_autoreleaseReturnValue : Intrinsic<[llvm_ptr_ty],
342 [llvm_ptr_ty]>;
343def int_objc_copyWeak : Intrinsic<[],
344 [llvm_ptrptr_ty,
345 llvm_ptrptr_ty]>;
346def int_objc_destroyWeak : Intrinsic<[], [llvm_ptrptr_ty]>;
347def int_objc_initWeak : Intrinsic<[llvm_ptr_ty],
348 [llvm_ptrptr_ty,
349 llvm_ptr_ty]>;
350def int_objc_loadWeak : Intrinsic<[llvm_ptr_ty],
351 [llvm_ptrptr_ty]>;
352def int_objc_loadWeakRetained : Intrinsic<[llvm_ptr_ty],
353 [llvm_ptrptr_ty]>;
354def int_objc_moveWeak : Intrinsic<[],
355 [llvm_ptrptr_ty,
356 llvm_ptrptr_ty]>;
357def int_objc_release : Intrinsic<[], [llvm_ptr_ty]>;
358def int_objc_retain : Intrinsic<[llvm_ptr_ty],
359 [llvm_ptr_ty]>;
360def int_objc_retainAutorelease : Intrinsic<[llvm_ptr_ty],
361 [llvm_ptr_ty]>;
362def int_objc_retainAutoreleaseReturnValue : Intrinsic<[llvm_ptr_ty],
363 [llvm_ptr_ty]>;
364def int_objc_retainAutoreleasedReturnValue : Intrinsic<[llvm_ptr_ty],
365 [llvm_ptr_ty]>;
366def int_objc_retainBlock : Intrinsic<[llvm_ptr_ty],
367 [llvm_ptr_ty]>;
368def int_objc_storeStrong : Intrinsic<[],
369 [llvm_ptrptr_ty,
370 llvm_ptr_ty]>;
371def int_objc_storeWeak : Intrinsic<[llvm_ptr_ty],
372 [llvm_ptrptr_ty,
373 llvm_ptr_ty]>;
374def int_objc_clang_arc_use : Intrinsic<[],
375 [llvm_vararg_ty]>;
376def int_objc_unsafeClaimAutoreleasedReturnValue : Intrinsic<[llvm_ptr_ty],
377 [llvm_ptr_ty]>;
378def int_objc_retainedObject : Intrinsic<[llvm_ptr_ty],
379 [llvm_ptr_ty]>;
380def int_objc_unretainedObject : Intrinsic<[llvm_ptr_ty],
381 [llvm_ptr_ty]>;
382def int_objc_unretainedPointer : Intrinsic<[llvm_ptr_ty],
383 [llvm_ptr_ty]>;
384def int_objc_retain_autorelease : Intrinsic<[llvm_ptr_ty],
385 [llvm_ptr_ty]>;
386def int_objc_sync_enter : Intrinsic<[llvm_i32_ty],
387 [llvm_ptr_ty]>;
388def int_objc_sync_exit : Intrinsic<[llvm_i32_ty],
389 [llvm_ptr_ty]>;
390def int_objc_arc_annotation_topdown_bbstart : Intrinsic<[],
391 [llvm_ptrptr_ty,
392 llvm_ptrptr_ty]>;
393def int_objc_arc_annotation_topdown_bbend : Intrinsic<[],
394 [llvm_ptrptr_ty,
395 llvm_ptrptr_ty]>;
396def int_objc_arc_annotation_bottomup_bbstart : Intrinsic<[],
397 [llvm_ptrptr_ty,
398 llvm_ptrptr_ty]>;
399def int_objc_arc_annotation_bottomup_bbend : Intrinsic<[],
400 [llvm_ptrptr_ty,
401 llvm_ptrptr_ty]>;
402
403
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100404//===--------------------- Code Generator Intrinsics ----------------------===//
405//
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100406def int_returnaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem, ImmArg<0>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100407def int_addressofreturnaddress : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100408def int_frameaddress : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty], [IntrNoMem, ImmArg<0>]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100409def int_sponentry : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100410def int_read_register : Intrinsic<[llvm_anyint_ty], [llvm_metadata_ty],
411 [IntrReadMem], "llvm.read_register">;
412def int_write_register : Intrinsic<[], [llvm_metadata_ty, llvm_anyint_ty],
413 [], "llvm.write_register">;
414
415// Gets the address of the local variable area. This is typically a copy of the
416// stack, frame, or base pointer depending on the type of prologue.
417def int_localaddress : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
418
419// Escapes local variables to allow access from other functions.
420def int_localescape : Intrinsic<[], [llvm_vararg_ty]>;
421
422// Given a function and the localaddress of a parent frame, returns a pointer
423// to an escaped allocation indicated by the index.
424def int_localrecover : Intrinsic<[llvm_ptr_ty],
425 [llvm_ptr_ty, llvm_ptr_ty, llvm_i32_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100426 [IntrNoMem, ImmArg<2>]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100427
428// Given the frame pointer passed into an SEH filter function, returns a
429// pointer to the local variable area suitable for use with llvm.localrecover.
430def int_eh_recoverfp : Intrinsic<[llvm_ptr_ty],
431 [llvm_ptr_ty, llvm_ptr_ty],
432 [IntrNoMem]>;
433
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100434// Note: we treat stacksave/stackrestore as writemem because we don't otherwise
435// model their dependencies on allocas.
436def int_stacksave : Intrinsic<[llvm_ptr_ty]>,
437 GCCBuiltin<"__builtin_stack_save">;
438def int_stackrestore : Intrinsic<[], [llvm_ptr_ty]>,
439 GCCBuiltin<"__builtin_stack_restore">;
440
441def int_get_dynamic_area_offset : Intrinsic<[llvm_anyint_ty]>;
442
443def int_thread_pointer : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>,
444 GCCBuiltin<"__builtin_thread_pointer">;
445
446// IntrInaccessibleMemOrArgMemOnly is a little more pessimistic than strictly
447// necessary for prefetch, however it does conveniently prevent the prefetch
448// from being reordered overly much with respect to nearby access to the same
449// memory while not impeding optimization.
450def int_prefetch
451 : Intrinsic<[], [ llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty ],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100452 [ IntrInaccessibleMemOrArgMemOnly, ReadOnly<0>, NoCapture<0>,
453 ImmArg<1>, ImmArg<2>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100454def int_pcmarker : Intrinsic<[], [llvm_i32_ty]>;
455
456def int_readcyclecounter : Intrinsic<[llvm_i64_ty]>;
457
458// The assume intrinsic is marked as arbitrarily writing so that proper
459// control dependencies will be maintained.
460def int_assume : Intrinsic<[], [llvm_i1_ty], []>;
461
462// Stack Protector Intrinsic - The stackprotector intrinsic writes the stack
463// guard to the correct place on the stack frame.
464def int_stackprotector : Intrinsic<[], [llvm_ptr_ty, llvm_ptrptr_ty], []>;
465def int_stackguard : Intrinsic<[llvm_ptr_ty], [], []>;
466
467// A counter increment for instrumentation based profiling.
468def int_instrprof_increment : Intrinsic<[],
469 [llvm_ptr_ty, llvm_i64_ty,
470 llvm_i32_ty, llvm_i32_ty],
471 []>;
472
473// A counter increment with step for instrumentation based profiling.
474def int_instrprof_increment_step : Intrinsic<[],
475 [llvm_ptr_ty, llvm_i64_ty,
476 llvm_i32_ty, llvm_i32_ty, llvm_i64_ty],
477 []>;
478
479// A call to profile runtime for value profiling of target expressions
480// through instrumentation based profiling.
481def int_instrprof_value_profile : Intrinsic<[],
482 [llvm_ptr_ty, llvm_i64_ty,
483 llvm_i64_ty, llvm_i32_ty,
484 llvm_i32_ty],
485 []>;
486
487//===------------------- Standard C Library Intrinsics --------------------===//
488//
489
490def int_memcpy : Intrinsic<[],
491 [llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
492 llvm_i1_ty],
493 [IntrArgMemOnly, NoCapture<0>, NoCapture<1>,
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100494 WriteOnly<0>, ReadOnly<1>, ImmArg<3>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100495def int_memmove : Intrinsic<[],
496 [llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
497 llvm_i1_ty],
498 [IntrArgMemOnly, NoCapture<0>, NoCapture<1>,
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100499 ReadOnly<1>, ImmArg<3>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100500def int_memset : Intrinsic<[],
501 [llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty,
502 llvm_i1_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100503 [IntrArgMemOnly, NoCapture<0>, WriteOnly<0>,
504 ImmArg<3>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100505
506// FIXME: Add version of these floating point intrinsics which allow non-default
507// rounding modes and FP exception handling.
508
509let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
510 def int_fma : Intrinsic<[llvm_anyfloat_ty],
511 [LLVMMatchType<0>, LLVMMatchType<0>,
512 LLVMMatchType<0>]>;
513 def int_fmuladd : Intrinsic<[llvm_anyfloat_ty],
514 [LLVMMatchType<0>, LLVMMatchType<0>,
515 LLVMMatchType<0>]>;
516
517 // These functions do not read memory, but are sensitive to the
518 // rounding mode. LLVM purposely does not model changes to the FP
519 // environment so they can be treated as readnone.
520 def int_sqrt : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
521 def int_powi : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_i32_ty]>;
522 def int_sin : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
523 def int_cos : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
524 def int_pow : Intrinsic<[llvm_anyfloat_ty],
525 [LLVMMatchType<0>, LLVMMatchType<0>]>;
526 def int_log : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
527 def int_log10: Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
528 def int_log2 : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
529 def int_exp : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
530 def int_exp2 : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
531 def int_fabs : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
532 def int_copysign : Intrinsic<[llvm_anyfloat_ty],
533 [LLVMMatchType<0>, LLVMMatchType<0>]>;
534 def int_floor : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
535 def int_ceil : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
536 def int_trunc : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
537 def int_rint : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
538 def int_nearbyint : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
539 def int_round : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
540 def int_canonicalize : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
541 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100542
543 def int_lround : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
544 def int_llround : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
545 def int_lrint : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
546 def int_llrint : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100547}
548
549def int_minnum : Intrinsic<[llvm_anyfloat_ty],
550 [LLVMMatchType<0>, LLVMMatchType<0>],
551 [IntrNoMem, IntrSpeculatable, Commutative]
552>;
553def int_maxnum : Intrinsic<[llvm_anyfloat_ty],
554 [LLVMMatchType<0>, LLVMMatchType<0>],
555 [IntrNoMem, IntrSpeculatable, Commutative]
556>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100557def int_minimum : Intrinsic<[llvm_anyfloat_ty],
558 [LLVMMatchType<0>, LLVMMatchType<0>],
559 [IntrNoMem, IntrSpeculatable, Commutative]
560>;
561def int_maximum : Intrinsic<[llvm_anyfloat_ty],
562 [LLVMMatchType<0>, LLVMMatchType<0>],
563 [IntrNoMem, IntrSpeculatable, Commutative]
564>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100565
566// NOTE: these are internal interfaces.
567def int_setjmp : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty]>;
568def int_longjmp : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrNoReturn]>;
569def int_sigsetjmp : Intrinsic<[llvm_i32_ty] , [llvm_ptr_ty, llvm_i32_ty]>;
570def int_siglongjmp : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrNoReturn]>;
571
572// Internal interface for object size checking
573def int_objectsize : Intrinsic<[llvm_anyint_ty],
Andrew Walbran16937d02019-10-22 13:54:20 +0100574 [llvm_anyptr_ty, llvm_i1_ty,
575 llvm_i1_ty, llvm_i1_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100576 [IntrNoMem, IntrSpeculatable, ImmArg<1>, ImmArg<2>, ImmArg<3>]>,
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100577 GCCBuiltin<"__builtin_object_size">;
578
579//===--------------- Constrained Floating Point Intrinsics ----------------===//
580//
581
582let IntrProperties = [IntrInaccessibleMemOnly] in {
583 def int_experimental_constrained_fadd : Intrinsic<[ llvm_anyfloat_ty ],
584 [ LLVMMatchType<0>,
585 LLVMMatchType<0>,
586 llvm_metadata_ty,
587 llvm_metadata_ty ]>;
588 def int_experimental_constrained_fsub : Intrinsic<[ llvm_anyfloat_ty ],
589 [ LLVMMatchType<0>,
590 LLVMMatchType<0>,
591 llvm_metadata_ty,
592 llvm_metadata_ty ]>;
593 def int_experimental_constrained_fmul : Intrinsic<[ llvm_anyfloat_ty ],
594 [ LLVMMatchType<0>,
595 LLVMMatchType<0>,
596 llvm_metadata_ty,
597 llvm_metadata_ty ]>;
598 def int_experimental_constrained_fdiv : Intrinsic<[ llvm_anyfloat_ty ],
599 [ LLVMMatchType<0>,
600 LLVMMatchType<0>,
601 llvm_metadata_ty,
602 llvm_metadata_ty ]>;
603 def int_experimental_constrained_frem : Intrinsic<[ llvm_anyfloat_ty ],
604 [ LLVMMatchType<0>,
605 LLVMMatchType<0>,
606 llvm_metadata_ty,
607 llvm_metadata_ty ]>;
608
609 def int_experimental_constrained_fma : Intrinsic<[ llvm_anyfloat_ty ],
610 [ LLVMMatchType<0>,
611 LLVMMatchType<0>,
612 LLVMMatchType<0>,
613 llvm_metadata_ty,
614 llvm_metadata_ty ]>;
615
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100616 def int_experimental_constrained_fptrunc : Intrinsic<[ llvm_anyfloat_ty ],
617 [ llvm_anyfloat_ty,
618 llvm_metadata_ty,
619 llvm_metadata_ty ]>;
620
621 def int_experimental_constrained_fpext : Intrinsic<[ llvm_anyfloat_ty ],
622 [ llvm_anyfloat_ty,
623 llvm_metadata_ty ]>;
624
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100625 // These intrinsics are sensitive to the rounding mode so we need constrained
626 // versions of each of them. When strict rounding and exception control are
627 // not required the non-constrained versions of these intrinsics should be
628 // used.
629 def int_experimental_constrained_sqrt : Intrinsic<[ llvm_anyfloat_ty ],
630 [ LLVMMatchType<0>,
631 llvm_metadata_ty,
632 llvm_metadata_ty ]>;
633 def int_experimental_constrained_powi : Intrinsic<[ llvm_anyfloat_ty ],
634 [ LLVMMatchType<0>,
635 llvm_i32_ty,
636 llvm_metadata_ty,
637 llvm_metadata_ty ]>;
638 def int_experimental_constrained_sin : Intrinsic<[ llvm_anyfloat_ty ],
639 [ LLVMMatchType<0>,
640 llvm_metadata_ty,
641 llvm_metadata_ty ]>;
642 def int_experimental_constrained_cos : Intrinsic<[ llvm_anyfloat_ty ],
643 [ LLVMMatchType<0>,
644 llvm_metadata_ty,
645 llvm_metadata_ty ]>;
646 def int_experimental_constrained_pow : Intrinsic<[ llvm_anyfloat_ty ],
647 [ LLVMMatchType<0>,
648 LLVMMatchType<0>,
649 llvm_metadata_ty,
650 llvm_metadata_ty ]>;
651 def int_experimental_constrained_log : Intrinsic<[ llvm_anyfloat_ty ],
652 [ LLVMMatchType<0>,
653 llvm_metadata_ty,
654 llvm_metadata_ty ]>;
655 def int_experimental_constrained_log10: Intrinsic<[ llvm_anyfloat_ty ],
656 [ LLVMMatchType<0>,
657 llvm_metadata_ty,
658 llvm_metadata_ty ]>;
659 def int_experimental_constrained_log2 : Intrinsic<[ llvm_anyfloat_ty ],
660 [ LLVMMatchType<0>,
661 llvm_metadata_ty,
662 llvm_metadata_ty ]>;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100663 def int_experimental_constrained_exp : Intrinsic<[ llvm_anyfloat_ty ],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100664 [ LLVMMatchType<0>,
665 llvm_metadata_ty,
666 llvm_metadata_ty ]>;
667 def int_experimental_constrained_exp2 : Intrinsic<[ llvm_anyfloat_ty ],
668 [ LLVMMatchType<0>,
669 llvm_metadata_ty,
670 llvm_metadata_ty ]>;
671 def int_experimental_constrained_rint : Intrinsic<[ llvm_anyfloat_ty ],
672 [ LLVMMatchType<0>,
673 llvm_metadata_ty,
674 llvm_metadata_ty ]>;
675 def int_experimental_constrained_nearbyint : Intrinsic<[ llvm_anyfloat_ty ],
676 [ LLVMMatchType<0>,
677 llvm_metadata_ty,
678 llvm_metadata_ty ]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100679 def int_experimental_constrained_maxnum : Intrinsic<[ llvm_anyfloat_ty ],
680 [ LLVMMatchType<0>,
681 LLVMMatchType<0>,
682 llvm_metadata_ty,
683 llvm_metadata_ty ]>;
684 def int_experimental_constrained_minnum : Intrinsic<[ llvm_anyfloat_ty ],
685 [ LLVMMatchType<0>,
686 LLVMMatchType<0>,
687 llvm_metadata_ty,
688 llvm_metadata_ty ]>;
689 def int_experimental_constrained_ceil : Intrinsic<[ llvm_anyfloat_ty ],
690 [ LLVMMatchType<0>,
691 llvm_metadata_ty,
692 llvm_metadata_ty ]>;
693 def int_experimental_constrained_floor : Intrinsic<[ llvm_anyfloat_ty ],
694 [ LLVMMatchType<0>,
695 llvm_metadata_ty,
696 llvm_metadata_ty ]>;
697 def int_experimental_constrained_round : Intrinsic<[ llvm_anyfloat_ty ],
698 [ LLVMMatchType<0>,
699 llvm_metadata_ty,
700 llvm_metadata_ty ]>;
701 def int_experimental_constrained_trunc : Intrinsic<[ llvm_anyfloat_ty ],
702 [ LLVMMatchType<0>,
703 llvm_metadata_ty,
704 llvm_metadata_ty ]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100705}
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100706// FIXME: Add intrinsics for fcmp, fptoui and fptosi.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100707
708//===------------------------- Expect Intrinsics --------------------------===//
709//
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100710def int_expect : Intrinsic<[llvm_anyint_ty],
711 [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100712
713//===-------------------- Bit Manipulation Intrinsics ---------------------===//
714//
715
716// None of these intrinsics accesses memory at all.
717let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
718 def int_bswap: Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
719 def int_ctpop: Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100720 def int_bitreverse : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>]>;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100721 def int_fshl : Intrinsic<[llvm_anyint_ty],
722 [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>]>;
723 def int_fshr : Intrinsic<[llvm_anyint_ty],
724 [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100725}
726
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100727let IntrProperties = [IntrNoMem, IntrSpeculatable, ImmArg<1>] in {
728 def int_ctlz : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, llvm_i1_ty]>;
729 def int_cttz : Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, llvm_i1_ty]>;
730}
731
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100732//===------------------------ Debugger Intrinsics -------------------------===//
733//
734
735// None of these intrinsics accesses memory at all...but that doesn't
736// mean the optimizers can change them aggressively. Special handling
737// needed in a few places. These synthetic intrinsics have no
738// side-effects and just mark information about their operands.
739let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
740 def int_dbg_declare : Intrinsic<[],
741 [llvm_metadata_ty,
742 llvm_metadata_ty,
743 llvm_metadata_ty]>;
744 def int_dbg_value : Intrinsic<[],
745 [llvm_metadata_ty,
746 llvm_metadata_ty,
747 llvm_metadata_ty]>;
748 def int_dbg_addr : Intrinsic<[],
749 [llvm_metadata_ty,
750 llvm_metadata_ty,
751 llvm_metadata_ty]>;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100752 def int_dbg_label : Intrinsic<[],
753 [llvm_metadata_ty]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100754}
755
756//===------------------ Exception Handling Intrinsics----------------------===//
757//
758
759// The result of eh.typeid.for depends on the enclosing function, but inside a
760// given function it is 'const' and may be CSE'd etc.
761def int_eh_typeid_for : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty], [IntrNoMem]>;
762
763def int_eh_return_i32 : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty]>;
764def int_eh_return_i64 : Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty]>;
765
766// eh.exceptionpointer returns the pointer to the exception caught by
767// the given `catchpad`.
768def int_eh_exceptionpointer : Intrinsic<[llvm_anyptr_ty], [llvm_token_ty],
769 [IntrNoMem]>;
770
771// Gets the exception code from a catchpad token. Only used on some platforms.
772def int_eh_exceptioncode : Intrinsic<[llvm_i32_ty], [llvm_token_ty], [IntrNoMem]>;
773
774// __builtin_unwind_init is an undocumented GCC intrinsic that causes all
775// callee-saved registers to be saved and restored (regardless of whether they
776// are used) in the calling function. It is used by libgcc_eh.
777def int_eh_unwind_init: Intrinsic<[]>,
778 GCCBuiltin<"__builtin_unwind_init">;
779
780def int_eh_dwarf_cfa : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty]>;
781
782let IntrProperties = [IntrNoMem] in {
783 def int_eh_sjlj_lsda : Intrinsic<[llvm_ptr_ty]>;
784 def int_eh_sjlj_callsite : Intrinsic<[], [llvm_i32_ty]>;
785}
786def int_eh_sjlj_functioncontext : Intrinsic<[], [llvm_ptr_ty]>;
787def int_eh_sjlj_setjmp : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty]>;
788def int_eh_sjlj_longjmp : Intrinsic<[], [llvm_ptr_ty], [IntrNoReturn]>;
789def int_eh_sjlj_setup_dispatch : Intrinsic<[], []>;
790
791//===---------------- Generic Variable Attribute Intrinsics----------------===//
792//
793def int_var_annotation : Intrinsic<[],
794 [llvm_ptr_ty, llvm_ptr_ty,
795 llvm_ptr_ty, llvm_i32_ty],
796 [], "llvm.var.annotation">;
797def int_ptr_annotation : Intrinsic<[LLVMAnyPointerType<llvm_anyint_ty>],
798 [LLVMMatchType<0>, llvm_ptr_ty, llvm_ptr_ty,
799 llvm_i32_ty],
800 [], "llvm.ptr.annotation">;
801def int_annotation : Intrinsic<[llvm_anyint_ty],
802 [LLVMMatchType<0>, llvm_ptr_ty,
803 llvm_ptr_ty, llvm_i32_ty],
804 [], "llvm.annotation">;
805
806// Annotates the current program point with metadata strings which are emitted
807// as CodeView debug info records. This is expensive, as it disables inlining
808// and is modelled as having side effects.
809def int_codeview_annotation : Intrinsic<[], [llvm_metadata_ty],
810 [IntrInaccessibleMemOnly, IntrNoDuplicate],
811 "llvm.codeview.annotation">;
812
813//===------------------------ Trampoline Intrinsics -----------------------===//
814//
815def int_init_trampoline : Intrinsic<[],
816 [llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
817 [IntrArgMemOnly, NoCapture<0>]>,
818 GCCBuiltin<"__builtin_init_trampoline">;
819
820def int_adjust_trampoline : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty],
821 [IntrReadMem, IntrArgMemOnly]>,
822 GCCBuiltin<"__builtin_adjust_trampoline">;
823
824//===------------------------ Overflow Intrinsics -------------------------===//
825//
826
827// Expose the carry flag from add operations on two integrals.
Andrew Walbran16937d02019-10-22 13:54:20 +0100828def int_sadd_with_overflow : Intrinsic<[llvm_anyint_ty,
829 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100830 [LLVMMatchType<0>, LLVMMatchType<0>],
831 [IntrNoMem, IntrSpeculatable]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100832def int_uadd_with_overflow : Intrinsic<[llvm_anyint_ty,
833 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100834 [LLVMMatchType<0>, LLVMMatchType<0>],
835 [IntrNoMem, IntrSpeculatable]>;
836
Andrew Walbran16937d02019-10-22 13:54:20 +0100837def int_ssub_with_overflow : Intrinsic<[llvm_anyint_ty,
838 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100839 [LLVMMatchType<0>, LLVMMatchType<0>],
840 [IntrNoMem, IntrSpeculatable]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100841def int_usub_with_overflow : Intrinsic<[llvm_anyint_ty,
842 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100843 [LLVMMatchType<0>, LLVMMatchType<0>],
844 [IntrNoMem, IntrSpeculatable]>;
845
Andrew Walbran16937d02019-10-22 13:54:20 +0100846def int_smul_with_overflow : Intrinsic<[llvm_anyint_ty,
847 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100848 [LLVMMatchType<0>, LLVMMatchType<0>],
849 [IntrNoMem, IntrSpeculatable]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100850def int_umul_with_overflow : Intrinsic<[llvm_anyint_ty,
851 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100852 [LLVMMatchType<0>, LLVMMatchType<0>],
853 [IntrNoMem, IntrSpeculatable]>;
854
Andrew Walbran16937d02019-10-22 13:54:20 +0100855//===------------------------- Saturation Arithmetic Intrinsics ---------------------===//
856//
857def int_sadd_sat : Intrinsic<[llvm_anyint_ty],
858 [LLVMMatchType<0>, LLVMMatchType<0>],
859 [IntrNoMem, IntrSpeculatable, Commutative]>;
860def int_uadd_sat : Intrinsic<[llvm_anyint_ty],
861 [LLVMMatchType<0>, LLVMMatchType<0>],
862 [IntrNoMem, IntrSpeculatable, Commutative]>;
863def int_ssub_sat : Intrinsic<[llvm_anyint_ty],
864 [LLVMMatchType<0>, LLVMMatchType<0>],
865 [IntrNoMem, IntrSpeculatable]>;
866def int_usub_sat : Intrinsic<[llvm_anyint_ty],
867 [LLVMMatchType<0>, LLVMMatchType<0>],
868 [IntrNoMem, IntrSpeculatable]>;
869
870//===------------------------- Fixed Point Arithmetic Intrinsics ---------------------===//
871//
872def int_smul_fix : Intrinsic<[llvm_anyint_ty],
873 [LLVMMatchType<0>, LLVMMatchType<0>, llvm_i32_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100874 [IntrNoMem, IntrSpeculatable, Commutative, ImmArg<2>]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100875
876def int_umul_fix : Intrinsic<[llvm_anyint_ty],
877 [LLVMMatchType<0>, LLVMMatchType<0>, llvm_i32_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100878 [IntrNoMem, IntrSpeculatable, Commutative, ImmArg<2>]>;
879
880//===------------------- Fixed Point Saturation Arithmetic Intrinsics ----------------===//
881//
882def int_smul_fix_sat : Intrinsic<[llvm_anyint_ty],
883 [LLVMMatchType<0>, LLVMMatchType<0>, llvm_i32_ty],
884 [IntrNoMem, IntrSpeculatable, Commutative, ImmArg<2>]>;
Andrew Walbran16937d02019-10-22 13:54:20 +0100885
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100886//===------------------------- Memory Use Markers -------------------------===//
887//
888def int_lifetime_start : Intrinsic<[],
889 [llvm_i64_ty, llvm_anyptr_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100890 [IntrArgMemOnly, NoCapture<1>, ImmArg<0>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100891def int_lifetime_end : Intrinsic<[],
892 [llvm_i64_ty, llvm_anyptr_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100893 [IntrArgMemOnly, NoCapture<1>, ImmArg<0>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100894def int_invariant_start : Intrinsic<[llvm_descriptor_ty],
895 [llvm_i64_ty, llvm_anyptr_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100896 [IntrArgMemOnly, NoCapture<1>, ImmArg<0>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100897def int_invariant_end : Intrinsic<[],
898 [llvm_descriptor_ty, llvm_i64_ty,
899 llvm_anyptr_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100900 [IntrArgMemOnly, NoCapture<2>, ImmArg<1>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100901
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100902// launder.invariant.group can't be marked with 'readnone' (IntrNoMem),
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100903// because it would cause CSE of two barriers with the same argument.
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100904// Inaccessiblememonly says that the barrier doesn't read the argument,
905// but it changes state not accessible to this module. This way
906// we can DSE through the barrier because it doesn't read the value
907// after store. Although the barrier doesn't modify any memory it
908// can't be marked as readonly, because it would be possible to
909// CSE 2 barriers with store in between.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100910// The argument also can't be marked with 'returned' attribute, because
911// it would remove barrier.
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100912// Note that it is still experimental, which means that its semantics
913// might change in the future.
914def int_launder_invariant_group : Intrinsic<[llvm_anyptr_ty],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100915 [LLVMMatchType<0>],
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100916 [IntrInaccessibleMemOnly, IntrSpeculatable]>;
917
918
919def int_strip_invariant_group : Intrinsic<[llvm_anyptr_ty],
920 [LLVMMatchType<0>],
921 [IntrSpeculatable, IntrNoMem]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100922
923//===------------------------ Stackmap Intrinsics -------------------------===//
924//
925def int_experimental_stackmap : Intrinsic<[],
926 [llvm_i64_ty, llvm_i32_ty, llvm_vararg_ty],
927 [Throws]>;
928def int_experimental_patchpoint_void : Intrinsic<[],
929 [llvm_i64_ty, llvm_i32_ty,
930 llvm_ptr_ty, llvm_i32_ty,
931 llvm_vararg_ty],
932 [Throws]>;
933def int_experimental_patchpoint_i64 : Intrinsic<[llvm_i64_ty],
934 [llvm_i64_ty, llvm_i32_ty,
935 llvm_ptr_ty, llvm_i32_ty,
936 llvm_vararg_ty],
937 [Throws]>;
938
939
940//===------------------------ Garbage Collection Intrinsics ---------------===//
941// These are documented in docs/Statepoint.rst
942
943def int_experimental_gc_statepoint : Intrinsic<[llvm_token_ty],
944 [llvm_i64_ty, llvm_i32_ty,
945 llvm_anyptr_ty, llvm_i32_ty,
946 llvm_i32_ty, llvm_vararg_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100947 [Throws, ImmArg<0>, ImmArg<1>, ImmArg<3>, ImmArg<4>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100948
949def int_experimental_gc_result : Intrinsic<[llvm_any_ty], [llvm_token_ty],
950 [IntrReadMem]>;
951def int_experimental_gc_relocate : Intrinsic<[llvm_any_ty],
952 [llvm_token_ty, llvm_i32_ty, llvm_i32_ty],
Andrew Walbran3d2c1972020-04-07 12:24:26 +0100953 [IntrReadMem, ImmArg<1>, ImmArg<2>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100954
955//===------------------------ Coroutine Intrinsics ---------------===//
956// These are documented in docs/Coroutines.rst
957
958// Coroutine Structure Intrinsics.
959
960def int_coro_id : Intrinsic<[llvm_token_ty], [llvm_i32_ty, llvm_ptr_ty,
961 llvm_ptr_ty, llvm_ptr_ty],
962 [IntrArgMemOnly, IntrReadMem,
963 ReadNone<1>, ReadOnly<2>, NoCapture<2>]>;
964def int_coro_alloc : Intrinsic<[llvm_i1_ty], [llvm_token_ty], []>;
965def int_coro_begin : Intrinsic<[llvm_ptr_ty], [llvm_token_ty, llvm_ptr_ty],
966 [WriteOnly<1>]>;
967
968def int_coro_free : Intrinsic<[llvm_ptr_ty], [llvm_token_ty, llvm_ptr_ty],
969 [IntrReadMem, IntrArgMemOnly, ReadOnly<1>,
970 NoCapture<1>]>;
971def int_coro_end : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_i1_ty], []>;
972
973def int_coro_frame : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100974def int_coro_noop : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100975def int_coro_size : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;
976
977def int_coro_save : Intrinsic<[llvm_token_ty], [llvm_ptr_ty], []>;
978def int_coro_suspend : Intrinsic<[llvm_i8_ty], [llvm_token_ty, llvm_i1_ty], []>;
979
980def int_coro_param : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_ptr_ty],
981 [IntrNoMem, ReadNone<0>, ReadNone<1>]>;
982
983// Coroutine Manipulation Intrinsics.
984
985def int_coro_resume : Intrinsic<[], [llvm_ptr_ty], [Throws]>;
986def int_coro_destroy : Intrinsic<[], [llvm_ptr_ty], [Throws]>;
987def int_coro_done : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty],
988 [IntrArgMemOnly, ReadOnly<0>, NoCapture<0>]>;
989def int_coro_promise : Intrinsic<[llvm_ptr_ty],
990 [llvm_ptr_ty, llvm_i32_ty, llvm_i1_ty],
991 [IntrNoMem, NoCapture<0>]>;
992
993// Coroutine Lowering Intrinsics. Used internally by coroutine passes.
994
995def int_coro_subfn_addr : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty, llvm_i8_ty],
996 [IntrReadMem, IntrArgMemOnly, ReadOnly<0>,
997 NoCapture<0>]>;
998
999///===-------------------------- Other Intrinsics --------------------------===//
1000//
1001def int_flt_rounds : Intrinsic<[llvm_i32_ty]>,
1002 GCCBuiltin<"__builtin_flt_rounds">;
Andrew Walbran16937d02019-10-22 13:54:20 +01001003def int_trap : Intrinsic<[], [], [IntrNoReturn, IntrCold]>,
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001004 GCCBuiltin<"__builtin_trap">;
1005def int_debugtrap : Intrinsic<[]>,
1006 GCCBuiltin<"__builtin_debugtrap">;
1007
1008// Support for dynamic deoptimization (or de-specialization)
1009def int_experimental_deoptimize : Intrinsic<[llvm_any_ty], [llvm_vararg_ty],
1010 [Throws]>;
1011
1012// Support for speculative runtime guards
1013def int_experimental_guard : Intrinsic<[], [llvm_i1_ty, llvm_vararg_ty],
1014 [Throws]>;
1015
Andrew Walbran16937d02019-10-22 13:54:20 +01001016// Supports widenable conditions for guards represented as explicit branches.
1017def int_experimental_widenable_condition : Intrinsic<[llvm_i1_ty], [],
1018 [IntrInaccessibleMemOnly]>;
1019
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001020// NOP: calls/invokes to this intrinsic are removed by codegen
1021def int_donothing : Intrinsic<[], [], [IntrNoMem]>;
1022
1023// This instruction has no actual effect, though it is treated by the optimizer
1024// has having opaque side effects. This may be inserted into loops to ensure
1025// that they are not removed even if they turn out to be empty, for languages
1026// which specify that infinite loops must be preserved.
1027def int_sideeffect : Intrinsic<[], [], [IntrInaccessibleMemOnly]>;
1028
1029// Intrisics to support half precision floating point format
1030let IntrProperties = [IntrNoMem] in {
1031def int_convert_to_fp16 : Intrinsic<[llvm_i16_ty], [llvm_anyfloat_ty]>;
1032def int_convert_from_fp16 : Intrinsic<[llvm_anyfloat_ty], [llvm_i16_ty]>;
1033}
1034
1035// Clear cache intrinsic, default to ignore (ie. emit nothing)
1036// maps to void __clear_cache() on supporting platforms
1037def int_clear_cache : Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty],
1038 [], "llvm.clear_cache">;
1039
Andrew Walbran16937d02019-10-22 13:54:20 +01001040// Intrinsic to detect whether its argument is a constant.
1041def int_is_constant : Intrinsic<[llvm_i1_ty], [llvm_any_ty], [IntrNoMem], "llvm.is.constant">;
1042
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001043//===-------------------------- Masked Intrinsics -------------------------===//
1044//
1045def int_masked_store : Intrinsic<[], [llvm_anyvector_ty,
1046 LLVMAnyPointerType<LLVMMatchType<0>>,
1047 llvm_i32_ty,
Andrew Walbran16937d02019-10-22 13:54:20 +01001048 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001049 [IntrArgMemOnly, ImmArg<2>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001050
1051def int_masked_load : Intrinsic<[llvm_anyvector_ty],
1052 [LLVMAnyPointerType<LLVMMatchType<0>>, llvm_i32_ty,
Andrew Walbran16937d02019-10-22 13:54:20 +01001053 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, LLVMMatchType<0>],
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001054 [IntrReadMem, IntrArgMemOnly, ImmArg<1>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001055
1056def int_masked_gather: Intrinsic<[llvm_anyvector_ty],
1057 [LLVMVectorOfAnyPointersToElt<0>, llvm_i32_ty,
Andrew Walbran16937d02019-10-22 13:54:20 +01001058 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001059 LLVMMatchType<0>],
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001060 [IntrReadMem, ImmArg<1>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001061
1062def int_masked_scatter: Intrinsic<[],
1063 [llvm_anyvector_ty,
1064 LLVMVectorOfAnyPointersToElt<0>, llvm_i32_ty,
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001065 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
1066 [ImmArg<2>]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001067
1068def int_masked_expandload: Intrinsic<[llvm_anyvector_ty],
1069 [LLVMPointerToElt<0>,
Andrew Walbran16937d02019-10-22 13:54:20 +01001070 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001071 LLVMMatchType<0>],
1072 [IntrReadMem]>;
1073
1074def int_masked_compressstore: Intrinsic<[],
1075 [llvm_anyvector_ty,
1076 LLVMPointerToElt<0>,
Andrew Walbran16937d02019-10-22 13:54:20 +01001077 LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001078 [IntrArgMemOnly]>;
1079
1080// Test whether a pointer is associated with a type metadata identifier.
1081def int_type_test : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_metadata_ty],
1082 [IntrNoMem]>;
1083
1084// Safely loads a function pointer from a virtual table pointer using type metadata.
1085def int_type_checked_load : Intrinsic<[llvm_ptr_ty, llvm_i1_ty],
1086 [llvm_ptr_ty, llvm_i32_ty, llvm_metadata_ty],
1087 [IntrNoMem]>;
1088
1089// Create a branch funnel that implements an indirect call to a limited set of
1090// callees. This needs to be a musttail call.
1091def int_icall_branch_funnel : Intrinsic<[], [llvm_vararg_ty], []>;
1092
1093def int_load_relative: Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty, llvm_anyint_ty],
1094 [IntrReadMem, IntrArgMemOnly]>;
1095
Andrew Walbran16937d02019-10-22 13:54:20 +01001096def int_hwasan_check_memaccess :
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001097 Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty, llvm_i32_ty], [IntrInaccessibleMemOnly, ImmArg<2>]>;
Andrew Walbran16937d02019-10-22 13:54:20 +01001098
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001099// Xray intrinsics
1100//===----------------------------------------------------------------------===//
1101// Custom event logging for x-ray.
1102// Takes a pointer to a string and the length of the string.
1103def int_xray_customevent : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
1104 [NoCapture<0>, ReadOnly<0>, IntrWriteMem]>;
Andrew Scullcdfcccc2018-10-05 20:58:37 +01001105// Typed event logging for x-ray.
1106// Takes a numeric type tag, a pointer to a string and the length of the string.
1107def int_xray_typedevent : Intrinsic<[], [llvm_i16_ty, llvm_ptr_ty, llvm_i32_ty],
1108 [NoCapture<1>, ReadOnly<1>, IntrWriteMem]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001109//===----------------------------------------------------------------------===//
1110
1111//===------ Memory intrinsics with element-wise atomicity guarantees ------===//
1112//
1113
1114// @llvm.memcpy.element.unordered.atomic.*(dest, src, length, elementsize)
1115def int_memcpy_element_unordered_atomic
1116 : Intrinsic<[],
1117 [
1118 llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty, llvm_i32_ty
1119 ],
1120 [
1121 IntrArgMemOnly, NoCapture<0>, NoCapture<1>, WriteOnly<0>,
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001122 ReadOnly<1>, ImmArg<3>
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001123 ]>;
1124
1125// @llvm.memmove.element.unordered.atomic.*(dest, src, length, elementsize)
1126def int_memmove_element_unordered_atomic
1127 : Intrinsic<[],
1128 [
1129 llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty, llvm_i32_ty
1130 ],
1131 [
1132 IntrArgMemOnly, NoCapture<0>, NoCapture<1>, WriteOnly<0>,
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001133 ReadOnly<1>, ImmArg<3>
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001134 ]>;
1135
1136// @llvm.memset.element.unordered.atomic.*(dest, value, length, elementsize)
1137def int_memset_element_unordered_atomic
1138 : Intrinsic<[], [ llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty, llvm_i32_ty ],
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001139 [ IntrArgMemOnly, NoCapture<0>, WriteOnly<0>, ImmArg<3> ]>;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001140
1141//===------------------------ Reduction Intrinsics ------------------------===//
1142//
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001143def int_experimental_vector_reduce_v2_fadd : Intrinsic<[llvm_anyfloat_ty],
1144 [LLVMMatchType<0>,
1145 llvm_anyvector_ty],
1146 [IntrNoMem]>;
1147def int_experimental_vector_reduce_v2_fmul : Intrinsic<[llvm_anyfloat_ty],
1148 [LLVMMatchType<0>,
1149 llvm_anyvector_ty],
1150 [IntrNoMem]>;
1151def int_experimental_vector_reduce_add : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001152 [llvm_anyvector_ty],
1153 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001154def int_experimental_vector_reduce_mul : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001155 [llvm_anyvector_ty],
1156 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001157def int_experimental_vector_reduce_and : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001158 [llvm_anyvector_ty],
1159 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001160def int_experimental_vector_reduce_or : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001161 [llvm_anyvector_ty],
1162 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001163def int_experimental_vector_reduce_xor : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001164 [llvm_anyvector_ty],
1165 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001166def int_experimental_vector_reduce_smax : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001167 [llvm_anyvector_ty],
1168 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001169def int_experimental_vector_reduce_smin : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001170 [llvm_anyvector_ty],
1171 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001172def int_experimental_vector_reduce_umax : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001173 [llvm_anyvector_ty],
1174 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001175def int_experimental_vector_reduce_umin : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001176 [llvm_anyvector_ty],
1177 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001178def int_experimental_vector_reduce_fmax : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001179 [llvm_anyvector_ty],
1180 [IntrNoMem]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001181def int_experimental_vector_reduce_fmin : Intrinsic<[LLVMVectorElementType<0>],
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001182 [llvm_anyvector_ty],
1183 [IntrNoMem]>;
1184
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001185//===---------- Intrinsics to control hardware supported loops ----------===//
1186
1187// Specify that the value given is the number of iterations that the next loop
1188// will execute.
1189def int_set_loop_iterations :
1190 Intrinsic<[], [llvm_anyint_ty], [IntrNoDuplicate]>;
1191
1192// Specify that the value given is the number of iterations that the next loop
1193// will execute. Also test that the given count is not zero, allowing it to
1194// control entry to a 'while' loop.
1195def int_test_set_loop_iterations :
1196 Intrinsic<[llvm_i1_ty], [llvm_anyint_ty], [IntrNoDuplicate]>;
1197
1198// Decrement loop counter by the given argument. Return false if the loop
1199// should exit.
1200def int_loop_decrement :
1201 Intrinsic<[llvm_i1_ty], [llvm_anyint_ty], [IntrNoDuplicate]>;
1202
1203// Decrement the first operand (the loop counter) by the second operand (the
1204// maximum number of elements processed in an iteration). Return the remaining
1205// number of iterations still to be executed. This is effectively a sub which
1206// can be used with a phi, icmp and br to control the number of iterations
1207// executed, as usual.
1208def int_loop_decrement_reg :
1209 Intrinsic<[llvm_anyint_ty],
1210 [llvm_anyint_ty, llvm_anyint_ty], [IntrNoDuplicate]>;
1211
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001212//===----- Intrinsics that are used to provide predicate information -----===//
1213
1214def int_ssa_copy : Intrinsic<[llvm_any_ty], [LLVMMatchType<0>],
1215 [IntrNoMem, Returned<0>]>;
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001216
1217//===------- Intrinsics that are used to preserve debug information -------===//
1218
1219def int_preserve_array_access_index : Intrinsic<[llvm_anyptr_ty],
1220 [llvm_anyptr_ty, llvm_i32_ty,
1221 llvm_i32_ty],
1222 [IntrNoMem, ImmArg<1>, ImmArg<2>]>;
1223def int_preserve_union_access_index : Intrinsic<[llvm_anyptr_ty],
1224 [llvm_anyptr_ty, llvm_i32_ty],
1225 [IntrNoMem, ImmArg<1>]>;
1226def int_preserve_struct_access_index : Intrinsic<[llvm_anyptr_ty],
1227 [llvm_anyptr_ty, llvm_i32_ty,
1228 llvm_i32_ty],
1229 [IntrNoMem, ImmArg<1>,
1230 ImmArg<2>]>;
1231
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001232//===----------------------------------------------------------------------===//
1233// Target-specific intrinsics
1234//===----------------------------------------------------------------------===//
1235
1236include "llvm/IR/IntrinsicsPowerPC.td"
1237include "llvm/IR/IntrinsicsX86.td"
1238include "llvm/IR/IntrinsicsARM.td"
1239include "llvm/IR/IntrinsicsAArch64.td"
1240include "llvm/IR/IntrinsicsXCore.td"
1241include "llvm/IR/IntrinsicsHexagon.td"
1242include "llvm/IR/IntrinsicsNVVM.td"
1243include "llvm/IR/IntrinsicsMips.td"
1244include "llvm/IR/IntrinsicsAMDGPU.td"
1245include "llvm/IR/IntrinsicsBPF.td"
1246include "llvm/IR/IntrinsicsSystemZ.td"
1247include "llvm/IR/IntrinsicsWebAssembly.td"
Andrew Scull0372a572018-11-16 15:47:06 +00001248include "llvm/IR/IntrinsicsRISCV.td"