• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- subzero/runtime/szrt.c - Subzero runtime source ----------*- C++ -*-===//
2 //
3 //                        The Subzero Code Generator
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 implements wrappers for particular bitcode instructions
11 // that are too uncommon and complex for a particular target to bother
12 // implementing directly in Subzero target lowering.  This needs to be
13 // compiled by some non-Subzero compiler.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #include <stdint.h>
18 
__Sz_fptoui_f32_i32(float value)19 uint32_t __Sz_fptoui_f32_i32(float value) { return (uint32_t)value; }
20 
__Sz_fptoui_f64_i32(double value)21 uint32_t __Sz_fptoui_f64_i32(double value) { return (uint32_t)value; }
22 
__Sz_fptoui_f32_i64(float Value)23 uint64_t __Sz_fptoui_f32_i64(float Value) { return (uint64_t)Value; }
24 
__Sz_fptoui_f64_i64(double Value)25 uint64_t __Sz_fptoui_f64_i64(double Value) { return (uint64_t)Value; }
26 
__Sz_fptosi_f32_i64(float Value)27 int64_t __Sz_fptosi_f32_i64(float Value) { return (int64_t)Value; }
28 
__Sz_fptosi_f64_i64(double Value)29 int64_t __Sz_fptosi_f64_i64(double Value) { return (int64_t)Value; }
30 
__Sz_uitofp_i32_f32(uint32_t Value)31 float __Sz_uitofp_i32_f32(uint32_t Value) { return (float)Value; }
32 
__Sz_uitofp_i64_f32(uint64_t Value)33 float __Sz_uitofp_i64_f32(uint64_t Value) { return (float)Value; }
34 
__Sz_uitofp_i32_f64(uint32_t Value)35 double __Sz_uitofp_i32_f64(uint32_t Value) { return (double)Value; }
36 
__Sz_uitofp_i64_f64(uint64_t Value)37 double __Sz_uitofp_i64_f64(uint64_t Value) { return (double)Value; }
38 
__Sz_sitofp_i64_f32(int64_t Value)39 float __Sz_sitofp_i64_f32(int64_t Value) { return (float)Value; }
40 
__Sz_sitofp_i64_f64(int64_t Value)41 double __Sz_sitofp_i64_f64(int64_t Value) { return (double)Value; }
42 
43 // Other helper calls emitted by Subzero but not implemented here:
44 // Compiler-rt:
45 //   __udivsi3     - udiv i32
46 //   __divsi3      - sdiv i32
47 //   __umodsi3     - urem i32
48 //   __modsi3      - srem i32
49 //   __udivdi3     - udiv i64
50 //   __divdi3      - sdiv i64
51 //   __umoddi3     - urem i64
52 //   __moddi3      - srem i64
53 //   __popcountsi2 - call @llvm.ctpop.i32
54 //   __popcountdi2 - call @llvm.ctpop.i64
55 // libm:
56 //   fmodf - frem f32
57 //   fmod  - frem f64
58 // libc:
59 //   setjmp  - call @llvm.nacl.setjmp
60 //   longjmp - call @llvm.nacl.longjmp
61 //   memcpy  - call @llvm.memcpy.p0i8.p0i8.i32
62 //   memmove - call @llvm.memmove.p0i8.p0i8.i32
63 //   memset  - call @llvm.memset.p0i8.i32
64 // unsandboxed_irt:
65 //   __nacl_read_tp
66 //   __aeabi_read_tp [arm32 only]
67 // MIPS runtime library:
68 // __sync_fetch_and_add_8
69 // __sync_fetch_and_and_8
70 // __sync_fetch_and_or_8
71 // __sync_fetch_and_sub_8
72 // __sync_fetch_and_xor_8
73 // __sync_lock_test_and_set_8
74 // __sync_val_compare_and_swap_8
75