RuntimeLibcalls.h revision 194612
1193323Sed//===-- CodeGen/RuntimeLibcall.h - Runtime Library Calls --------*- C++ -*-===//
2193323Sed//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7193323Sed//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This file defines the enum representing the list of runtime library calls
11193323Sed// the backend may emit during code generation, and also some helper functions.
12193323Sed//
13193323Sed//===----------------------------------------------------------------------===//
14193323Sed
15193323Sed#ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
16193323Sed#define LLVM_CODEGEN_RUNTIMELIBCALLS_H
17193323Sed
18193323Sed#include "llvm/CodeGen/ValueTypes.h"
19193323Sed
20193323Sednamespace llvm {
21193323Sednamespace RTLIB {
22193323Sed  /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
23193323Sed  /// the backend can emit.  The various long double types cannot be merged,
24193323Sed  /// because 80-bit library functions use "xf" and 128-bit use "tf".
25193323Sed  ///
26193323Sed  /// When adding PPCF128 functions here, note that their names generally need
27193323Sed  /// to be overridden for Darwin with the xxx$LDBL128 form.  See
28193323Sed  /// PPCISelLowering.cpp.
29193323Sed  ///
30193323Sed  enum Libcall {
31193323Sed    // Integer
32193323Sed    SHL_I16,
33193323Sed    SHL_I32,
34193323Sed    SHL_I64,
35193323Sed    SHL_I128,
36193323Sed    SRL_I16,
37193323Sed    SRL_I32,
38193323Sed    SRL_I64,
39193323Sed    SRL_I128,
40193323Sed    SRA_I16,
41193323Sed    SRA_I32,
42193323Sed    SRA_I64,
43193323Sed    SRA_I128,
44193323Sed    MUL_I16,
45193323Sed    MUL_I32,
46193323Sed    MUL_I64,
47193323Sed    MUL_I128,
48193323Sed    SDIV_I16,
49193323Sed    SDIV_I32,
50193323Sed    SDIV_I64,
51193323Sed    SDIV_I128,
52193323Sed    UDIV_I16,
53193323Sed    UDIV_I32,
54193323Sed    UDIV_I64,
55193323Sed    UDIV_I128,
56193323Sed    SREM_I16,
57193323Sed    SREM_I32,
58193323Sed    SREM_I64,
59193323Sed    SREM_I128,
60193323Sed    UREM_I16,
61193323Sed    UREM_I32,
62193323Sed    UREM_I64,
63193323Sed    UREM_I128,
64193323Sed    NEG_I32,
65193323Sed    NEG_I64,
66193323Sed
67193323Sed    // FLOATING POINT
68193323Sed    ADD_F32,
69193323Sed    ADD_F64,
70193323Sed    ADD_F80,
71193323Sed    ADD_PPCF128,
72193323Sed    SUB_F32,
73193323Sed    SUB_F64,
74193323Sed    SUB_F80,
75193323Sed    SUB_PPCF128,
76193323Sed    MUL_F32,
77193323Sed    MUL_F64,
78193323Sed    MUL_F80,
79193323Sed    MUL_PPCF128,
80193323Sed    DIV_F32,
81193323Sed    DIV_F64,
82193323Sed    DIV_F80,
83193323Sed    DIV_PPCF128,
84193323Sed    REM_F32,
85193323Sed    REM_F64,
86193323Sed    REM_F80,
87193323Sed    REM_PPCF128,
88193323Sed    POWI_F32,
89193323Sed    POWI_F64,
90193323Sed    POWI_F80,
91193323Sed    POWI_PPCF128,
92193323Sed    SQRT_F32,
93193323Sed    SQRT_F64,
94193323Sed    SQRT_F80,
95193323Sed    SQRT_PPCF128,
96193323Sed    LOG_F32,
97193323Sed    LOG_F64,
98193323Sed    LOG_F80,
99193323Sed    LOG_PPCF128,
100193323Sed    LOG2_F32,
101193323Sed    LOG2_F64,
102193323Sed    LOG2_F80,
103193323Sed    LOG2_PPCF128,
104193323Sed    LOG10_F32,
105193323Sed    LOG10_F64,
106193323Sed    LOG10_F80,
107193323Sed    LOG10_PPCF128,
108193323Sed    EXP_F32,
109193323Sed    EXP_F64,
110193323Sed    EXP_F80,
111193323Sed    EXP_PPCF128,
112193323Sed    EXP2_F32,
113193323Sed    EXP2_F64,
114193323Sed    EXP2_F80,
115193323Sed    EXP2_PPCF128,
116193323Sed    SIN_F32,
117193323Sed    SIN_F64,
118193323Sed    SIN_F80,
119193323Sed    SIN_PPCF128,
120193323Sed    COS_F32,
121193323Sed    COS_F64,
122193323Sed    COS_F80,
123193323Sed    COS_PPCF128,
124193323Sed    POW_F32,
125193323Sed    POW_F64,
126193323Sed    POW_F80,
127193323Sed    POW_PPCF128,
128193323Sed    CEIL_F32,
129193323Sed    CEIL_F64,
130193323Sed    CEIL_F80,
131193323Sed    CEIL_PPCF128,
132193323Sed    TRUNC_F32,
133193323Sed    TRUNC_F64,
134193323Sed    TRUNC_F80,
135193323Sed    TRUNC_PPCF128,
136193323Sed    RINT_F32,
137193323Sed    RINT_F64,
138193323Sed    RINT_F80,
139193323Sed    RINT_PPCF128,
140193323Sed    NEARBYINT_F32,
141193323Sed    NEARBYINT_F64,
142193323Sed    NEARBYINT_F80,
143193323Sed    NEARBYINT_PPCF128,
144193323Sed    FLOOR_F32,
145193323Sed    FLOOR_F64,
146193323Sed    FLOOR_F80,
147193323Sed    FLOOR_PPCF128,
148193323Sed
149193323Sed    // CONVERSION
150193323Sed    FPEXT_F32_F64,
151193323Sed    FPROUND_F64_F32,
152193323Sed    FPROUND_F80_F32,
153193323Sed    FPROUND_PPCF128_F32,
154193323Sed    FPROUND_F80_F64,
155193323Sed    FPROUND_PPCF128_F64,
156194612Sed    FPTOSINT_F32_I8,
157194612Sed    FPTOSINT_F32_I16,
158193323Sed    FPTOSINT_F32_I32,
159193323Sed    FPTOSINT_F32_I64,
160193323Sed    FPTOSINT_F32_I128,
161193323Sed    FPTOSINT_F64_I32,
162193323Sed    FPTOSINT_F64_I64,
163193323Sed    FPTOSINT_F64_I128,
164193323Sed    FPTOSINT_F80_I32,
165193323Sed    FPTOSINT_F80_I64,
166193323Sed    FPTOSINT_F80_I128,
167193323Sed    FPTOSINT_PPCF128_I32,
168193323Sed    FPTOSINT_PPCF128_I64,
169193323Sed    FPTOSINT_PPCF128_I128,
170194612Sed    FPTOUINT_F32_I8,
171194612Sed    FPTOUINT_F32_I16,
172193323Sed    FPTOUINT_F32_I32,
173193323Sed    FPTOUINT_F32_I64,
174193323Sed    FPTOUINT_F32_I128,
175193323Sed    FPTOUINT_F64_I32,
176193323Sed    FPTOUINT_F64_I64,
177193323Sed    FPTOUINT_F64_I128,
178193323Sed    FPTOUINT_F80_I32,
179193323Sed    FPTOUINT_F80_I64,
180193323Sed    FPTOUINT_F80_I128,
181193323Sed    FPTOUINT_PPCF128_I32,
182193323Sed    FPTOUINT_PPCF128_I64,
183193323Sed    FPTOUINT_PPCF128_I128,
184193323Sed    SINTTOFP_I32_F32,
185193323Sed    SINTTOFP_I32_F64,
186193323Sed    SINTTOFP_I32_F80,
187193323Sed    SINTTOFP_I32_PPCF128,
188193323Sed    SINTTOFP_I64_F32,
189193323Sed    SINTTOFP_I64_F64,
190193323Sed    SINTTOFP_I64_F80,
191193323Sed    SINTTOFP_I64_PPCF128,
192193323Sed    SINTTOFP_I128_F32,
193193323Sed    SINTTOFP_I128_F64,
194193323Sed    SINTTOFP_I128_F80,
195193323Sed    SINTTOFP_I128_PPCF128,
196193323Sed    UINTTOFP_I32_F32,
197193323Sed    UINTTOFP_I32_F64,
198193323Sed    UINTTOFP_I32_F80,
199193323Sed    UINTTOFP_I32_PPCF128,
200193323Sed    UINTTOFP_I64_F32,
201193323Sed    UINTTOFP_I64_F64,
202193323Sed    UINTTOFP_I64_F80,
203193323Sed    UINTTOFP_I64_PPCF128,
204193323Sed    UINTTOFP_I128_F32,
205193323Sed    UINTTOFP_I128_F64,
206193323Sed    UINTTOFP_I128_F80,
207193323Sed    UINTTOFP_I128_PPCF128,
208193323Sed
209193323Sed    // COMPARISON
210193323Sed    OEQ_F32,
211193323Sed    OEQ_F64,
212193323Sed    UNE_F32,
213193323Sed    UNE_F64,
214193323Sed    OGE_F32,
215193323Sed    OGE_F64,
216193323Sed    OLT_F32,
217193323Sed    OLT_F64,
218193323Sed    OLE_F32,
219193323Sed    OLE_F64,
220193323Sed    OGT_F32,
221193323Sed    OGT_F64,
222193323Sed    UO_F32,
223193323Sed    UO_F64,
224193323Sed    O_F32,
225193323Sed    O_F64,
226193323Sed
227193323Sed    // EXCEPTION HANDLING
228193323Sed    UNWIND_RESUME,
229193323Sed
230193323Sed    UNKNOWN_LIBCALL
231193323Sed  };
232193323Sed
233193323Sed  /// getFPEXT - Return the FPEXT_*_* value for the given types, or
234193323Sed  /// UNKNOWN_LIBCALL if there is none.
235193323Sed  Libcall getFPEXT(MVT OpVT, MVT RetVT);
236193323Sed
237193323Sed  /// getFPROUND - Return the FPROUND_*_* value for the given types, or
238193323Sed  /// UNKNOWN_LIBCALL if there is none.
239193323Sed  Libcall getFPROUND(MVT OpVT, MVT RetVT);
240193323Sed
241193323Sed  /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
242193323Sed  /// UNKNOWN_LIBCALL if there is none.
243193323Sed  Libcall getFPTOSINT(MVT OpVT, MVT RetVT);
244193323Sed
245193323Sed  /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
246193323Sed  /// UNKNOWN_LIBCALL if there is none.
247193323Sed  Libcall getFPTOUINT(MVT OpVT, MVT RetVT);
248193323Sed
249193323Sed  /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
250193323Sed  /// UNKNOWN_LIBCALL if there is none.
251193323Sed  Libcall getSINTTOFP(MVT OpVT, MVT RetVT);
252193323Sed
253193323Sed  /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
254193323Sed  /// UNKNOWN_LIBCALL if there is none.
255193323Sed  Libcall getUINTTOFP(MVT OpVT, MVT RetVT);
256193323Sed}
257193323Sed}
258193323Sed
259193323Sed#endif
260