ae708c912cc2f9d48f695bb7e074bfcc00e55fb3
[oota-llvm.git] / include / llvm / CodeGen / RuntimeLibcalls.h
1 //===-- CodeGen/RuntimeLibcall.h - Runtime Library Calls --------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the enum representing the list of runtime library calls
11 // the backend may emit during code generation, and also some helper functions.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
16 #define LLVM_CODEGEN_RUNTIMELIBCALLS_H
17
18 #include "llvm/CodeGen/ValueTypes.h"
19
20 namespace llvm {
21 namespace RTLIB {
22   /// RTLIB::Libcall enum - This enum defines all of the runtime library calls
23   /// the backend can emit.  The various long double types cannot be merged,
24   /// because 80-bit library functions use "xf" and 128-bit use "tf".
25   /// 
26   /// When adding PPCF128 functions here, note that their names generally need
27   /// to be overridden for Darwin with the xxx$LDBL128 form.  See
28   /// PPCISelLowering.cpp.
29   ///
30   enum Libcall {
31     // Integer
32     SHL_I16,
33     SHL_I32,
34     SHL_I64,
35     SHL_I128,
36     SRL_I16,
37     SRL_I32,
38     SRL_I64,
39     SRL_I128,
40     SRA_I16,
41     SRA_I32,
42     SRA_I64,
43     SRA_I128,
44     MUL_I16,
45     MUL_I32,
46     MUL_I64,
47     MUL_I128,
48     SDIV_I16,
49     SDIV_I32,
50     SDIV_I64,
51     SDIV_I128,
52     UDIV_I16,
53     UDIV_I32,
54     UDIV_I64,
55     UDIV_I128,
56     SREM_I16,
57     SREM_I32,
58     SREM_I64,
59     SREM_I128,
60     UREM_I16,
61     UREM_I32,
62     UREM_I64,
63     UREM_I128,
64     NEG_I32,
65     NEG_I64,
66
67     // FLOATING POINT
68     ADD_F32,
69     ADD_F64,
70     ADD_F80,
71     ADD_PPCF128,
72     SUB_F32,
73     SUB_F64,
74     SUB_F80,
75     SUB_PPCF128,
76     MUL_F32,
77     MUL_F64,
78     MUL_F80,
79     MUL_PPCF128,
80     DIV_F32,
81     DIV_F64,
82     DIV_F80,
83     DIV_PPCF128,
84     REM_F32,
85     REM_F64,
86     REM_F80,
87     REM_PPCF128,
88     POWI_F32,
89     POWI_F64,
90     POWI_F80,
91     POWI_PPCF128,
92     SQRT_F32,
93     SQRT_F64,
94     SQRT_F80,
95     SQRT_PPCF128,
96     LOG_F32,
97     LOG_F64,
98     LOG_F80,
99     LOG_PPCF128,
100     LOG2_F32,
101     LOG2_F64,
102     LOG2_F80,
103     LOG2_PPCF128,
104     LOG10_F32,
105     LOG10_F64,
106     LOG10_F80,
107     LOG10_PPCF128,
108     EXP_F32,
109     EXP_F64,
110     EXP_F80,
111     EXP_PPCF128,
112     EXP2_F32,
113     EXP2_F64,
114     EXP2_F80,
115     EXP2_PPCF128,
116     SIN_F32,
117     SIN_F64,
118     SIN_F80,
119     SIN_PPCF128,
120     COS_F32,
121     COS_F64,
122     COS_F80,
123     COS_PPCF128,
124     POW_F32,
125     POW_F64,
126     POW_F80,
127     POW_PPCF128,
128     CEIL_F32,
129     CEIL_F64,
130     CEIL_F80,
131     CEIL_PPCF128,
132     TRUNC_F32,
133     TRUNC_F64,
134     TRUNC_F80,
135     TRUNC_PPCF128,
136     RINT_F32,
137     RINT_F64,
138     RINT_F80,
139     RINT_PPCF128,
140     NEARBYINT_F32,
141     NEARBYINT_F64,
142     NEARBYINT_F80,
143     NEARBYINT_PPCF128,
144     FLOOR_F32,
145     FLOOR_F64,
146     FLOOR_F80,
147     FLOOR_PPCF128,
148
149     // CONVERSION
150     FPEXT_F32_F64,
151     FPROUND_F64_F32,
152     FPROUND_F80_F32,
153     FPROUND_PPCF128_F32,
154     FPROUND_F80_F64,
155     FPROUND_PPCF128_F64,
156     FPTOSINT_F32_I8,
157     FPTOSINT_F32_I16,
158     FPTOSINT_F32_I32,
159     FPTOSINT_F32_I64,
160     FPTOSINT_F32_I128,
161     FPTOSINT_F64_I32,
162     FPTOSINT_F64_I64,
163     FPTOSINT_F64_I128,
164     FPTOSINT_F80_I32,
165     FPTOSINT_F80_I64,
166     FPTOSINT_F80_I128,
167     FPTOSINT_PPCF128_I32,
168     FPTOSINT_PPCF128_I64,
169     FPTOSINT_PPCF128_I128,
170     FPTOUINT_F32_I8,
171     FPTOUINT_F32_I16,
172     FPTOUINT_F32_I32,
173     FPTOUINT_F32_I64,
174     FPTOUINT_F32_I128,
175     FPTOUINT_F64_I32,
176     FPTOUINT_F64_I64,
177     FPTOUINT_F64_I128,
178     FPTOUINT_F80_I32,
179     FPTOUINT_F80_I64,
180     FPTOUINT_F80_I128,
181     FPTOUINT_PPCF128_I32,
182     FPTOUINT_PPCF128_I64,
183     FPTOUINT_PPCF128_I128,
184     SINTTOFP_I32_F32,
185     SINTTOFP_I32_F64,
186     SINTTOFP_I32_F80,
187     SINTTOFP_I32_PPCF128,
188     SINTTOFP_I64_F32,
189     SINTTOFP_I64_F64,
190     SINTTOFP_I64_F80,
191     SINTTOFP_I64_PPCF128,
192     SINTTOFP_I128_F32,
193     SINTTOFP_I128_F64,
194     SINTTOFP_I128_F80,
195     SINTTOFP_I128_PPCF128,
196     UINTTOFP_I32_F32,
197     UINTTOFP_I32_F64,
198     UINTTOFP_I32_F80,
199     UINTTOFP_I32_PPCF128,
200     UINTTOFP_I64_F32,
201     UINTTOFP_I64_F64,
202     UINTTOFP_I64_F80,
203     UINTTOFP_I64_PPCF128,
204     UINTTOFP_I128_F32,
205     UINTTOFP_I128_F64,
206     UINTTOFP_I128_F80,
207     UINTTOFP_I128_PPCF128,
208
209     // COMPARISON
210     OEQ_F32,
211     OEQ_F64,
212     UNE_F32,
213     UNE_F64,
214     OGE_F32,
215     OGE_F64,
216     OLT_F32,
217     OLT_F64,
218     OLE_F32,
219     OLE_F64,
220     OGT_F32,
221     OGT_F64,
222     UO_F32,
223     UO_F64,
224     O_F32,
225     O_F64,
226
227     // MEMORY
228     MEMCPY,
229     MEMSET,
230     MEMMOVE,
231
232     // EXCEPTION HANDLING
233     UNWIND_RESUME,
234
235     UNKNOWN_LIBCALL
236   };
237
238   /// getFPEXT - Return the FPEXT_*_* value for the given types, or
239   /// UNKNOWN_LIBCALL if there is none.
240   Libcall getFPEXT(MVT OpVT, MVT RetVT);
241
242   /// getFPROUND - Return the FPROUND_*_* value for the given types, or
243   /// UNKNOWN_LIBCALL if there is none.
244   Libcall getFPROUND(MVT OpVT, MVT RetVT);
245
246   /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or
247   /// UNKNOWN_LIBCALL if there is none.
248   Libcall getFPTOSINT(MVT OpVT, MVT RetVT);
249
250   /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or
251   /// UNKNOWN_LIBCALL if there is none.
252   Libcall getFPTOUINT(MVT OpVT, MVT RetVT);
253
254   /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or
255   /// UNKNOWN_LIBCALL if there is none.
256   Libcall getSINTTOFP(MVT OpVT, MVT RetVT);
257
258   /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or
259   /// UNKNOWN_LIBCALL if there is none.
260   Libcall getUINTTOFP(MVT OpVT, MVT RetVT);
261 }
262 }
263
264 #endif