138b42b4aSDan Gohman // CodeGen/RuntimeLibcallSignatures.cpp - R.T. Lib. Call Signatures -*- C++ -*--
238b42b4aSDan Gohman //
338b42b4aSDan Gohman //                     The LLVM Compiler Infrastructure
438b42b4aSDan Gohman //
538b42b4aSDan Gohman // This file is distributed under the University of Illinois Open Source
638b42b4aSDan Gohman // License. See LICENSE.TXT for details.
738b42b4aSDan Gohman //
838b42b4aSDan Gohman //===----------------------------------------------------------------------===//
938b42b4aSDan Gohman ///
1038b42b4aSDan Gohman /// \file
1138b42b4aSDan Gohman /// \brief This file contains signature information for runtime libcalls.
1238b42b4aSDan Gohman ///
1338b42b4aSDan Gohman /// CodeGen uses external symbols, which it refers to by name. The WebAssembly
1438b42b4aSDan Gohman /// target needs type information for all functions. This file contains a big
1538b42b4aSDan Gohman /// table providing type signatures for all runtime library functions that LLVM
1638b42b4aSDan Gohman /// uses.
1738b42b4aSDan Gohman ///
1838b42b4aSDan Gohman /// This is currently a fairly heavy-handed solution.
1938b42b4aSDan Gohman ///
2038b42b4aSDan Gohman //===----------------------------------------------------------------------===//
2138b42b4aSDan Gohman 
2238b42b4aSDan Gohman #include "WebAssemblyRuntimeLibcallSignatures.h"
2338b42b4aSDan Gohman #include "WebAssemblySubtarget.h"
2438b42b4aSDan Gohman #include "llvm/CodeGen/RuntimeLibcalls.h"
2538b42b4aSDan Gohman 
2638b42b4aSDan Gohman using namespace llvm;
2738b42b4aSDan Gohman 
2838b42b4aSDan Gohman namespace {
2938b42b4aSDan Gohman 
3038b42b4aSDan Gohman enum RuntimeLibcallSignature {
3138b42b4aSDan Gohman   func,
3238b42b4aSDan Gohman   f32_func_f32,
3338b42b4aSDan Gohman   f32_func_f64,
3438b42b4aSDan Gohman   f32_func_i32,
3538b42b4aSDan Gohman   f32_func_i64,
3638b42b4aSDan Gohman   f32_func_i16,
3738b42b4aSDan Gohman   f64_func_f32,
3838b42b4aSDan Gohman   f64_func_f64,
3938b42b4aSDan Gohman   f64_func_i32,
4038b42b4aSDan Gohman   f64_func_i64,
4138b42b4aSDan Gohman   i32_func_f32,
4238b42b4aSDan Gohman   i32_func_f64,
4338b42b4aSDan Gohman   i32_func_i32,
4438b42b4aSDan Gohman   i64_func_f32,
4538b42b4aSDan Gohman   i64_func_f64,
4638b42b4aSDan Gohman   i64_func_i64,
4738b42b4aSDan Gohman   f32_func_f32_f32,
4838b42b4aSDan Gohman   f32_func_f32_i32,
4938b42b4aSDan Gohman   f32_func_i64_i64,
5038b42b4aSDan Gohman   f64_func_f64_f64,
5138b42b4aSDan Gohman   f64_func_f64_i32,
5238b42b4aSDan Gohman   f64_func_i64_i64,
5338b42b4aSDan Gohman   i16_func_f32,
5438b42b4aSDan Gohman   i8_func_i8_i8,
5538b42b4aSDan Gohman   func_f32_iPTR_iPTR,
5638b42b4aSDan Gohman   func_f64_iPTR_iPTR,
5738b42b4aSDan Gohman   i16_func_i16_i16,
5838b42b4aSDan Gohman   i32_func_f32_f32,
5938b42b4aSDan Gohman   i32_func_f64_f64,
6038b42b4aSDan Gohman   i32_func_i32_i32,
6138b42b4aSDan Gohman   i64_func_i64_i64,
6238b42b4aSDan Gohman   i64_i64_func_f32,
6338b42b4aSDan Gohman   i64_i64_func_f64,
6438b42b4aSDan Gohman   i16_i16_func_i16_i16,
6538b42b4aSDan Gohman   i32_i32_func_i32_i32,
6638b42b4aSDan Gohman   i64_i64_func_i64_i64,
6738b42b4aSDan Gohman   i64_i64_func_i64_i64_i64_i64,
6838b42b4aSDan Gohman   i64_i64_i64_i64_func_i64_i64_i64_i64,
6938b42b4aSDan Gohman   i64_i64_func_i64_i64_i32,
7038b42b4aSDan Gohman   iPTR_func_iPTR_i32_iPTR,
7138b42b4aSDan Gohman   iPTR_func_iPTR_iPTR_iPTR,
7238b42b4aSDan Gohman   f32_func_f32_f32_f32,
7338b42b4aSDan Gohman   f64_func_f64_f64_f64,
7438b42b4aSDan Gohman   func_i64_i64_iPTR_iPTR,
7538b42b4aSDan Gohman   func_iPTR_f32,
7638b42b4aSDan Gohman   func_iPTR_f64,
7738b42b4aSDan Gohman   func_iPTR_i32,
7838b42b4aSDan Gohman   func_iPTR_i64,
7938b42b4aSDan Gohman   func_iPTR_i64_i64,
8038b42b4aSDan Gohman   func_iPTR_i64_i64_i64_i64,
8138b42b4aSDan Gohman   func_iPTR_i64_i64_i64_i64_i64_i64,
8238b42b4aSDan Gohman   i32_func_i64_i64,
8338b42b4aSDan Gohman   i32_func_i64_i64_i64_i64,
8438b42b4aSDan Gohman   unsupported
8538b42b4aSDan Gohman };
8638b42b4aSDan Gohman 
8738b42b4aSDan Gohman } // end anonymous namespace
8838b42b4aSDan Gohman 
8938b42b4aSDan Gohman static const RuntimeLibcallSignature
9038b42b4aSDan Gohman RuntimeLibcallSignatures[RTLIB::UNKNOWN_LIBCALL] = {
9138b42b4aSDan Gohman // Integer
9238b42b4aSDan Gohman /* SHL_I16 */ i16_func_i16_i16,
9338b42b4aSDan Gohman /* SHL_I32 */ i32_func_i32_i32,
9438b42b4aSDan Gohman /* SHL_I64 */ i64_func_i64_i64,
9538b42b4aSDan Gohman /* SHL_I128 */ i64_i64_func_i64_i64_i32,
9638b42b4aSDan Gohman /* SRL_I16 */ i16_func_i16_i16,
9738b42b4aSDan Gohman /* SRL_I32 */ i32_func_i32_i32,
9838b42b4aSDan Gohman /* SRL_I64 */ i64_func_i64_i64,
9938b42b4aSDan Gohman /* SRL_I128 */ i64_i64_func_i64_i64_i32,
10038b42b4aSDan Gohman /* SRA_I16 */ i16_func_i16_i16,
10138b42b4aSDan Gohman /* SRA_I32 */ i32_func_i32_i32,
10238b42b4aSDan Gohman /* SRA_I64 */ i64_func_i64_i64,
10338b42b4aSDan Gohman /* SRA_I128 */ i64_i64_func_i64_i64_i32,
10438b42b4aSDan Gohman /* MUL_I8 */ i8_func_i8_i8,
10538b42b4aSDan Gohman /* MUL_I16 */ i16_func_i16_i16,
10638b42b4aSDan Gohman /* MUL_I32 */ i32_func_i32_i32,
10738b42b4aSDan Gohman /* MUL_I64 */ i64_func_i64_i64,
10838b42b4aSDan Gohman /* MUL_I128 */ i64_i64_func_i64_i64_i64_i64,
10938b42b4aSDan Gohman /* MULO_I32 */ i32_func_i32_i32,
11038b42b4aSDan Gohman /* MULO_I64 */ i64_func_i64_i64,
11138b42b4aSDan Gohman /* MULO_I128 */ i64_i64_func_i64_i64_i64_i64,
11238b42b4aSDan Gohman /* SDIV_I8 */ i8_func_i8_i8,
11338b42b4aSDan Gohman /* SDIV_I16 */ i16_func_i16_i16,
11438b42b4aSDan Gohman /* SDIV_I32 */ i32_func_i32_i32,
11538b42b4aSDan Gohman /* SDIV_I64 */ i64_func_i64_i64,
11638b42b4aSDan Gohman /* SDIV_I128 */ i64_i64_func_i64_i64_i64_i64,
11738b42b4aSDan Gohman /* UDIV_I8 */ i8_func_i8_i8,
11838b42b4aSDan Gohman /* UDIV_I16 */ i16_func_i16_i16,
11938b42b4aSDan Gohman /* UDIV_I32 */ i32_func_i32_i32,
12038b42b4aSDan Gohman /* UDIV_I64 */ i64_func_i64_i64,
12138b42b4aSDan Gohman /* UDIV_I128 */ i64_i64_func_i64_i64_i64_i64,
12238b42b4aSDan Gohman /* SREM_I8 */ i8_func_i8_i8,
12338b42b4aSDan Gohman /* SREM_I16 */ i16_func_i16_i16,
12438b42b4aSDan Gohman /* SREM_I32 */ i32_func_i32_i32,
12538b42b4aSDan Gohman /* SREM_I64 */ i64_func_i64_i64,
12638b42b4aSDan Gohman /* SREM_I128 */ i64_i64_func_i64_i64_i64_i64,
12738b42b4aSDan Gohman /* UREM_I8 */ i8_func_i8_i8,
12838b42b4aSDan Gohman /* UREM_I16 */ i16_func_i16_i16,
12938b42b4aSDan Gohman /* UREM_I32 */ i32_func_i32_i32,
13038b42b4aSDan Gohman /* UREM_I64 */ i64_func_i64_i64,
13138b42b4aSDan Gohman /* UREM_I128 */ i64_i64_func_i64_i64_i64_i64,
13238b42b4aSDan Gohman /* SDIVREM_I8 */ i8_func_i8_i8,
13338b42b4aSDan Gohman /* SDIVREM_I16 */ i16_i16_func_i16_i16,
13438b42b4aSDan Gohman /* SDIVREM_I32 */ i32_i32_func_i32_i32,
13538b42b4aSDan Gohman /* SDIVREM_I64 */ i64_func_i64_i64,
13638b42b4aSDan Gohman /* SDIVREM_I128 */ i64_i64_i64_i64_func_i64_i64_i64_i64,
13738b42b4aSDan Gohman /* UDIVREM_I8 */ i8_func_i8_i8,
13838b42b4aSDan Gohman /* UDIVREM_I16 */ i16_i16_func_i16_i16,
13938b42b4aSDan Gohman /* UDIVREM_I32 */ i32_i32_func_i32_i32,
14038b42b4aSDan Gohman /* UDIVREM_I64 */ i64_i64_func_i64_i64,
14138b42b4aSDan Gohman /* UDIVREM_I128 */ i64_i64_i64_i64_func_i64_i64_i64_i64,
14238b42b4aSDan Gohman /* NEG_I32 */ i32_func_i32,
14338b42b4aSDan Gohman /* NEG_I64 */ i64_func_i64,
14438b42b4aSDan Gohman 
14538b42b4aSDan Gohman // FLOATING POINT
14638b42b4aSDan Gohman /* ADD_F32 */ f32_func_f32_f32,
14738b42b4aSDan Gohman /* ADD_F64 */ f64_func_f64_f64,
14838b42b4aSDan Gohman /* ADD_F80 */ unsupported,
14938b42b4aSDan Gohman /* ADD_F128 */ func_iPTR_i64_i64_i64_i64,
15038b42b4aSDan Gohman /* ADD_PPCF128 */ unsupported,
15138b42b4aSDan Gohman /* SUB_F32 */ f32_func_f32_f32,
15238b42b4aSDan Gohman /* SUB_F64 */ f64_func_f64_f64,
15338b42b4aSDan Gohman /* SUB_F80 */ unsupported,
15438b42b4aSDan Gohman /* SUB_F128 */ func_iPTR_i64_i64_i64_i64,
15538b42b4aSDan Gohman /* SUB_PPCF128 */ unsupported,
15638b42b4aSDan Gohman /* MUL_F32 */ f32_func_f32_f32,
15738b42b4aSDan Gohman /* MUL_F64 */ f64_func_f64_f64,
15838b42b4aSDan Gohman /* MUL_F80 */ unsupported,
15938b42b4aSDan Gohman /* MUL_F128 */ func_iPTR_i64_i64_i64_i64,
16038b42b4aSDan Gohman /* MUL_PPCF128 */ unsupported,
16138b42b4aSDan Gohman /* DIV_F32 */ f32_func_f32_f32,
16238b42b4aSDan Gohman /* DIV_F64 */ f64_func_f64_f64,
16338b42b4aSDan Gohman /* DIV_F80 */ unsupported,
16438b42b4aSDan Gohman /* DIV_F128 */ func_iPTR_i64_i64_i64_i64,
16538b42b4aSDan Gohman /* DIV_PPCF128 */ unsupported,
16638b42b4aSDan Gohman /* REM_F32 */ f32_func_f32_f32,
16738b42b4aSDan Gohman /* REM_F64 */ f64_func_f64_f64,
16838b42b4aSDan Gohman /* REM_F80 */ unsupported,
16938b42b4aSDan Gohman /* REM_F128 */ func_iPTR_i64_i64_i64_i64,
17038b42b4aSDan Gohman /* REM_PPCF128 */ unsupported,
17138b42b4aSDan Gohman /* FMA_F32 */ f32_func_f32_f32_f32,
17238b42b4aSDan Gohman /* FMA_F64 */ f64_func_f64_f64_f64,
17338b42b4aSDan Gohman /* FMA_F80 */ unsupported,
17438b42b4aSDan Gohman /* FMA_F128 */ func_iPTR_i64_i64_i64_i64_i64_i64,
17538b42b4aSDan Gohman /* FMA_PPCF128 */ unsupported,
17638b42b4aSDan Gohman /* POWI_F32 */ f32_func_f32_i32,
17738b42b4aSDan Gohman /* POWI_F64 */ f64_func_f64_i32,
17838b42b4aSDan Gohman /* POWI_F80 */ unsupported,
17938b42b4aSDan Gohman /* POWI_F128 */ func_iPTR_i64_i64_i64_i64,
18038b42b4aSDan Gohman /* POWI_PPCF128 */ unsupported,
18138b42b4aSDan Gohman /* SQRT_F32 */ f32_func_f32,
18238b42b4aSDan Gohman /* SQRT_F64 */ f64_func_f64,
18338b42b4aSDan Gohman /* SQRT_F80 */ unsupported,
18438b42b4aSDan Gohman /* SQRT_F128 */ func_iPTR_i64_i64,
18538b42b4aSDan Gohman /* SQRT_PPCF128 */ unsupported,
18638b42b4aSDan Gohman /* LOG_F32 */ f32_func_f32,
18738b42b4aSDan Gohman /* LOG_F64 */ f64_func_f64,
18838b42b4aSDan Gohman /* LOG_F80 */ unsupported,
18938b42b4aSDan Gohman /* LOG_F128 */ func_iPTR_i64_i64,
19038b42b4aSDan Gohman /* LOG_PPCF128 */ unsupported,
19138b42b4aSDan Gohman /* LOG2_F32 */ f32_func_f32,
19238b42b4aSDan Gohman /* LOG2_F64 */ f64_func_f64,
19338b42b4aSDan Gohman /* LOG2_F80 */ unsupported,
19438b42b4aSDan Gohman /* LOG2_F128 */ func_iPTR_i64_i64,
19538b42b4aSDan Gohman /* LOG2_PPCF128 */ unsupported,
19638b42b4aSDan Gohman /* LOG10_F32 */ f32_func_f32,
19738b42b4aSDan Gohman /* LOG10_F64 */ f64_func_f64,
19838b42b4aSDan Gohman /* LOG10_F80 */ unsupported,
19938b42b4aSDan Gohman /* LOG10_F128 */ func_iPTR_i64_i64,
20038b42b4aSDan Gohman /* LOG10_PPCF128 */ unsupported,
20138b42b4aSDan Gohman /* EXP_F32 */ f32_func_f32,
20238b42b4aSDan Gohman /* EXP_F64 */ f64_func_f64,
20338b42b4aSDan Gohman /* EXP_F80 */ unsupported,
20438b42b4aSDan Gohman /* EXP_F128 */ func_iPTR_i64_i64,
20538b42b4aSDan Gohman /* EXP_PPCF128 */ unsupported,
20638b42b4aSDan Gohman /* EXP2_F32 */ f32_func_f32,
20738b42b4aSDan Gohman /* EXP2_F64 */ f64_func_f64,
20838b42b4aSDan Gohman /* EXP2_F80 */ unsupported,
20938b42b4aSDan Gohman /* EXP2_F128 */ func_iPTR_i64_i64,
21038b42b4aSDan Gohman /* EXP2_PPCF128 */ unsupported,
21138b42b4aSDan Gohman /* SIN_F32 */ f32_func_f32,
21238b42b4aSDan Gohman /* SIN_F64 */ f64_func_f64,
21338b42b4aSDan Gohman /* SIN_F80 */ unsupported,
21438b42b4aSDan Gohman /* SIN_F128 */ func_iPTR_i64_i64,
21538b42b4aSDan Gohman /* SIN_PPCF128 */ unsupported,
21638b42b4aSDan Gohman /* COS_F32 */ f32_func_f32,
21738b42b4aSDan Gohman /* COS_F64 */ f64_func_f64,
21838b42b4aSDan Gohman /* COS_F80 */ unsupported,
21938b42b4aSDan Gohman /* COS_F128 */ func_iPTR_i64_i64,
22038b42b4aSDan Gohman /* COS_PPCF128 */ unsupported,
22138b42b4aSDan Gohman /* SINCOS_F32 */ func_f32_iPTR_iPTR,
22238b42b4aSDan Gohman /* SINCOS_F64 */ func_f64_iPTR_iPTR,
22338b42b4aSDan Gohman /* SINCOS_F80 */ unsupported,
22438b42b4aSDan Gohman /* SINCOS_F128 */ func_i64_i64_iPTR_iPTR,
22538b42b4aSDan Gohman /* SINCOS_PPCF128 */ unsupported,
22638b42b4aSDan Gohman /* POW_F32 */ f32_func_f32_f32,
22738b42b4aSDan Gohman /* POW_F64 */ f64_func_f64_f64,
22838b42b4aSDan Gohman /* POW_F80 */ unsupported,
22938b42b4aSDan Gohman /* POW_F128 */ func_iPTR_i64_i64_i64_i64,
23038b42b4aSDan Gohman /* POW_PPCF128 */ unsupported,
23138b42b4aSDan Gohman /* CEIL_F32 */ f32_func_f32,
23238b42b4aSDan Gohman /* CEIL_F64 */ f64_func_f64,
23338b42b4aSDan Gohman /* CEIL_F80 */ unsupported,
23438b42b4aSDan Gohman /* CEIL_F128 */ func_iPTR_i64_i64,
23538b42b4aSDan Gohman /* CEIL_PPCF128 */ unsupported,
23638b42b4aSDan Gohman /* TRUNC_F32 */ f32_func_f32,
23738b42b4aSDan Gohman /* TRUNC_F64 */ f64_func_f64,
23838b42b4aSDan Gohman /* TRUNC_F80 */ unsupported,
23938b42b4aSDan Gohman /* TRUNC_F128 */ func_iPTR_i64_i64,
24038b42b4aSDan Gohman /* TRUNC_PPCF128 */ unsupported,
24138b42b4aSDan Gohman /* RINT_F32 */ f32_func_f32,
24238b42b4aSDan Gohman /* RINT_F64 */ f64_func_f64,
24338b42b4aSDan Gohman /* RINT_F80 */ unsupported,
24438b42b4aSDan Gohman /* RINT_F128 */ func_iPTR_i64_i64,
24538b42b4aSDan Gohman /* RINT_PPCF128 */ unsupported,
24638b42b4aSDan Gohman /* NEARBYINT_F32 */ f32_func_f32,
24738b42b4aSDan Gohman /* NEARBYINT_F64 */ f64_func_f64,
24838b42b4aSDan Gohman /* NEARBYINT_F80 */ unsupported,
24938b42b4aSDan Gohman /* NEARBYINT_F128 */ func_iPTR_i64_i64,
25038b42b4aSDan Gohman /* NEARBYINT_PPCF128 */ unsupported,
25138b42b4aSDan Gohman /* ROUND_F32 */ f32_func_f32,
25238b42b4aSDan Gohman /* ROUND_F64 */ f64_func_f64,
25338b42b4aSDan Gohman /* ROUND_F80 */ unsupported,
25438b42b4aSDan Gohman /* ROUND_F128 */ func_iPTR_i64_i64,
25538b42b4aSDan Gohman /* ROUND_PPCF128 */ unsupported,
25638b42b4aSDan Gohman /* FLOOR_F32 */ f32_func_f32,
25738b42b4aSDan Gohman /* FLOOR_F64 */ f64_func_f64,
25838b42b4aSDan Gohman /* FLOOR_F80 */ unsupported,
25938b42b4aSDan Gohman /* FLOOR_F128 */ func_iPTR_i64_i64,
26038b42b4aSDan Gohman /* FLOOR_PPCF128 */ unsupported,
26138b42b4aSDan Gohman /* COPYSIGN_F32 */ f32_func_f32_f32,
26238b42b4aSDan Gohman /* COPYSIGN_F64 */ f64_func_f64_f64,
26338b42b4aSDan Gohman /* COPYSIGN_F80 */ unsupported,
26438b42b4aSDan Gohman /* COPYSIGN_F128 */ func_iPTR_i64_i64_i64_i64,
26538b42b4aSDan Gohman /* COPYSIGN_PPCF128 */ unsupported,
26638b42b4aSDan Gohman /* FMIN_F32 */ f32_func_f32_f32,
26738b42b4aSDan Gohman /* FMIN_F64 */ f64_func_f64_f64,
26838b42b4aSDan Gohman /* FMIN_F80 */ unsupported,
26938b42b4aSDan Gohman /* FMIN_F128 */ func_iPTR_i64_i64_i64_i64,
27038b42b4aSDan Gohman /* FMIN_PPCF128 */ unsupported,
27138b42b4aSDan Gohman /* FMAX_F32 */ f32_func_f32_f32,
27238b42b4aSDan Gohman /* FMAX_F64 */ f64_func_f64_f64,
27338b42b4aSDan Gohman /* FMAX_F80 */ unsupported,
27438b42b4aSDan Gohman /* FMAX_F128 */ func_iPTR_i64_i64_i64_i64,
27538b42b4aSDan Gohman /* FMAX_PPCF128 */ unsupported,
27638b42b4aSDan Gohman 
27738b42b4aSDan Gohman // CONVERSION
27838b42b4aSDan Gohman /* FPEXT_F32_PPCF128 */ unsupported,
27938b42b4aSDan Gohman /* FPEXT_F64_PPCF128 */ unsupported,
28038b42b4aSDan Gohman /* FPEXT_F64_F128 */ func_iPTR_f64,
28138b42b4aSDan Gohman /* FPEXT_F32_F128 */ func_iPTR_f32,
28238b42b4aSDan Gohman /* FPEXT_F32_F64 */ f64_func_f32,
28338b42b4aSDan Gohman /* FPEXT_F16_F32 */ f32_func_i16,
28438b42b4aSDan Gohman /* FPROUND_F32_F16 */ i16_func_f32,
28538b42b4aSDan Gohman /* FPROUND_F64_F16 */ unsupported,
28638b42b4aSDan Gohman /* FPROUND_F80_F16 */ unsupported,
28738b42b4aSDan Gohman /* FPROUND_F128_F16 */ unsupported,
28838b42b4aSDan Gohman /* FPROUND_PPCF128_F16 */ unsupported,
28938b42b4aSDan Gohman /* FPROUND_F64_F32 */ f32_func_f64,
29038b42b4aSDan Gohman /* FPROUND_F80_F32 */ unsupported,
29138b42b4aSDan Gohman /* FPROUND_F128_F32 */ f32_func_i64_i64,
29238b42b4aSDan Gohman /* FPROUND_PPCF128_F32 */ unsupported,
29338b42b4aSDan Gohman /* FPROUND_F80_F64 */ unsupported,
29438b42b4aSDan Gohman /* FPROUND_F128_F64 */ f64_func_i64_i64,
29538b42b4aSDan Gohman /* FPROUND_PPCF128_F64 */ unsupported,
29638b42b4aSDan Gohman /* FPTOSINT_F32_I32 */ i32_func_f32,
29738b42b4aSDan Gohman /* FPTOSINT_F32_I64 */ i64_func_f32,
29838b42b4aSDan Gohman /* FPTOSINT_F32_I128 */ i64_i64_func_f32,
29938b42b4aSDan Gohman /* FPTOSINT_F64_I32 */ i32_func_f64,
30038b42b4aSDan Gohman /* FPTOSINT_F64_I64 */ i64_func_f64,
30138b42b4aSDan Gohman /* FPTOSINT_F64_I128 */ i64_i64_func_f64,
30238b42b4aSDan Gohman /* FPTOSINT_F80_I32 */ unsupported,
30338b42b4aSDan Gohman /* FPTOSINT_F80_I64 */ unsupported,
30438b42b4aSDan Gohman /* FPTOSINT_F80_I128 */ unsupported,
30538b42b4aSDan Gohman /* FPTOSINT_F128_I32 */ i32_func_i64_i64,
30638b42b4aSDan Gohman /* FPTOSINT_F128_I64 */ i64_func_i64_i64,
30738b42b4aSDan Gohman /* FPTOSINT_F128_I128 */ i64_i64_func_i64_i64,
30838b42b4aSDan Gohman /* FPTOSINT_PPCF128_I32 */ unsupported,
30938b42b4aSDan Gohman /* FPTOSINT_PPCF128_I64 */ unsupported,
31038b42b4aSDan Gohman /* FPTOSINT_PPCF128_I128 */ unsupported,
31138b42b4aSDan Gohman /* FPTOUINT_F32_I32 */ i32_func_f32,
31238b42b4aSDan Gohman /* FPTOUINT_F32_I64 */ i64_func_f32,
31338b42b4aSDan Gohman /* FPTOUINT_F32_I128 */ i64_i64_func_f32,
31438b42b4aSDan Gohman /* FPTOUINT_F64_I32 */ i32_func_f64,
31538b42b4aSDan Gohman /* FPTOUINT_F64_I64 */ i64_func_f64,
31638b42b4aSDan Gohman /* FPTOUINT_F64_I128 */ i64_i64_func_f64,
31738b42b4aSDan Gohman /* FPTOUINT_F80_I32 */ unsupported,
31838b42b4aSDan Gohman /* FPTOUINT_F80_I64 */ unsupported,
31938b42b4aSDan Gohman /* FPTOUINT_F80_I128 */ unsupported,
32038b42b4aSDan Gohman /* FPTOUINT_F128_I32 */ i32_func_i64_i64,
32138b42b4aSDan Gohman /* FPTOUINT_F128_I64 */ i64_func_i64_i64,
32238b42b4aSDan Gohman /* FPTOUINT_F128_I128 */ i64_i64_func_i64_i64,
32338b42b4aSDan Gohman /* FPTOUINT_PPCF128_I32 */ unsupported,
32438b42b4aSDan Gohman /* FPTOUINT_PPCF128_I64 */ unsupported,
32538b42b4aSDan Gohman /* FPTOUINT_PPCF128_I128 */ unsupported,
32638b42b4aSDan Gohman /* SINTTOFP_I32_F32 */ f32_func_i32,
32738b42b4aSDan Gohman /* SINTTOFP_I32_F64 */ f64_func_i32,
32838b42b4aSDan Gohman /* SINTTOFP_I32_F80 */ unsupported,
32938b42b4aSDan Gohman /* SINTTOFP_I32_F128 */ func_iPTR_i32,
33038b42b4aSDan Gohman /* SINTTOFP_I32_PPCF128 */ unsupported,
33138b42b4aSDan Gohman /* SINTTOFP_I64_F32 */ f32_func_i64,
33238b42b4aSDan Gohman /* SINTTOFP_I64_F64 */ f64_func_i64,
33338b42b4aSDan Gohman /* SINTTOFP_I64_F80 */ unsupported,
33438b42b4aSDan Gohman /* SINTTOFP_I64_F128 */ func_iPTR_i64,
33538b42b4aSDan Gohman /* SINTTOFP_I64_PPCF128 */ unsupported,
33638b42b4aSDan Gohman /* SINTTOFP_I128_F32 */ f32_func_i64_i64,
33738b42b4aSDan Gohman /* SINTTOFP_I128_F64 */ f64_func_i64_i64,
33838b42b4aSDan Gohman /* SINTTOFP_I128_F80 */ unsupported,
33938b42b4aSDan Gohman /* SINTTOFP_I128_F128 */ func_iPTR_i64_i64,
34038b42b4aSDan Gohman /* SINTTOFP_I128_PPCF128 */ unsupported,
34138b42b4aSDan Gohman /* UINTTOFP_I32_F32 */ f32_func_i32,
34238b42b4aSDan Gohman /* UINTTOFP_I32_F64 */ f64_func_i64,
34338b42b4aSDan Gohman /* UINTTOFP_I32_F80 */ unsupported,
34438b42b4aSDan Gohman /* UINTTOFP_I32_F128 */ func_iPTR_i32,
34538b42b4aSDan Gohman /* UINTTOFP_I32_PPCF128 */ unsupported,
34638b42b4aSDan Gohman /* UINTTOFP_I64_F32 */ f32_func_i64,
34738b42b4aSDan Gohman /* UINTTOFP_I64_F64 */ f64_func_i64,
34838b42b4aSDan Gohman /* UINTTOFP_I64_F80 */ unsupported,
34938b42b4aSDan Gohman /* UINTTOFP_I64_F128 */ func_iPTR_i64,
35038b42b4aSDan Gohman /* UINTTOFP_I64_PPCF128 */ unsupported,
35138b42b4aSDan Gohman /* UINTTOFP_I128_F32 */ f32_func_i64_i64,
35238b42b4aSDan Gohman /* UINTTOFP_I128_F64 */ f64_func_i64_i64,
35338b42b4aSDan Gohman /* UINTTOFP_I128_F80 */ unsupported,
35438b42b4aSDan Gohman /* UINTTOFP_I128_F128 */ func_iPTR_i64_i64,
35538b42b4aSDan Gohman /* UINTTOFP_I128_PPCF128 */ unsupported,
35638b42b4aSDan Gohman 
35738b42b4aSDan Gohman // COMPARISON
35838b42b4aSDan Gohman /* OEQ_F32 */ i32_func_f32_f32,
35938b42b4aSDan Gohman /* OEQ_F64 */ i32_func_f64_f64,
36038b42b4aSDan Gohman /* OEQ_F128 */ i32_func_i64_i64_i64_i64,
36138b42b4aSDan Gohman /* OEQ_PPCF128 */ unsupported,
36238b42b4aSDan Gohman /* UNE_F32 */ i32_func_f32_f32,
36338b42b4aSDan Gohman /* UNE_F64 */ i32_func_f64_f64,
36438b42b4aSDan Gohman /* UNE_F128 */ i32_func_i64_i64_i64_i64,
36538b42b4aSDan Gohman /* UNE_PPCF128 */ unsupported,
36638b42b4aSDan Gohman /* OGE_F32 */ i32_func_f32_f32,
36738b42b4aSDan Gohman /* OGE_F64 */ i32_func_f64_f64,
36838b42b4aSDan Gohman /* OGE_F128 */ i32_func_i64_i64_i64_i64,
36938b42b4aSDan Gohman /* OGE_PPCF128 */ unsupported,
37038b42b4aSDan Gohman /* OLT_F32 */ i32_func_f32_f32,
37138b42b4aSDan Gohman /* OLT_F64 */ i32_func_f64_f64,
37238b42b4aSDan Gohman /* OLT_F128 */ i32_func_i64_i64_i64_i64,
37338b42b4aSDan Gohman /* OLT_PPCF128 */ unsupported,
37438b42b4aSDan Gohman /* OLE_F32 */ i32_func_f32_f32,
37538b42b4aSDan Gohman /* OLE_F64 */ i32_func_f64_f64,
37638b42b4aSDan Gohman /* OLE_F128 */ i32_func_i64_i64_i64_i64,
37738b42b4aSDan Gohman /* OLE_PPCF128 */ unsupported,
37838b42b4aSDan Gohman /* OGT_F32 */ i32_func_f32_f32,
37938b42b4aSDan Gohman /* OGT_F64 */ i32_func_f64_f64,
38038b42b4aSDan Gohman /* OGT_F128 */ i32_func_i64_i64_i64_i64,
38138b42b4aSDan Gohman /* OGT_PPCF128 */ unsupported,
38238b42b4aSDan Gohman /* UO_F32 */ i32_func_f32_f32,
38338b42b4aSDan Gohman /* UO_F64 */ i32_func_f64_f64,
38438b42b4aSDan Gohman /* UO_F128 */ i32_func_i64_i64_i64_i64,
38538b42b4aSDan Gohman /* UO_PPCF128 */ unsupported,
38638b42b4aSDan Gohman /* O_F32 */ i32_func_f32_f32,
38738b42b4aSDan Gohman /* O_F64 */ i32_func_f64_f64,
38838b42b4aSDan Gohman /* O_F128 */ i32_func_i64_i64_i64_i64,
38938b42b4aSDan Gohman /* O_PPCF128 */ unsupported,
39038b42b4aSDan Gohman 
39138b42b4aSDan Gohman // MEMORY
39238b42b4aSDan Gohman /* MEMCPY */ iPTR_func_iPTR_iPTR_iPTR,
39338b42b4aSDan Gohman /* MEMSET */ iPTR_func_iPTR_i32_iPTR,
39438b42b4aSDan Gohman /* MEMMOVE */ iPTR_func_iPTR_iPTR_iPTR,
39538b42b4aSDan Gohman 
39638b42b4aSDan Gohman // ELEMENT-WISE ATOMIC MEMORY
39738b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_1 */ iPTR_func_iPTR_iPTR_iPTR,
39838b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_2 */ iPTR_func_iPTR_iPTR_iPTR,
39938b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_4 */ iPTR_func_iPTR_iPTR_iPTR,
40038b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_8 */ iPTR_func_iPTR_iPTR_iPTR,
40138b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_16 */ iPTR_func_iPTR_iPTR_iPTR,
40238b42b4aSDan Gohman 
403*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_1 */ unsupported,
404*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_2 */ unsupported,
405*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_4 */ unsupported,
406*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_8 */ unsupported,
407*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_16 */ unsupported,
408*c855c728SDaniel Neilson 
40938b42b4aSDan Gohman // EXCEPTION HANDLING
41038b42b4aSDan Gohman /* UNWIND_RESUME */ unsupported,
41138b42b4aSDan Gohman 
41238b42b4aSDan Gohman // Note: there's two sets of atomics libcalls; see
41338b42b4aSDan Gohman // <http://llvm.org/docs/Atomics.html> for more info on the
41438b42b4aSDan Gohman // difference between them.
41538b42b4aSDan Gohman 
41638b42b4aSDan Gohman // Atomic '__sync_*' libcalls.
41738b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_1 */ unsupported,
41838b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_2 */ unsupported,
41938b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_4 */ unsupported,
42038b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_8 */ unsupported,
42138b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_16 */ unsupported,
42238b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_1 */ unsupported,
42338b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_2 */ unsupported,
42438b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_4 */ unsupported,
42538b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_8 */ unsupported,
42638b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_16 */ unsupported,
42738b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_1 */ unsupported,
42838b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_2 */ unsupported,
42938b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_4 */ unsupported,
43038b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_8 */ unsupported,
43138b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_16 */ unsupported,
43238b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_1 */ unsupported,
43338b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_2 */ unsupported,
43438b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_4 */ unsupported,
43538b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_8 */ unsupported,
43638b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_16 */ unsupported,
43738b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_1 */ unsupported,
43838b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_2 */ unsupported,
43938b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_4 */ unsupported,
44038b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_8 */ unsupported,
44138b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_16 */ unsupported,
44238b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_1 */ unsupported,
44338b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_2 */ unsupported,
44438b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_4 */ unsupported,
44538b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_8 */ unsupported,
44638b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_16 */ unsupported,
44738b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_1 */ unsupported,
44838b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_2 */ unsupported,
44938b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_4 */ unsupported,
45038b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_8 */ unsupported,
45138b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_16 */ unsupported,
45238b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_1 */ unsupported,
45338b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_2 */ unsupported,
45438b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_4 */ unsupported,
45538b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_8 */ unsupported,
45638b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_16 */ unsupported,
45738b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_1 */ unsupported,
45838b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_2 */ unsupported,
45938b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_4 */ unsupported,
46038b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_8 */ unsupported,
46138b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_16 */ unsupported,
46238b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_1 */ unsupported,
46338b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_2 */ unsupported,
46438b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_4 */ unsupported,
46538b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_8 */ unsupported,
46638b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_16 */ unsupported,
46738b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_1 */ unsupported,
46838b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_2 */ unsupported,
46938b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_4 */ unsupported,
47038b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_8 */ unsupported,
47138b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_16 */ unsupported,
47238b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_1 */ unsupported,
47338b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_2 */ unsupported,
47438b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_4 */ unsupported,
47538b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_8 */ unsupported,
47638b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_16 */ unsupported,
47738b42b4aSDan Gohman 
47838b42b4aSDan Gohman // Atomic '__atomic_*' libcalls.
47938b42b4aSDan Gohman /* ATOMIC_LOAD */ unsupported,
48038b42b4aSDan Gohman /* ATOMIC_LOAD_1 */ unsupported,
48138b42b4aSDan Gohman /* ATOMIC_LOAD_2 */ unsupported,
48238b42b4aSDan Gohman /* ATOMIC_LOAD_4 */ unsupported,
48338b42b4aSDan Gohman /* ATOMIC_LOAD_8 */ unsupported,
48438b42b4aSDan Gohman /* ATOMIC_LOAD_16 */ unsupported,
48538b42b4aSDan Gohman 
48638b42b4aSDan Gohman /* ATOMIC_STORE */ unsupported,
48738b42b4aSDan Gohman /* ATOMIC_STORE_1 */ unsupported,
48838b42b4aSDan Gohman /* ATOMIC_STORE_2 */ unsupported,
48938b42b4aSDan Gohman /* ATOMIC_STORE_4 */ unsupported,
49038b42b4aSDan Gohman /* ATOMIC_STORE_8 */ unsupported,
49138b42b4aSDan Gohman /* ATOMIC_STORE_16 */ unsupported,
49238b42b4aSDan Gohman 
49338b42b4aSDan Gohman /* ATOMIC_EXCHANGE */ unsupported,
49438b42b4aSDan Gohman /* ATOMIC_EXCHANGE_1 */ unsupported,
49538b42b4aSDan Gohman /* ATOMIC_EXCHANGE_2 */ unsupported,
49638b42b4aSDan Gohman /* ATOMIC_EXCHANGE_4 */ unsupported,
49738b42b4aSDan Gohman /* ATOMIC_EXCHANGE_8 */ unsupported,
49838b42b4aSDan Gohman /* ATOMIC_EXCHANGE_16 */ unsupported,
49938b42b4aSDan Gohman 
50038b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE */ unsupported,
50138b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_1 */ unsupported,
50238b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_2 */ unsupported,
50338b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_4 */ unsupported,
50438b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_8 */ unsupported,
50538b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_16 */ unsupported,
50638b42b4aSDan Gohman 
50738b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_1 */ unsupported,
50838b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_2 */ unsupported,
50938b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_4 */ unsupported,
51038b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_8 */ unsupported,
51138b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_16 */ unsupported,
51238b42b4aSDan Gohman 
51338b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_1 */ unsupported,
51438b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_2 */ unsupported,
51538b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_4 */ unsupported,
51638b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_8 */ unsupported,
51738b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_16 */ unsupported,
51838b42b4aSDan Gohman 
51938b42b4aSDan Gohman /* ATOMIC_FETCH_AND_1 */ unsupported,
52038b42b4aSDan Gohman /* ATOMIC_FETCH_AND_2 */ unsupported,
52138b42b4aSDan Gohman /* ATOMIC_FETCH_AND_4 */ unsupported,
52238b42b4aSDan Gohman /* ATOMIC_FETCH_AND_8 */ unsupported,
52338b42b4aSDan Gohman /* ATOMIC_FETCH_AND_16 */ unsupported,
52438b42b4aSDan Gohman 
52538b42b4aSDan Gohman /* ATOMIC_FETCH_OR_1 */ unsupported,
52638b42b4aSDan Gohman /* ATOMIC_FETCH_OR_2 */ unsupported,
52738b42b4aSDan Gohman /* ATOMIC_FETCH_OR_4 */ unsupported,
52838b42b4aSDan Gohman /* ATOMIC_FETCH_OR_8 */ unsupported,
52938b42b4aSDan Gohman /* ATOMIC_FETCH_OR_16 */ unsupported,
53038b42b4aSDan Gohman 
53138b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_1 */ unsupported,
53238b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_2 */ unsupported,
53338b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_4 */ unsupported,
53438b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_8 */ unsupported,
53538b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_16 */ unsupported,
53638b42b4aSDan Gohman 
53738b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_1 */ unsupported,
53838b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_2 */ unsupported,
53938b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_4 */ unsupported,
54038b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_8 */ unsupported,
54138b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_16 */ unsupported,
54238b42b4aSDan Gohman 
54338b42b4aSDan Gohman // Stack Protector Fail.
54438b42b4aSDan Gohman /* STACKPROTECTOR_CHECK_FAIL */ func,
54538b42b4aSDan Gohman 
54638b42b4aSDan Gohman // Deoptimization.
54738b42b4aSDan Gohman /* DEOPTIMIZE */ unsupported,
54838b42b4aSDan Gohman 
54938b42b4aSDan Gohman };
55038b42b4aSDan Gohman 
55138b42b4aSDan Gohman static const char *
55238b42b4aSDan Gohman RuntimeLibcallNames[RTLIB::UNKNOWN_LIBCALL] = {
55338b42b4aSDan Gohman /* SHL_I16 */ "__ashlhi3",
55438b42b4aSDan Gohman /* SHL_I32 */ "__ashlsi3",
55538b42b4aSDan Gohman /* SHL_I64 */ "__ashldi3",
55638b42b4aSDan Gohman /* SHL_I128 */ "__ashlti3",
55738b42b4aSDan Gohman /* SRL_I16 */ "__lshrhi3",
55838b42b4aSDan Gohman /* SRL_I32 */ "__lshrsi3",
55938b42b4aSDan Gohman /* SRL_I64 */ "__lshrdi3",
56038b42b4aSDan Gohman /* SRL_I128 */ "__lshrti3",
56138b42b4aSDan Gohman /* SRA_I16 */ "__ashrhi3",
56238b42b4aSDan Gohman /* SRA_I32 */ "__ashrsi3",
56338b42b4aSDan Gohman /* SRA_I64 */ "__ashrdi3",
56438b42b4aSDan Gohman /* SRA_I128 */ "__ashrti3",
56538b42b4aSDan Gohman /* MUL_I8 */ "__mulqi3",
56638b42b4aSDan Gohman /* MUL_I16 */ "__mulhi3",
56738b42b4aSDan Gohman /* MUL_I32 */ "__mulsi3",
56838b42b4aSDan Gohman /* MUL_I64 */ "__muldi3",
56938b42b4aSDan Gohman /* MUL_I128 */ "__multi3",
57038b42b4aSDan Gohman /* MULO_I32 */ "__mulosi4",
57138b42b4aSDan Gohman /* MULO_I64 */ "__mulodi4",
57238b42b4aSDan Gohman /* MULO_I128 */ "__muloti4",
57338b42b4aSDan Gohman /* SDIV_I8 */ "__divqi3",
57438b42b4aSDan Gohman /* SDIV_I16 */ "__divhi3",
57538b42b4aSDan Gohman /* SDIV_I32 */ "__divsi3",
57638b42b4aSDan Gohman /* SDIV_I64 */ "__divdi3",
57738b42b4aSDan Gohman /* SDIV_I128 */ "__divti3",
57838b42b4aSDan Gohman /* UDIV_I8 */ "__udivqi3",
57938b42b4aSDan Gohman /* UDIV_I16 */ "__udivhi3",
58038b42b4aSDan Gohman /* UDIV_I32 */ "__udivsi3",
58138b42b4aSDan Gohman /* UDIV_I64 */ "__udivdi3",
58238b42b4aSDan Gohman /* UDIV_I128 */ "__udivti3",
58338b42b4aSDan Gohman /* SREM_I8 */ "__modqi3",
58438b42b4aSDan Gohman /* SREM_I16 */ "__modhi3",
58538b42b4aSDan Gohman /* SREM_I32 */ "__modsi3",
58638b42b4aSDan Gohman /* SREM_I64 */ "__moddi3",
58738b42b4aSDan Gohman /* SREM_I128 */ "__modti3",
58838b42b4aSDan Gohman /* UREM_I8 */ "__umodqi3",
58938b42b4aSDan Gohman /* UREM_I16 */ "__umodhi3",
59038b42b4aSDan Gohman /* UREM_I32 */ "__umodsi3",
59138b42b4aSDan Gohman /* UREM_I64 */ "__umoddi3",
59238b42b4aSDan Gohman /* UREM_I128 */ "__umodti3",
59338b42b4aSDan Gohman /* SDIVREM_I8 */ nullptr,
59438b42b4aSDan Gohman /* SDIVREM_I16 */ nullptr,
59538b42b4aSDan Gohman /* SDIVREM_I32 */ nullptr,
59638b42b4aSDan Gohman /* SDIVREM_I64 */ nullptr,
59738b42b4aSDan Gohman /* SDIVREM_I128 */ nullptr,
59838b42b4aSDan Gohman /* UDIVREM_I8 */ nullptr,
59938b42b4aSDan Gohman /* UDIVREM_I16 */ nullptr,
60038b42b4aSDan Gohman /* UDIVREM_I32 */ nullptr,
60138b42b4aSDan Gohman /* UDIVREM_I64 */ nullptr,
60238b42b4aSDan Gohman /* UDIVREM_I128 */ nullptr,
60338b42b4aSDan Gohman /* NEG_I32 */ "__negsi2",
60438b42b4aSDan Gohman /* NEG_I64 */ "__negdi2",
60538b42b4aSDan Gohman /* ADD_F32 */ "__addsf3",
60638b42b4aSDan Gohman /* ADD_F64 */ "__adddf3",
60738b42b4aSDan Gohman /* ADD_F80 */ nullptr,
60838b42b4aSDan Gohman /* ADD_F128 */ "__addtf3",
60938b42b4aSDan Gohman /* ADD_PPCF128 */ nullptr,
61038b42b4aSDan Gohman /* SUB_F32 */ "__subsf3",
61138b42b4aSDan Gohman /* SUB_F64 */ "__subdf3",
61238b42b4aSDan Gohman /* SUB_F80 */ nullptr,
61338b42b4aSDan Gohman /* SUB_F128 */ "__subtf3",
61438b42b4aSDan Gohman /* SUB_PPCF128 */ nullptr,
61538b42b4aSDan Gohman /* MUL_F32 */ "__mulsf3",
61638b42b4aSDan Gohman /* MUL_F64 */ "__muldf3",
61738b42b4aSDan Gohman /* MUL_F80 */ nullptr,
61838b42b4aSDan Gohman /* MUL_F128 */ "__multf3",
61938b42b4aSDan Gohman /* MUL_PPCF128 */ nullptr,
62038b42b4aSDan Gohman /* DIV_F32 */ "__divsf3",
62138b42b4aSDan Gohman /* DIV_F64 */ "__divdf3",
62238b42b4aSDan Gohman /* DIV_F80 */ nullptr,
62338b42b4aSDan Gohman /* DIV_F128 */ "__divtf3",
62438b42b4aSDan Gohman /* DIV_PPCF128 */ nullptr,
62538b42b4aSDan Gohman /* REM_F32 */ "fmodf",
62638b42b4aSDan Gohman /* REM_F64 */ "fmod",
62738b42b4aSDan Gohman /* REM_F80 */ nullptr,
62838b42b4aSDan Gohman /* REM_F128 */ "fmodl",
62938b42b4aSDan Gohman /* REM_PPCF128 */ nullptr,
63038b42b4aSDan Gohman /* FMA_F32 */ "fmaf",
63138b42b4aSDan Gohman /* FMA_F64 */ "fma",
63238b42b4aSDan Gohman /* FMA_F80 */ nullptr,
63338b42b4aSDan Gohman /* FMA_F128 */ "fmal",
63438b42b4aSDan Gohman /* FMA_PPCF128 */ nullptr,
63538b42b4aSDan Gohman /* POWI_F32 */ "__powisf2",
63638b42b4aSDan Gohman /* POWI_F64 */ "__powidf2",
63738b42b4aSDan Gohman /* POWI_F80 */ nullptr,
63838b42b4aSDan Gohman /* POWI_F128 */ "__powitf2",
63938b42b4aSDan Gohman /* POWI_PPCF128 */ nullptr,
64038b42b4aSDan Gohman /* SQRT_F32 */ "sqrtf",
64138b42b4aSDan Gohman /* SQRT_F64 */ "sqrt",
64238b42b4aSDan Gohman /* SQRT_F80 */ nullptr,
64338b42b4aSDan Gohman /* SQRT_F128 */ "sqrtl",
64438b42b4aSDan Gohman /* SQRT_PPCF128 */ nullptr,
64538b42b4aSDan Gohman /* LOG_F32 */ "logf",
64638b42b4aSDan Gohman /* LOG_F64 */ "log",
64738b42b4aSDan Gohman /* LOG_F80 */ nullptr,
64838b42b4aSDan Gohman /* LOG_F128 */ "logl",
64938b42b4aSDan Gohman /* LOG_PPCF128 */ nullptr,
65038b42b4aSDan Gohman /* LOG2_F32 */ "log2f",
65138b42b4aSDan Gohman /* LOG2_F64 */ "log2",
65238b42b4aSDan Gohman /* LOG2_F80 */ nullptr,
65338b42b4aSDan Gohman /* LOG2_F128 */ "log2l",
65438b42b4aSDan Gohman /* LOG2_PPCF128 */ nullptr,
65538b42b4aSDan Gohman /* LOG10_F32 */ "log10f",
65638b42b4aSDan Gohman /* LOG10_F64 */ "log10",
65738b42b4aSDan Gohman /* LOG10_F80 */ nullptr,
65838b42b4aSDan Gohman /* LOG10_F128 */ "log10l",
65938b42b4aSDan Gohman /* LOG10_PPCF128 */ nullptr,
66038b42b4aSDan Gohman /* EXP_F32 */ "expf",
66138b42b4aSDan Gohman /* EXP_F64 */ "exp",
66238b42b4aSDan Gohman /* EXP_F80 */ nullptr,
66338b42b4aSDan Gohman /* EXP_F128 */ "expl",
66438b42b4aSDan Gohman /* EXP_PPCF128 */ nullptr,
66538b42b4aSDan Gohman /* EXP2_F32 */ "exp2f",
66638b42b4aSDan Gohman /* EXP2_F64 */ "exp2",
66738b42b4aSDan Gohman /* EXP2_F80 */ nullptr,
66838b42b4aSDan Gohman /* EXP2_F128 */ "exp2l",
66938b42b4aSDan Gohman /* EXP2_PPCF128 */ nullptr,
67038b42b4aSDan Gohman /* SIN_F32 */ "sinf",
67138b42b4aSDan Gohman /* SIN_F64 */ "sin",
67238b42b4aSDan Gohman /* SIN_F80 */ nullptr,
67338b42b4aSDan Gohman /* SIN_F128 */ "sinl",
67438b42b4aSDan Gohman /* SIN_PPCF128 */ nullptr,
67538b42b4aSDan Gohman /* COS_F32 */ "cosf",
67638b42b4aSDan Gohman /* COS_F64 */ "cos",
67738b42b4aSDan Gohman /* COS_F80 */ nullptr,
67838b42b4aSDan Gohman /* COS_F128 */ "cosl",
67938b42b4aSDan Gohman /* COS_PPCF128 */ nullptr,
68038b42b4aSDan Gohman /* SINCOS_F32 */ "sincosf",
68138b42b4aSDan Gohman /* SINCOS_F64 */ "sincos",
68238b42b4aSDan Gohman /* SINCOS_F80 */ nullptr,
68338b42b4aSDan Gohman /* SINCOS_F128 */ "sincosl",
68438b42b4aSDan Gohman /* SINCOS_PPCF128 */ nullptr,
68538b42b4aSDan Gohman /* POW_F32 */ "powf",
68638b42b4aSDan Gohman /* POW_F64 */ "pow",
68738b42b4aSDan Gohman /* POW_F80 */ nullptr,
68838b42b4aSDan Gohman /* POW_F128 */ "powl",
68938b42b4aSDan Gohman /* POW_PPCF128 */ nullptr,
69038b42b4aSDan Gohman /* CEIL_F32 */ "ceilf",
69138b42b4aSDan Gohman /* CEIL_F64 */ "ceil",
69238b42b4aSDan Gohman /* CEIL_F80 */ nullptr,
69338b42b4aSDan Gohman /* CEIL_F128 */ "ceill",
69438b42b4aSDan Gohman /* CEIL_PPCF128 */ nullptr,
69538b42b4aSDan Gohman /* TRUNC_F32 */ "truncf",
69638b42b4aSDan Gohman /* TRUNC_F64 */ "trunc",
69738b42b4aSDan Gohman /* TRUNC_F80 */ nullptr,
69838b42b4aSDan Gohman /* TRUNC_F128 */ "truncl",
69938b42b4aSDan Gohman /* TRUNC_PPCF128 */ nullptr,
70038b42b4aSDan Gohman /* RINT_F32 */ "rintf",
70138b42b4aSDan Gohman /* RINT_F64 */ "rint",
70238b42b4aSDan Gohman /* RINT_F80 */ nullptr,
70338b42b4aSDan Gohman /* RINT_F128 */ "rintl",
70438b42b4aSDan Gohman /* RINT_PPCF128 */ nullptr,
70538b42b4aSDan Gohman /* NEARBYINT_F32 */ "nearbyintf",
70638b42b4aSDan Gohman /* NEARBYINT_F64 */ "nearbyint",
70738b42b4aSDan Gohman /* NEARBYINT_F80 */ nullptr,
70838b42b4aSDan Gohman /* NEARBYINT_F128 */ "nearbyintl",
70938b42b4aSDan Gohman /* NEARBYINT_PPCF128 */ nullptr,
71038b42b4aSDan Gohman /* ROUND_F32 */ "roundf",
71138b42b4aSDan Gohman /* ROUND_F64 */ "round",
71238b42b4aSDan Gohman /* ROUND_F80 */ nullptr,
71338b42b4aSDan Gohman /* ROUND_F128 */ "roundl",
71438b42b4aSDan Gohman /* ROUND_PPCF128 */ nullptr,
71538b42b4aSDan Gohman /* FLOOR_F32 */ "floorf",
71638b42b4aSDan Gohman /* FLOOR_F64 */ "floor",
71738b42b4aSDan Gohman /* FLOOR_F80 */ nullptr,
71838b42b4aSDan Gohman /* FLOOR_F128 */ "floorl",
71938b42b4aSDan Gohman /* FLOOR_PPCF128 */ nullptr,
72038b42b4aSDan Gohman /* COPYSIGN_F32 */ "copysignf",
72138b42b4aSDan Gohman /* COPYSIGN_F64 */ "copysign",
72238b42b4aSDan Gohman /* COPYSIGN_F80 */ nullptr,
72338b42b4aSDan Gohman /* COPYSIGN_F128 */ "copysignl",
72438b42b4aSDan Gohman /* COPYSIGN_PPCF128 */ nullptr,
72538b42b4aSDan Gohman /* FMIN_F32 */ "fminf",
72638b42b4aSDan Gohman /* FMIN_F64 */ "fmin",
72738b42b4aSDan Gohman /* FMIN_F80 */ nullptr,
72838b42b4aSDan Gohman /* FMIN_F128 */ "fminl",
72938b42b4aSDan Gohman /* FMIN_PPCF128 */ nullptr,
73038b42b4aSDan Gohman /* FMAX_F32 */ "fmaxf",
73138b42b4aSDan Gohman /* FMAX_F64 */ "fmax",
73238b42b4aSDan Gohman /* FMAX_F80 */ nullptr,
73338b42b4aSDan Gohman /* FMAX_F128 */ "fmaxl",
73438b42b4aSDan Gohman /* FMAX_PPCF128 */ nullptr,
73538b42b4aSDan Gohman /* FPEXT_F32_PPCF128 */ nullptr,
73638b42b4aSDan Gohman /* FPEXT_F64_PPCF128 */ nullptr,
73738b42b4aSDan Gohman /* FPEXT_F64_F128 */ "__extenddftf2",
73838b42b4aSDan Gohman /* FPEXT_F32_F128 */ "__extendsftf2",
73938b42b4aSDan Gohman /* FPEXT_F32_F64 */ "__extendsfdf2",
74038b42b4aSDan Gohman /* FPEXT_F16_F32 */ "__gnu_h2f_ieee",
74138b42b4aSDan Gohman /* FPROUND_F32_F16 */ "__gnu_f2h_ieee",
74238b42b4aSDan Gohman /* FPROUND_F64_F16 */ nullptr,
74338b42b4aSDan Gohman /* FPROUND_F80_F16 */ nullptr,
74438b42b4aSDan Gohman /* FPROUND_F128_F16 */ nullptr,
74538b42b4aSDan Gohman /* FPROUND_PPCF128_F16 */ nullptr,
74638b42b4aSDan Gohman /* FPROUND_F64_F32 */ "__truncdfsf2",
74738b42b4aSDan Gohman /* FPROUND_F80_F32 */ "__truncxfsf2",
74838b42b4aSDan Gohman /* FPROUND_F128_F32 */ "__trunctfsf2",
74938b42b4aSDan Gohman /* FPROUND_PPCF128_F32 */ nullptr,
75038b42b4aSDan Gohman /* FPROUND_F80_F64 */ "__truncxfdf2",
75138b42b4aSDan Gohman /* FPROUND_F128_F64 */ "__trunctfdf2",
75238b42b4aSDan Gohman /* FPROUND_PPCF128_F64 */ nullptr,
75338b42b4aSDan Gohman /* FPTOSINT_F32_I32 */ "__fixsfsi",
75438b42b4aSDan Gohman /* FPTOSINT_F32_I64 */ "__fixsfdi",
75538b42b4aSDan Gohman /* FPTOSINT_F32_I128 */ "__fixsfti",
75638b42b4aSDan Gohman /* FPTOSINT_F64_I32 */ "__fixdfsi",
75738b42b4aSDan Gohman /* FPTOSINT_F64_I64 */ "__fixdfdi",
75838b42b4aSDan Gohman /* FPTOSINT_F64_I128 */ "__fixdfti",
75938b42b4aSDan Gohman /* FPTOSINT_F80_I32 */ "__fixxfsi",
76038b42b4aSDan Gohman /* FPTOSINT_F80_I64 */ "__fixxfdi",
76138b42b4aSDan Gohman /* FPTOSINT_F80_I128 */ "__fixxfti",
76238b42b4aSDan Gohman /* FPTOSINT_F128_I32 */ "__fixtfsi",
76338b42b4aSDan Gohman /* FPTOSINT_F128_I64 */ "__fixtfdi",
76438b42b4aSDan Gohman /* FPTOSINT_F128_I128 */ "__fixtfti",
76538b42b4aSDan Gohman /* FPTOSINT_PPCF128_I32 */ nullptr,
76638b42b4aSDan Gohman /* FPTOSINT_PPCF128_I64 */ nullptr,
76738b42b4aSDan Gohman /* FPTOSINT_PPCF128_I128 */ nullptr,
76838b42b4aSDan Gohman /* FPTOUINT_F32_I32 */ "__fixunssfsi",
76938b42b4aSDan Gohman /* FPTOUINT_F32_I64 */ "__fixunssfdi",
77038b42b4aSDan Gohman /* FPTOUINT_F32_I128 */ "__fixunssfti",
77138b42b4aSDan Gohman /* FPTOUINT_F64_I32 */ "__fixunsdfsi",
77238b42b4aSDan Gohman /* FPTOUINT_F64_I64 */ "__fixunsdfdi",
77338b42b4aSDan Gohman /* FPTOUINT_F64_I128 */ "__fixunsdfti",
77438b42b4aSDan Gohman /* FPTOUINT_F80_I32 */ "__fixunsxfsi",
77538b42b4aSDan Gohman /* FPTOUINT_F80_I64 */ "__fixunsxfdi",
77638b42b4aSDan Gohman /* FPTOUINT_F80_I128 */ "__fixunsxfti",
77738b42b4aSDan Gohman /* FPTOUINT_F128_I32 */ "__fixunstfsi",
77838b42b4aSDan Gohman /* FPTOUINT_F128_I64 */ "__fixunstfdi",
77938b42b4aSDan Gohman /* FPTOUINT_F128_I128 */ "__fixunstfti",
78038b42b4aSDan Gohman /* FPTOUINT_PPCF128_I32 */ nullptr,
78138b42b4aSDan Gohman /* FPTOUINT_PPCF128_I64 */ nullptr,
78238b42b4aSDan Gohman /* FPTOUINT_PPCF128_I128 */ nullptr,
78338b42b4aSDan Gohman /* SINTTOFP_I32_F32 */ "__floatsisf",
78438b42b4aSDan Gohman /* SINTTOFP_I32_F64 */ "__floatsidf",
78538b42b4aSDan Gohman /* SINTTOFP_I32_F80 */ nullptr,
78638b42b4aSDan Gohman /* SINTTOFP_I32_F128 */ "__floatsitf",
78738b42b4aSDan Gohman /* SINTTOFP_I32_PPCF128 */ nullptr,
78838b42b4aSDan Gohman /* SINTTOFP_I64_F32 */ "__floatdisf",
78938b42b4aSDan Gohman /* SINTTOFP_I64_F64 */ "__floatdidf",
79038b42b4aSDan Gohman /* SINTTOFP_I64_F80 */ nullptr,
79138b42b4aSDan Gohman /* SINTTOFP_I64_F128 */ "__floatditf",
79238b42b4aSDan Gohman /* SINTTOFP_I64_PPCF128 */ nullptr,
79338b42b4aSDan Gohman /* SINTTOFP_I128_F32 */ "__floattisf",
79438b42b4aSDan Gohman /* SINTTOFP_I128_F64 */ "__floattidf",
79538b42b4aSDan Gohman /* SINTTOFP_I128_F80 */ nullptr,
79638b42b4aSDan Gohman /* SINTTOFP_I128_F128 */ "__floattitf",
79738b42b4aSDan Gohman /* SINTTOFP_I128_PPCF128 */ nullptr,
79838b42b4aSDan Gohman /* UINTTOFP_I32_F32 */ "__floatunsisf",
79938b42b4aSDan Gohman /* UINTTOFP_I32_F64 */ "__floatunsidf",
80038b42b4aSDan Gohman /* UINTTOFP_I32_F80 */ nullptr,
80138b42b4aSDan Gohman /* UINTTOFP_I32_F128 */ "__floatunsitf",
80238b42b4aSDan Gohman /* UINTTOFP_I32_PPCF128 */ nullptr,
80338b42b4aSDan Gohman /* UINTTOFP_I64_F32 */ "__floatundisf",
80438b42b4aSDan Gohman /* UINTTOFP_I64_F64 */ "__floatundidf",
80538b42b4aSDan Gohman /* UINTTOFP_I64_F80 */ nullptr,
80638b42b4aSDan Gohman /* UINTTOFP_I64_F128 */ "__floatunditf",
80738b42b4aSDan Gohman /* UINTTOFP_I64_PPCF128 */ nullptr,
80838b42b4aSDan Gohman /* UINTTOFP_I128_F32 */ "__floatuntisf",
80938b42b4aSDan Gohman /* UINTTOFP_I128_F64 */ "__floatuntidf",
81038b42b4aSDan Gohman /* UINTTOFP_I128_F80 */ nullptr,
81138b42b4aSDan Gohman /* UINTTOFP_I128_F128 */ "__floatuntitf",
81238b42b4aSDan Gohman /* UINTTOFP_I128_PPCF128 */ nullptr,
81338b42b4aSDan Gohman /* OEQ_F32 */ "__eqsf2",
81438b42b4aSDan Gohman /* OEQ_F64 */ "__eqdf2",
81538b42b4aSDan Gohman /* OEQ_F128 */ "__eqtf2",
81638b42b4aSDan Gohman /* OEQ_PPCF128 */ nullptr,
81738b42b4aSDan Gohman /* UNE_F32 */ "__nesf2",
81838b42b4aSDan Gohman /* UNE_F64 */ "__nedf2",
81938b42b4aSDan Gohman /* UNE_F128 */ "__netf2",
82038b42b4aSDan Gohman /* UNE_PPCF128 */ nullptr,
82138b42b4aSDan Gohman /* OGE_F32 */ "__gesf2",
82238b42b4aSDan Gohman /* OGE_F64 */ "__gedf2",
82338b42b4aSDan Gohman /* OGE_F128 */ "__getf2",
82438b42b4aSDan Gohman /* OGE_PPCF128 */ nullptr,
82538b42b4aSDan Gohman /* OLT_F32 */ "__ltsf2",
82638b42b4aSDan Gohman /* OLT_F64 */ "__ltdf2",
82738b42b4aSDan Gohman /* OLT_F128 */ "__lttf2",
82838b42b4aSDan Gohman /* OLT_PPCF128 */ nullptr,
82938b42b4aSDan Gohman /* OLE_F32 */ "__lesf2",
83038b42b4aSDan Gohman /* OLE_F64 */ "__ledf2",
83138b42b4aSDan Gohman /* OLE_F128 */ "__letf2",
83238b42b4aSDan Gohman /* OLE_PPCF128 */ nullptr,
83338b42b4aSDan Gohman /* OGT_F32 */ "__gtsf2",
83438b42b4aSDan Gohman /* OGT_F64 */ "__gtdf2",
83538b42b4aSDan Gohman /* OGT_F128 */ "__gttf2",
83638b42b4aSDan Gohman /* OGT_PPCF128 */ nullptr,
83738b42b4aSDan Gohman /* UO_F32 */ "__unordsf2",
83838b42b4aSDan Gohman /* UO_F64 */ "__unorddf2",
83938b42b4aSDan Gohman /* UO_F128 */ "__unordtf2",
84038b42b4aSDan Gohman /* UO_PPCF128 */ nullptr,
84138b42b4aSDan Gohman /* O_F32 */ "__unordsf2",
84238b42b4aSDan Gohman /* O_F64 */ "__unorddf2",
84338b42b4aSDan Gohman /* O_F128 */ "__unordtf2",
84438b42b4aSDan Gohman /* O_PPCF128 */ nullptr,
84538b42b4aSDan Gohman /* MEMCPY */ "memcpy",
84638b42b4aSDan Gohman /* MEMMOVE */ "memset",
84738b42b4aSDan Gohman /* MEMSET */ "memmove",
84838b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_1 */ "MEMCPY_ELEMENT_ATOMIC_1",
84938b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_2 */ "MEMCPY_ELEMENT_ATOMIC_2",
85038b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_4 */ "MEMCPY_ELEMENT_ATOMIC_4",
85138b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_8 */ "MEMCPY_ELEMENT_ATOMIC_8",
85238b42b4aSDan Gohman /* MEMCPY_ELEMENT_ATOMIC_16 */ "MEMCPY_ELEMENT_ATOMIC_16",
853*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_1 */ nullptr,
854*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_2 */ nullptr,
855*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_4 */ nullptr,
856*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_8 */ nullptr,
857*c855c728SDaniel Neilson /* MEMMOVE_ELEMENT_UNORDERED_ATOMIC_16 */ nullptr,
85838b42b4aSDan Gohman /* UNWIND_RESUME */ "_Unwind_Resume",
85938b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_1 */ "__sync_val_compare_and_swap_1",
86038b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_2 */ "__sync_val_compare_and_swap_2",
86138b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_4 */ "__sync_val_compare_and_swap_4",
86238b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_8 */ "__sync_val_compare_and_swap_8",
86338b42b4aSDan Gohman /* SYNC_VAL_COMPARE_AND_SWAP_16 */ "__sync_val_compare_and_swap_16",
86438b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_1 */ "__sync_lock_test_and_set_1",
86538b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_2 */ "__sync_lock_test_and_set_2",
86638b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_4 */ "__sync_lock_test_and_set_4",
86738b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_8 */ "__sync_lock_test_and_set_8",
86838b42b4aSDan Gohman /* SYNC_LOCK_TEST_AND_SET_16 */ "__sync_lock_test_and_set_16",
86938b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_1 */ "__sync_fetch_and_add_1",
87038b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_2 */ "__sync_fetch_and_add_2",
87138b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_4 */ "__sync_fetch_and_add_4",
87238b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_8 */ "__sync_fetch_and_add_8",
87338b42b4aSDan Gohman /* SYNC_FETCH_AND_ADD_16 */ "__sync_fetch_and_add_16",
87438b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_1 */ "__sync_fetch_and_sub_1",
87538b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_2 */ "__sync_fetch_and_sub_2",
87638b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_4 */ "__sync_fetch_and_sub_4",
87738b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_8 */ "__sync_fetch_and_sub_8",
87838b42b4aSDan Gohman /* SYNC_FETCH_AND_SUB_16 */ "__sync_fetch_and_sub_16",
87938b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_1 */ "__sync_fetch_and_and_1",
88038b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_2 */ "__sync_fetch_and_and_2",
88138b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_4 */ "__sync_fetch_and_and_4",
88238b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_8 */ "__sync_fetch_and_and_8",
88338b42b4aSDan Gohman /* SYNC_FETCH_AND_AND_16 */ "__sync_fetch_and_and_16",
88438b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_1 */ "__sync_fetch_and_or_1",
88538b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_2 */ "__sync_fetch_and_or_2",
88638b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_4 */ "__sync_fetch_and_or_4",
88738b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_8 */ "__sync_fetch_and_or_8",
88838b42b4aSDan Gohman /* SYNC_FETCH_AND_OR_16 */ "__sync_fetch_and_or_16",
88938b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_1 */ "__sync_fetch_and_xor_1",
89038b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_2 */ "__sync_fetch_and_xor_2",
89138b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_4 */ "__sync_fetch_and_xor_4",
89238b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_8 */ "__sync_fetch_and_xor_8",
89338b42b4aSDan Gohman /* SYNC_FETCH_AND_XOR_16 */ "__sync_fetch_and_xor_16",
89438b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_1 */ "__sync_fetch_and_nand_1",
89538b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_2 */ "__sync_fetch_and_nand_2",
89638b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_4 */ "__sync_fetch_and_nand_4",
89738b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_8 */ "__sync_fetch_and_nand_8",
89838b42b4aSDan Gohman /* SYNC_FETCH_AND_NAND_16 */ "__sync_fetch_and_nand_16",
89938b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_1 */ "__sync_fetch_and_max_1",
90038b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_2 */ "__sync_fetch_and_max_2",
90138b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_4 */ "__sync_fetch_and_max_4",
90238b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_8 */ "__sync_fetch_and_max_8",
90338b42b4aSDan Gohman /* SYNC_FETCH_AND_MAX_16 */ "__sync_fetch_and_max_16",
90438b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_1 */ "__sync_fetch_and_umax_1",
90538b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_2 */ "__sync_fetch_and_umax_2",
90638b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_4 */ "__sync_fetch_and_umax_4",
90738b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_8 */ "__sync_fetch_and_umax_8",
90838b42b4aSDan Gohman /* SYNC_FETCH_AND_UMAX_16 */ "__sync_fetch_and_umax_16",
90938b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_1 */ "__sync_fetch_and_min_1",
91038b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_2 */ "__sync_fetch_and_min_2",
91138b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_4 */ "__sync_fetch_and_min_4",
91238b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_8 */ "__sync_fetch_and_min_8",
91338b42b4aSDan Gohman /* SYNC_FETCH_AND_MIN_16 */ "__sync_fetch_and_min_16",
91438b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_1 */ "__sync_fetch_and_umin_1",
91538b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_2 */ "__sync_fetch_and_umin_2",
91638b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_4 */ "__sync_fetch_and_umin_4",
91738b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_8 */ "__sync_fetch_and_umin_8",
91838b42b4aSDan Gohman /* SYNC_FETCH_AND_UMIN_16 */ "__sync_fetch_and_umin_16",
91938b42b4aSDan Gohman 
92038b42b4aSDan Gohman /* ATOMIC_LOAD */ "__atomic_load",
92138b42b4aSDan Gohman /* ATOMIC_LOAD_1 */ "__atomic_load_1",
92238b42b4aSDan Gohman /* ATOMIC_LOAD_2 */ "__atomic_load_2",
92338b42b4aSDan Gohman /* ATOMIC_LOAD_4 */ "__atomic_load_4",
92438b42b4aSDan Gohman /* ATOMIC_LOAD_8 */ "__atomic_load_8",
92538b42b4aSDan Gohman /* ATOMIC_LOAD_16 */ "__atomic_load_16",
92638b42b4aSDan Gohman 
92738b42b4aSDan Gohman /* ATOMIC_STORE */ "__atomic_store",
92838b42b4aSDan Gohman /* ATOMIC_STORE_1 */ "__atomic_store_1",
92938b42b4aSDan Gohman /* ATOMIC_STORE_2 */ "__atomic_store_2",
93038b42b4aSDan Gohman /* ATOMIC_STORE_4 */ "__atomic_store_4",
93138b42b4aSDan Gohman /* ATOMIC_STORE_8 */ "__atomic_store_8",
93238b42b4aSDan Gohman /* ATOMIC_STORE_16 */ "__atomic_store_16",
93338b42b4aSDan Gohman 
93438b42b4aSDan Gohman /* ATOMIC_EXCHANGE */ "__atomic_exchange",
93538b42b4aSDan Gohman /* ATOMIC_EXCHANGE_1 */ "__atomic_exchange_1",
93638b42b4aSDan Gohman /* ATOMIC_EXCHANGE_2 */ "__atomic_exchange_2",
93738b42b4aSDan Gohman /* ATOMIC_EXCHANGE_4 */ "__atomic_exchange_4",
93838b42b4aSDan Gohman /* ATOMIC_EXCHANGE_8 */ "__atomic_exchange_8",
93938b42b4aSDan Gohman /* ATOMIC_EXCHANGE_16 */ "__atomic_exchange_16",
94038b42b4aSDan Gohman 
94138b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE */ "__atomic_compare_exchange",
94238b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_1 */ "__atomic_compare_exchange_1",
94338b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_2 */ "__atomic_compare_exchange_2",
94438b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_4 */ "__atomic_compare_exchange_4",
94538b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_8 */ "__atomic_compare_exchange_8",
94638b42b4aSDan Gohman /* ATOMIC_COMPARE_EXCHANGE_16 */ "__atomic_compare_exchange_16",
94738b42b4aSDan Gohman 
94838b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_1 */ "__atomic_fetch_add_1",
94938b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_2 */ "__atomic_fetch_add_2",
95038b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_4 */ "__atomic_fetch_add_4",
95138b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_8 */ "__atomic_fetch_add_8",
95238b42b4aSDan Gohman /* ATOMIC_FETCH_ADD_16 */ "__atomic_fetch_add_16",
95338b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_1 */ "__atomic_fetch_sub_1",
95438b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_2 */ "__atomic_fetch_sub_2",
95538b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_4 */ "__atomic_fetch_sub_4",
95638b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_8 */ "__atomic_fetch_sub_8",
95738b42b4aSDan Gohman /* ATOMIC_FETCH_SUB_16 */ "__atomic_fetch_sub_16",
95838b42b4aSDan Gohman /* ATOMIC_FETCH_AND_1 */ "__atomic_fetch_and_1",
95938b42b4aSDan Gohman /* ATOMIC_FETCH_AND_2 */ "__atomic_fetch_and_2",
96038b42b4aSDan Gohman /* ATOMIC_FETCH_AND_4 */ "__atomic_fetch_and_4",
96138b42b4aSDan Gohman /* ATOMIC_FETCH_AND_8 */ "__atomic_fetch_and_8",
96238b42b4aSDan Gohman /* ATOMIC_FETCH_AND_16 */ "__atomic_fetch_and_16",
96338b42b4aSDan Gohman /* ATOMIC_FETCH_OR_1 */ "__atomic_fetch_or_1",
96438b42b4aSDan Gohman /* ATOMIC_FETCH_OR_2 */ "__atomic_fetch_or_2",
96538b42b4aSDan Gohman /* ATOMIC_FETCH_OR_4 */ "__atomic_fetch_or_4",
96638b42b4aSDan Gohman /* ATOMIC_FETCH_OR_8 */ "__atomic_fetch_or_8",
96738b42b4aSDan Gohman /* ATOMIC_FETCH_OR_16 */ "__atomic_fetch_or_16",
96838b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_1 */ "__atomic_fetch_xor_1",
96938b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_2 */ "__atomic_fetch_xor_2",
97038b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_4 */ "__atomic_fetch_xor_4",
97138b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_8 */ "__atomic_fetch_xor_8",
97238b42b4aSDan Gohman /* ATOMIC_FETCH_XOR_16 */ "__atomic_fetch_xor_16",
97338b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_1 */ "__atomic_fetch_nand_1",
97438b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_2 */ "__atomic_fetch_nand_2",
97538b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_4 */ "__atomic_fetch_nand_4",
97638b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_8 */ "__atomic_fetch_nand_8",
97738b42b4aSDan Gohman /* ATOMIC_FETCH_NAND_16 */ "__atomic_fetch_nand_16",
97838b42b4aSDan Gohman 
97938b42b4aSDan Gohman /* STACKPROTECTOR_CHECK_FAIL */ "__stack_chk_fail",
98038b42b4aSDan Gohman 
98138b42b4aSDan Gohman /* DEOPTIMIZE */ "__llvm_deoptimize",
98238b42b4aSDan Gohman };
98338b42b4aSDan Gohman 
98438b42b4aSDan Gohman void llvm::GetSignature(const WebAssemblySubtarget &Subtarget,
985e2688c43SDerek Schuff                         RTLIB::Libcall LC, SmallVectorImpl<wasm::ValType> &Rets,
986e2688c43SDerek Schuff                         SmallVectorImpl<wasm::ValType> &Params) {
98738b42b4aSDan Gohman   assert(Rets.empty());
98838b42b4aSDan Gohman   assert(Params.empty());
98938b42b4aSDan Gohman 
99038b42b4aSDan Gohman   WebAssembly::ExprType iPTR = Subtarget.hasAddr64() ?
99138b42b4aSDan Gohman                                WebAssembly::ExprType::I64 :
99238b42b4aSDan Gohman                                WebAssembly::ExprType::I32;
99338b42b4aSDan Gohman 
99438b42b4aSDan Gohman   switch (RuntimeLibcallSignatures[LC]) {
99538b42b4aSDan Gohman   case func:
99638b42b4aSDan Gohman     break;
99738b42b4aSDan Gohman   case f32_func_f32:
998e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
999e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
100038b42b4aSDan Gohman     break;
100138b42b4aSDan Gohman   case f32_func_f64:
1002e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1003e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
100438b42b4aSDan Gohman     break;
100538b42b4aSDan Gohman   case f32_func_i32:
1006e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1007e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
100838b42b4aSDan Gohman     break;
100938b42b4aSDan Gohman   case f32_func_i64:
1010e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1011e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
101238b42b4aSDan Gohman     break;
101338b42b4aSDan Gohman   case f32_func_i16:
1014e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1015e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
101638b42b4aSDan Gohman     break;
101738b42b4aSDan Gohman   case f64_func_f32:
1018e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1019e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
102038b42b4aSDan Gohman     break;
102138b42b4aSDan Gohman   case f64_func_f64:
1022e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1023e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
102438b42b4aSDan Gohman     break;
102538b42b4aSDan Gohman   case f64_func_i32:
1026e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1027e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
102838b42b4aSDan Gohman     break;
102938b42b4aSDan Gohman   case f64_func_i64:
1030e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1031e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
103238b42b4aSDan Gohman     break;
103338b42b4aSDan Gohman   case i32_func_f32:
1034e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1035e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
103638b42b4aSDan Gohman     break;
103738b42b4aSDan Gohman   case i32_func_f64:
1038e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1039e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
104038b42b4aSDan Gohman     break;
104138b42b4aSDan Gohman   case i32_func_i32:
1042e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1043e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
104438b42b4aSDan Gohman     break;
104538b42b4aSDan Gohman   case i64_func_f32:
1046e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1047e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
104838b42b4aSDan Gohman     break;
104938b42b4aSDan Gohman   case i64_func_f64:
1050e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1051e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
105238b42b4aSDan Gohman     break;
105338b42b4aSDan Gohman   case i64_func_i64:
1054e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1055e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
105638b42b4aSDan Gohman     break;
105738b42b4aSDan Gohman   case f32_func_f32_f32:
1058e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1059e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
1060e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
106138b42b4aSDan Gohman     break;
106238b42b4aSDan Gohman   case f32_func_f32_i32:
1063e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1064e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
1065e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
106638b42b4aSDan Gohman     break;
106738b42b4aSDan Gohman   case f32_func_i64_i64:
1068e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1069e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1070e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
107138b42b4aSDan Gohman     break;
107238b42b4aSDan Gohman   case f64_func_f64_f64:
1073e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1074e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
1075e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
107638b42b4aSDan Gohman     break;
107738b42b4aSDan Gohman   case f64_func_f64_i32:
1078e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1079e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
1080e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
108138b42b4aSDan Gohman     break;
108238b42b4aSDan Gohman   case f64_func_i64_i64:
1083e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1084e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1085e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
108638b42b4aSDan Gohman     break;
108738b42b4aSDan Gohman   case i16_func_f32:
1088e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1089e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
109038b42b4aSDan Gohman     break;
109138b42b4aSDan Gohman   case i8_func_i8_i8:
1092e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1093e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
1094e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
109538b42b4aSDan Gohman     break;
109638b42b4aSDan Gohman   case func_f32_iPTR_iPTR:
1097e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
1098e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1099e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
110038b42b4aSDan Gohman     break;
110138b42b4aSDan Gohman   case func_f64_iPTR_iPTR:
1102e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
1103e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1104e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
110538b42b4aSDan Gohman     break;
110638b42b4aSDan Gohman   case i16_func_i16_i16:
1107e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1108e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
1109e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
111038b42b4aSDan Gohman     break;
111138b42b4aSDan Gohman   case i32_func_f32_f32:
1112e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1113e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
1114e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
111538b42b4aSDan Gohman     break;
111638b42b4aSDan Gohman   case i32_func_f64_f64:
1117e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1118e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
1119e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
112038b42b4aSDan Gohman     break;
112138b42b4aSDan Gohman   case i32_func_i32_i32:
1122e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1123e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
1124e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
112538b42b4aSDan Gohman     break;
112638b42b4aSDan Gohman   case i64_func_i64_i64:
1127e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1128e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1129e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
113038b42b4aSDan Gohman     break;
113138b42b4aSDan Gohman   case i64_i64_func_f32:
113238b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1133e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1134e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
113538b42b4aSDan Gohman #else
1136e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
113738b42b4aSDan Gohman #endif
1138e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
113938b42b4aSDan Gohman     break;
114038b42b4aSDan Gohman   case i64_i64_func_f64:
114138b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1142e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1143e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
114438b42b4aSDan Gohman #else
1145e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
114638b42b4aSDan Gohman #endif
1147e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
114838b42b4aSDan Gohman     break;
114938b42b4aSDan Gohman   case i16_i16_func_i16_i16:
115038b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1151e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1152e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
115338b42b4aSDan Gohman #else
1154e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
115538b42b4aSDan Gohman #endif
1156e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
1157e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
115838b42b4aSDan Gohman     break;
115938b42b4aSDan Gohman   case i32_i32_func_i32_i32:
116038b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1161e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1162e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
116338b42b4aSDan Gohman #else
1164e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
116538b42b4aSDan Gohman #endif
1166e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
1167e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
116838b42b4aSDan Gohman     break;
116938b42b4aSDan Gohman   case i64_i64_func_i64_i64:
117038b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1171e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1172e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
117338b42b4aSDan Gohman #else
1174e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
117538b42b4aSDan Gohman #endif
1176e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1177e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
117838b42b4aSDan Gohman     break;
117938b42b4aSDan Gohman   case i64_i64_func_i64_i64_i64_i64:
118038b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1181e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1182e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
118338b42b4aSDan Gohman #else
1184e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
118538b42b4aSDan Gohman #endif
1186e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1187e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1188e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1189e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
119038b42b4aSDan Gohman     break;
119138b42b4aSDan Gohman   case i64_i64_i64_i64_func_i64_i64_i64_i64:
119238b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1193e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1194e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1195e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1196e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
119738b42b4aSDan Gohman #else
1198e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
119938b42b4aSDan Gohman #endif
1200e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1201e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1202e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1203e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
120438b42b4aSDan Gohman     break;
120538b42b4aSDan Gohman   case i64_i64_func_i64_i64_i32:
120638b42b4aSDan Gohman #if 0 // TODO: Enable this when wasm gets multiple-return-value support.
1207e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1208e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1209e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
1210e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I64);
121138b42b4aSDan Gohman #else
1212e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
121338b42b4aSDan Gohman #endif
1214e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1215e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1216e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
121738b42b4aSDan Gohman     break;
121838b42b4aSDan Gohman   case iPTR_func_iPTR_i32_iPTR:
1219e2688c43SDerek Schuff     Rets.push_back(wasm::ValType(iPTR));
1220e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1221e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
1222e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
122338b42b4aSDan Gohman     break;
122438b42b4aSDan Gohman   case iPTR_func_iPTR_iPTR_iPTR:
1225e2688c43SDerek Schuff     Rets.push_back(wasm::ValType(iPTR));
1226e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1227e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1228e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
122938b42b4aSDan Gohman     break;
123038b42b4aSDan Gohman   case f32_func_f32_f32_f32:
1231e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F32);
1232e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
1233e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
1234e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
123538b42b4aSDan Gohman     break;
123638b42b4aSDan Gohman   case f64_func_f64_f64_f64:
1237e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::F64);
1238e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
1239e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
1240e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
124138b42b4aSDan Gohman     break;
124238b42b4aSDan Gohman   case func_i64_i64_iPTR_iPTR:
1243e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1244e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1245e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1246e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
124738b42b4aSDan Gohman     break;
124838b42b4aSDan Gohman   case func_iPTR_f32:
1249e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1250e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F32);
125138b42b4aSDan Gohman     break;
125238b42b4aSDan Gohman   case func_iPTR_f64:
1253e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1254e2688c43SDerek Schuff     Params.push_back(wasm::ValType::F64);
125538b42b4aSDan Gohman     break;
125638b42b4aSDan Gohman   case func_iPTR_i32:
1257e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1258e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I32);
125938b42b4aSDan Gohman     break;
126038b42b4aSDan Gohman   case func_iPTR_i64:
1261e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1262e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
126338b42b4aSDan Gohman     break;
126438b42b4aSDan Gohman   case func_iPTR_i64_i64:
1265e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1266e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1267e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
126838b42b4aSDan Gohman     break;
126938b42b4aSDan Gohman   case func_iPTR_i64_i64_i64_i64:
1270e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1271e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1272e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1273e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1274e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
127538b42b4aSDan Gohman     break;
127638b42b4aSDan Gohman   case func_iPTR_i64_i64_i64_i64_i64_i64:
1277e2688c43SDerek Schuff     Params.push_back(wasm::ValType(iPTR));
1278e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1279e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1280e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1281e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1282e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1283e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
128438b42b4aSDan Gohman     break;
128538b42b4aSDan Gohman   case i32_func_i64_i64:
1286e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1287e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1288e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
128938b42b4aSDan Gohman     break;
129038b42b4aSDan Gohman   case i32_func_i64_i64_i64_i64:
1291e2688c43SDerek Schuff     Rets.push_back(wasm::ValType::I32);
1292e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1293e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1294e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
1295e2688c43SDerek Schuff     Params.push_back(wasm::ValType::I64);
129638b42b4aSDan Gohman     break;
129738b42b4aSDan Gohman   case unsupported:
129838b42b4aSDan Gohman     llvm_unreachable("unsupported runtime library signature");
129938b42b4aSDan Gohman   }
130038b42b4aSDan Gohman }
130138b42b4aSDan Gohman 
1302e2688c43SDerek Schuff void llvm::GetSignature(const WebAssemblySubtarget &Subtarget, const char *Name,
1303e2688c43SDerek Schuff                         SmallVectorImpl<wasm::ValType> &Rets,
1304e2688c43SDerek Schuff                         SmallVectorImpl<wasm::ValType> &Params) {
130538b42b4aSDan Gohman   assert(strcmp(RuntimeLibcallNames[RTLIB::DEOPTIMIZE], "__llvm_deoptimize") ==
130638b42b4aSDan Gohman          0);
130738b42b4aSDan Gohman 
130838b42b4aSDan Gohman   for (size_t i = 0, e = RTLIB::UNKNOWN_LIBCALL; i < e; ++i)
130938b42b4aSDan Gohman     if (RuntimeLibcallNames[i] && strcmp(RuntimeLibcallNames[i], Name) == 0)
131038b42b4aSDan Gohman       return GetSignature(Subtarget, RTLIB::Libcall(i), Rets, Params);
131138b42b4aSDan Gohman 
131238b42b4aSDan Gohman   llvm_unreachable("unexpected runtime library name");
131338b42b4aSDan Gohman }
1314