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_I8, 45 MUL_I16, 46 MUL_I32, 47 MUL_I64, 48 MUL_I128, 49 SDIV_I8, 50 SDIV_I16, 51 SDIV_I32, 52 SDIV_I64, 53 SDIV_I128, 54 UDIV_I8, 55 UDIV_I16, 56 UDIV_I32, 57 UDIV_I64, 58 UDIV_I128, 59 SREM_I8, 60 SREM_I16, 61 SREM_I32, 62 SREM_I64, 63 SREM_I128, 64 UREM_I8, 65 UREM_I16, 66 UREM_I32, 67 UREM_I64, 68 UREM_I128, 69 NEG_I32, 70 NEG_I64, 71 72 // FLOATING POINT 73 ADD_F32, 74 ADD_F64, 75 ADD_F80, 76 ADD_PPCF128, 77 SUB_F32, 78 SUB_F64, 79 SUB_F80, 80 SUB_PPCF128, 81 MUL_F32, 82 MUL_F64, 83 MUL_F80, 84 MUL_PPCF128, 85 DIV_F32, 86 DIV_F64, 87 DIV_F80, 88 DIV_PPCF128, 89 REM_F32, 90 REM_F64, 91 REM_F80, 92 REM_PPCF128, 93 POWI_F32, 94 POWI_F64, 95 POWI_F80, 96 POWI_PPCF128, 97 SQRT_F32, 98 SQRT_F64, 99 SQRT_F80, 100 SQRT_PPCF128, 101 LOG_F32, 102 LOG_F64, 103 LOG_F80, 104 LOG_PPCF128, 105 LOG2_F32, 106 LOG2_F64, 107 LOG2_F80, 108 LOG2_PPCF128, 109 LOG10_F32, 110 LOG10_F64, 111 LOG10_F80, 112 LOG10_PPCF128, 113 EXP_F32, 114 EXP_F64, 115 EXP_F80, 116 EXP_PPCF128, 117 EXP2_F32, 118 EXP2_F64, 119 EXP2_F80, 120 EXP2_PPCF128, 121 SIN_F32, 122 SIN_F64, 123 SIN_F80, 124 SIN_PPCF128, 125 COS_F32, 126 COS_F64, 127 COS_F80, 128 COS_PPCF128, 129 POW_F32, 130 POW_F64, 131 POW_F80, 132 POW_PPCF128, 133 CEIL_F32, 134 CEIL_F64, 135 CEIL_F80, 136 CEIL_PPCF128, 137 TRUNC_F32, 138 TRUNC_F64, 139 TRUNC_F80, 140 TRUNC_PPCF128, 141 RINT_F32, 142 RINT_F64, 143 RINT_F80, 144 RINT_PPCF128, 145 NEARBYINT_F32, 146 NEARBYINT_F64, 147 NEARBYINT_F80, 148 NEARBYINT_PPCF128, 149 FLOOR_F32, 150 FLOOR_F64, 151 FLOOR_F80, 152 FLOOR_PPCF128, 153 COPYSIGN_F32, 154 COPYSIGN_F64, 155 COPYSIGN_F80, 156 COPYSIGN_PPCF128, 157 158 // CONVERSION 159 FPEXT_F32_F64, 160 FPEXT_F16_F32, 161 FPROUND_F32_F16, 162 FPROUND_F64_F32, 163 FPROUND_F80_F32, 164 FPROUND_PPCF128_F32, 165 FPROUND_F80_F64, 166 FPROUND_PPCF128_F64, 167 FPTOSINT_F32_I8, 168 FPTOSINT_F32_I16, 169 FPTOSINT_F32_I32, 170 FPTOSINT_F32_I64, 171 FPTOSINT_F32_I128, 172 FPTOSINT_F64_I8, 173 FPTOSINT_F64_I16, 174 FPTOSINT_F64_I32, 175 FPTOSINT_F64_I64, 176 FPTOSINT_F64_I128, 177 FPTOSINT_F80_I32, 178 FPTOSINT_F80_I64, 179 FPTOSINT_F80_I128, 180 FPTOSINT_PPCF128_I32, 181 FPTOSINT_PPCF128_I64, 182 FPTOSINT_PPCF128_I128, 183 FPTOUINT_F32_I8, 184 FPTOUINT_F32_I16, 185 FPTOUINT_F32_I32, 186 FPTOUINT_F32_I64, 187 FPTOUINT_F32_I128, 188 FPTOUINT_F64_I8, 189 FPTOUINT_F64_I16, 190 FPTOUINT_F64_I32, 191 FPTOUINT_F64_I64, 192 FPTOUINT_F64_I128, 193 FPTOUINT_F80_I32, 194 FPTOUINT_F80_I64, 195 FPTOUINT_F80_I128, 196 FPTOUINT_PPCF128_I32, 197 FPTOUINT_PPCF128_I64, 198 FPTOUINT_PPCF128_I128, 199 SINTTOFP_I32_F32, 200 SINTTOFP_I32_F64, 201 SINTTOFP_I32_F80, 202 SINTTOFP_I32_PPCF128, 203 SINTTOFP_I64_F32, 204 SINTTOFP_I64_F64, 205 SINTTOFP_I64_F80, 206 SINTTOFP_I64_PPCF128, 207 SINTTOFP_I128_F32, 208 SINTTOFP_I128_F64, 209 SINTTOFP_I128_F80, 210 SINTTOFP_I128_PPCF128, 211 UINTTOFP_I32_F32, 212 UINTTOFP_I32_F64, 213 UINTTOFP_I32_F80, 214 UINTTOFP_I32_PPCF128, 215 UINTTOFP_I64_F32, 216 UINTTOFP_I64_F64, 217 UINTTOFP_I64_F80, 218 UINTTOFP_I64_PPCF128, 219 UINTTOFP_I128_F32, 220 UINTTOFP_I128_F64, 221 UINTTOFP_I128_F80, 222 UINTTOFP_I128_PPCF128, 223 224 // COMPARISON 225 OEQ_F32, 226 OEQ_F64, 227 UNE_F32, 228 UNE_F64, 229 OGE_F32, 230 OGE_F64, 231 OLT_F32, 232 OLT_F64, 233 OLE_F32, 234 OLE_F64, 235 OGT_F32, 236 OGT_F64, 237 UO_F32, 238 UO_F64, 239 O_F32, 240 O_F64, 241 242 // MEMORY 243 MEMCPY, 244 MEMSET, 245 MEMMOVE, 246 247 // EXCEPTION HANDLING 248 UNWIND_RESUME, 249 250 // Family ATOMICs 251 SYNC_VAL_COMPARE_AND_SWAP_1, 252 SYNC_VAL_COMPARE_AND_SWAP_2, 253 SYNC_VAL_COMPARE_AND_SWAP_4, 254 SYNC_VAL_COMPARE_AND_SWAP_8, 255 SYNC_LOCK_TEST_AND_SET_1, 256 SYNC_LOCK_TEST_AND_SET_2, 257 SYNC_LOCK_TEST_AND_SET_4, 258 SYNC_LOCK_TEST_AND_SET_8, 259 SYNC_FETCH_AND_ADD_1, 260 SYNC_FETCH_AND_ADD_2, 261 SYNC_FETCH_AND_ADD_4, 262 SYNC_FETCH_AND_ADD_8, 263 SYNC_FETCH_AND_SUB_1, 264 SYNC_FETCH_AND_SUB_2, 265 SYNC_FETCH_AND_SUB_4, 266 SYNC_FETCH_AND_SUB_8, 267 SYNC_FETCH_AND_AND_1, 268 SYNC_FETCH_AND_AND_2, 269 SYNC_FETCH_AND_AND_4, 270 SYNC_FETCH_AND_AND_8, 271 SYNC_FETCH_AND_OR_1, 272 SYNC_FETCH_AND_OR_2, 273 SYNC_FETCH_AND_OR_4, 274 SYNC_FETCH_AND_OR_8, 275 SYNC_FETCH_AND_XOR_1, 276 SYNC_FETCH_AND_XOR_2, 277 SYNC_FETCH_AND_XOR_4, 278 SYNC_FETCH_AND_XOR_8, 279 SYNC_FETCH_AND_NAND_1, 280 SYNC_FETCH_AND_NAND_2, 281 SYNC_FETCH_AND_NAND_4, 282 SYNC_FETCH_AND_NAND_8, 283 284 UNKNOWN_LIBCALL 285 }; 286 287 /// getFPEXT - Return the FPEXT_*_* value for the given types, or 288 /// UNKNOWN_LIBCALL if there is none. 289 Libcall getFPEXT(EVT OpVT, EVT RetVT); 290 291 /// getFPROUND - Return the FPROUND_*_* value for the given types, or 292 /// UNKNOWN_LIBCALL if there is none. 293 Libcall getFPROUND(EVT OpVT, EVT RetVT); 294 295 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or 296 /// UNKNOWN_LIBCALL if there is none. 297 Libcall getFPTOSINT(EVT OpVT, EVT RetVT); 298 299 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or 300 /// UNKNOWN_LIBCALL if there is none. 301 Libcall getFPTOUINT(EVT OpVT, EVT RetVT); 302 303 /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or 304 /// UNKNOWN_LIBCALL if there is none. 305 Libcall getSINTTOFP(EVT OpVT, EVT RetVT); 306 307 /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or 308 /// UNKNOWN_LIBCALL if there is none. 309 Libcall getUINTTOFP(EVT OpVT, EVT RetVT); 310 } 311 } 312 313 #endif 314