1 //===-- CodeGen/RuntimeLibcalls.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 MULO_I32, 50 MULO_I64, 51 MULO_I128, 52 SDIV_I8, 53 SDIV_I16, 54 SDIV_I32, 55 SDIV_I64, 56 SDIV_I128, 57 UDIV_I8, 58 UDIV_I16, 59 UDIV_I32, 60 UDIV_I64, 61 UDIV_I128, 62 SREM_I8, 63 SREM_I16, 64 SREM_I32, 65 SREM_I64, 66 SREM_I128, 67 UREM_I8, 68 UREM_I16, 69 UREM_I32, 70 UREM_I64, 71 UREM_I128, 72 SDIVREM_I8, 73 SDIVREM_I16, 74 SDIVREM_I32, 75 SDIVREM_I64, 76 SDIVREM_I128, 77 UDIVREM_I8, 78 UDIVREM_I16, 79 UDIVREM_I32, 80 UDIVREM_I64, 81 UDIVREM_I128, 82 NEG_I32, 83 NEG_I64, 84 85 // FLOATING POINT 86 ADD_F32, 87 ADD_F64, 88 ADD_F80, 89 ADD_F128, 90 ADD_PPCF128, 91 SUB_F32, 92 SUB_F64, 93 SUB_F80, 94 SUB_F128, 95 SUB_PPCF128, 96 MUL_F32, 97 MUL_F64, 98 MUL_F80, 99 MUL_F128, 100 MUL_PPCF128, 101 DIV_F32, 102 DIV_F64, 103 DIV_F80, 104 DIV_F128, 105 DIV_PPCF128, 106 REM_F32, 107 REM_F64, 108 REM_F80, 109 REM_F128, 110 REM_PPCF128, 111 FMA_F32, 112 FMA_F64, 113 FMA_F80, 114 FMA_F128, 115 FMA_PPCF128, 116 POWI_F32, 117 POWI_F64, 118 POWI_F80, 119 POWI_F128, 120 POWI_PPCF128, 121 SQRT_F32, 122 SQRT_F64, 123 SQRT_F80, 124 SQRT_F128, 125 SQRT_PPCF128, 126 LOG_F32, 127 LOG_F64, 128 LOG_F80, 129 LOG_F128, 130 LOG_PPCF128, 131 LOG2_F32, 132 LOG2_F64, 133 LOG2_F80, 134 LOG2_F128, 135 LOG2_PPCF128, 136 LOG10_F32, 137 LOG10_F64, 138 LOG10_F80, 139 LOG10_F128, 140 LOG10_PPCF128, 141 EXP_F32, 142 EXP_F64, 143 EXP_F80, 144 EXP_F128, 145 EXP_PPCF128, 146 EXP2_F32, 147 EXP2_F64, 148 EXP2_F80, 149 EXP2_F128, 150 EXP2_PPCF128, 151 SIN_F32, 152 SIN_F64, 153 SIN_F80, 154 SIN_F128, 155 SIN_PPCF128, 156 COS_F32, 157 COS_F64, 158 COS_F80, 159 COS_F128, 160 COS_PPCF128, 161 SINCOS_F32, 162 SINCOS_F64, 163 SINCOS_F80, 164 SINCOS_F128, 165 SINCOS_PPCF128, 166 POW_F32, 167 POW_F64, 168 POW_F80, 169 POW_F128, 170 POW_PPCF128, 171 CEIL_F32, 172 CEIL_F64, 173 CEIL_F80, 174 CEIL_F128, 175 CEIL_PPCF128, 176 TRUNC_F32, 177 TRUNC_F64, 178 TRUNC_F80, 179 TRUNC_F128, 180 TRUNC_PPCF128, 181 RINT_F32, 182 RINT_F64, 183 RINT_F80, 184 RINT_F128, 185 RINT_PPCF128, 186 NEARBYINT_F32, 187 NEARBYINT_F64, 188 NEARBYINT_F80, 189 NEARBYINT_F128, 190 NEARBYINT_PPCF128, 191 ROUND_F32, 192 ROUND_F64, 193 ROUND_F80, 194 ROUND_F128, 195 ROUND_PPCF128, 196 FLOOR_F32, 197 FLOOR_F64, 198 FLOOR_F80, 199 FLOOR_F128, 200 FLOOR_PPCF128, 201 COPYSIGN_F32, 202 COPYSIGN_F64, 203 COPYSIGN_F80, 204 COPYSIGN_F128, 205 COPYSIGN_PPCF128, 206 FMIN_F32, 207 FMIN_F64, 208 FMIN_F80, 209 FMIN_F128, 210 FMIN_PPCF128, 211 FMAX_F32, 212 FMAX_F64, 213 FMAX_F80, 214 FMAX_F128, 215 FMAX_PPCF128, 216 217 // CONVERSION 218 FPEXT_F64_F128, 219 FPEXT_F32_F128, 220 FPEXT_F32_F64, 221 FPEXT_F16_F32, 222 FPROUND_F32_F16, 223 FPROUND_F64_F16, 224 FPROUND_F80_F16, 225 FPROUND_F128_F16, 226 FPROUND_PPCF128_F16, 227 FPROUND_F64_F32, 228 FPROUND_F80_F32, 229 FPROUND_F128_F32, 230 FPROUND_PPCF128_F32, 231 FPROUND_F80_F64, 232 FPROUND_F128_F64, 233 FPROUND_PPCF128_F64, 234 FPTOSINT_F32_I8, 235 FPTOSINT_F32_I16, 236 FPTOSINT_F32_I32, 237 FPTOSINT_F32_I64, 238 FPTOSINT_F32_I128, 239 FPTOSINT_F64_I8, 240 FPTOSINT_F64_I16, 241 FPTOSINT_F64_I32, 242 FPTOSINT_F64_I64, 243 FPTOSINT_F64_I128, 244 FPTOSINT_F80_I32, 245 FPTOSINT_F80_I64, 246 FPTOSINT_F80_I128, 247 FPTOSINT_F128_I32, 248 FPTOSINT_F128_I64, 249 FPTOSINT_F128_I128, 250 FPTOSINT_PPCF128_I32, 251 FPTOSINT_PPCF128_I64, 252 FPTOSINT_PPCF128_I128, 253 FPTOUINT_F32_I8, 254 FPTOUINT_F32_I16, 255 FPTOUINT_F32_I32, 256 FPTOUINT_F32_I64, 257 FPTOUINT_F32_I128, 258 FPTOUINT_F64_I8, 259 FPTOUINT_F64_I16, 260 FPTOUINT_F64_I32, 261 FPTOUINT_F64_I64, 262 FPTOUINT_F64_I128, 263 FPTOUINT_F80_I32, 264 FPTOUINT_F80_I64, 265 FPTOUINT_F80_I128, 266 FPTOUINT_F128_I32, 267 FPTOUINT_F128_I64, 268 FPTOUINT_F128_I128, 269 FPTOUINT_PPCF128_I32, 270 FPTOUINT_PPCF128_I64, 271 FPTOUINT_PPCF128_I128, 272 SINTTOFP_I32_F32, 273 SINTTOFP_I32_F64, 274 SINTTOFP_I32_F80, 275 SINTTOFP_I32_F128, 276 SINTTOFP_I32_PPCF128, 277 SINTTOFP_I64_F32, 278 SINTTOFP_I64_F64, 279 SINTTOFP_I64_F80, 280 SINTTOFP_I64_F128, 281 SINTTOFP_I64_PPCF128, 282 SINTTOFP_I128_F32, 283 SINTTOFP_I128_F64, 284 SINTTOFP_I128_F80, 285 SINTTOFP_I128_F128, 286 SINTTOFP_I128_PPCF128, 287 UINTTOFP_I32_F32, 288 UINTTOFP_I32_F64, 289 UINTTOFP_I32_F80, 290 UINTTOFP_I32_F128, 291 UINTTOFP_I32_PPCF128, 292 UINTTOFP_I64_F32, 293 UINTTOFP_I64_F64, 294 UINTTOFP_I64_F80, 295 UINTTOFP_I64_F128, 296 UINTTOFP_I64_PPCF128, 297 UINTTOFP_I128_F32, 298 UINTTOFP_I128_F64, 299 UINTTOFP_I128_F80, 300 UINTTOFP_I128_F128, 301 UINTTOFP_I128_PPCF128, 302 303 // COMPARISON 304 OEQ_F32, 305 OEQ_F64, 306 OEQ_F128, 307 UNE_F32, 308 UNE_F64, 309 UNE_F128, 310 OGE_F32, 311 OGE_F64, 312 OGE_F128, 313 OLT_F32, 314 OLT_F64, 315 OLT_F128, 316 OLE_F32, 317 OLE_F64, 318 OLE_F128, 319 OGT_F32, 320 OGT_F64, 321 OGT_F128, 322 UO_F32, 323 UO_F64, 324 UO_F128, 325 O_F32, 326 O_F64, 327 O_F128, 328 329 // MEMORY 330 MEMCPY, 331 MEMSET, 332 MEMMOVE, 333 334 // EXCEPTION HANDLING 335 UNWIND_RESUME, 336 337 // Family ATOMICs 338 SYNC_VAL_COMPARE_AND_SWAP_1, 339 SYNC_VAL_COMPARE_AND_SWAP_2, 340 SYNC_VAL_COMPARE_AND_SWAP_4, 341 SYNC_VAL_COMPARE_AND_SWAP_8, 342 SYNC_VAL_COMPARE_AND_SWAP_16, 343 SYNC_LOCK_TEST_AND_SET_1, 344 SYNC_LOCK_TEST_AND_SET_2, 345 SYNC_LOCK_TEST_AND_SET_4, 346 SYNC_LOCK_TEST_AND_SET_8, 347 SYNC_LOCK_TEST_AND_SET_16, 348 SYNC_FETCH_AND_ADD_1, 349 SYNC_FETCH_AND_ADD_2, 350 SYNC_FETCH_AND_ADD_4, 351 SYNC_FETCH_AND_ADD_8, 352 SYNC_FETCH_AND_ADD_16, 353 SYNC_FETCH_AND_SUB_1, 354 SYNC_FETCH_AND_SUB_2, 355 SYNC_FETCH_AND_SUB_4, 356 SYNC_FETCH_AND_SUB_8, 357 SYNC_FETCH_AND_SUB_16, 358 SYNC_FETCH_AND_AND_1, 359 SYNC_FETCH_AND_AND_2, 360 SYNC_FETCH_AND_AND_4, 361 SYNC_FETCH_AND_AND_8, 362 SYNC_FETCH_AND_AND_16, 363 SYNC_FETCH_AND_OR_1, 364 SYNC_FETCH_AND_OR_2, 365 SYNC_FETCH_AND_OR_4, 366 SYNC_FETCH_AND_OR_8, 367 SYNC_FETCH_AND_OR_16, 368 SYNC_FETCH_AND_XOR_1, 369 SYNC_FETCH_AND_XOR_2, 370 SYNC_FETCH_AND_XOR_4, 371 SYNC_FETCH_AND_XOR_8, 372 SYNC_FETCH_AND_XOR_16, 373 SYNC_FETCH_AND_NAND_1, 374 SYNC_FETCH_AND_NAND_2, 375 SYNC_FETCH_AND_NAND_4, 376 SYNC_FETCH_AND_NAND_8, 377 SYNC_FETCH_AND_NAND_16, 378 SYNC_FETCH_AND_MAX_1, 379 SYNC_FETCH_AND_MAX_2, 380 SYNC_FETCH_AND_MAX_4, 381 SYNC_FETCH_AND_MAX_8, 382 SYNC_FETCH_AND_MAX_16, 383 SYNC_FETCH_AND_UMAX_1, 384 SYNC_FETCH_AND_UMAX_2, 385 SYNC_FETCH_AND_UMAX_4, 386 SYNC_FETCH_AND_UMAX_8, 387 SYNC_FETCH_AND_UMAX_16, 388 SYNC_FETCH_AND_MIN_1, 389 SYNC_FETCH_AND_MIN_2, 390 SYNC_FETCH_AND_MIN_4, 391 SYNC_FETCH_AND_MIN_8, 392 SYNC_FETCH_AND_MIN_16, 393 SYNC_FETCH_AND_UMIN_1, 394 SYNC_FETCH_AND_UMIN_2, 395 SYNC_FETCH_AND_UMIN_4, 396 SYNC_FETCH_AND_UMIN_8, 397 SYNC_FETCH_AND_UMIN_16, 398 399 // Stack Protector Fail. 400 STACKPROTECTOR_CHECK_FAIL, 401 402 UNKNOWN_LIBCALL 403 }; 404 405 /// getFPEXT - Return the FPEXT_*_* value for the given types, or 406 /// UNKNOWN_LIBCALL if there is none. 407 Libcall getFPEXT(EVT OpVT, EVT RetVT); 408 409 /// getFPROUND - Return the FPROUND_*_* value for the given types, or 410 /// UNKNOWN_LIBCALL if there is none. 411 Libcall getFPROUND(EVT OpVT, EVT RetVT); 412 413 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or 414 /// UNKNOWN_LIBCALL if there is none. 415 Libcall getFPTOSINT(EVT OpVT, EVT RetVT); 416 417 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or 418 /// UNKNOWN_LIBCALL if there is none. 419 Libcall getFPTOUINT(EVT OpVT, EVT RetVT); 420 421 /// getSINTTOFP - Return the SINTTOFP_*_* value for the given types, or 422 /// UNKNOWN_LIBCALL if there is none. 423 Libcall getSINTTOFP(EVT OpVT, EVT RetVT); 424 425 /// getUINTTOFP - Return the UINTTOFP_*_* value for the given types, or 426 /// UNKNOWN_LIBCALL if there is none. 427 Libcall getUINTTOFP(EVT OpVT, EVT RetVT); 428 429 /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or 430 /// UNKNOWN_LIBCALL if there is none. 431 Libcall getATOMIC(unsigned Opc, MVT VT); 432 } 433 } 434 435 #endif 436