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