1==============================================
2libbcc Compiler Runtime Function Documentation
3==============================================
4
5Integer Arithmetic Routines
6---------------------------
7
8*Arithmetic Functions*::
9
10  __ashldi3 : long (long a, int b)  // a << b [[llvm]]
11  __ashrdi3 : long (long a, int b)  // a / 2**b (i.e. arithmetic a >> b) [[llvm]]
12  __divdi3 : long (long a, long b)  // a / b [[llvm]]
13  __lshrdi3 : long (long a, int b)  // a >> b (without sign extension) [[llvm]]
14  __moddi3 : long (long a, long b)  // a % b [[llvm]]
15  __muldi3 : long (long a, long b)  // a * b [[llvm]]
16  __muldsi3 : long (int a, int b)   // (long)a * (long)b  [[llvm compiler-rt extension]] [[llvm]]
17  __negdi2 : long (long a)          // -a [[llvm]]
18  __udivsi3 : unsigned int (unsigned int a, unsigned int b)     // unsigned int a / b [[llvm]]
19  __udivdi3 : unsigned long (unsigned long a, unsigned long a)  // unsigned long a / b [[llvm]]
20  __udivmoddi4 : unsigned long (unsigned long a, unsigned long b, unsigned long *rem)  // unsigned long a/b and a%b [[llvm]]
21  __umoddi3 : unsigned long (unsigned long a, unsigned long b)  // unsigned long a % b [[llvm]]
22
23*Comparison functions*::
24
25  __cmpdi2 : int (long a, long b)                     // Signed comparison of a and b.  (if a < b then return 0.  if a == b then return 1.  if a > b then return 2.) [[llvm]]
26  __ucmpdi2 : int (unsigned long a, unsigned long a)  // Unsigned comparison of a and b.  (if a < b then return 0.  if a == b then return 1.  if a > b then return 2.) [[llvm]]
27
28*Trapping arithmetic functions*::
29
30  __absvsi2 : int (int a)            // |a| [[llvm]]
31  __absvdi2 : long (long a)          // |a| [[llvm]]
32  __addvsi3 : int (int a, int b)     // a + b [[llvm]]
33  __addvdi3 : long (long a, long b)  // a + b [[llvm]]
34  __mulvsi3 : int (int a, int b)     // a * b [[llvm]]
35  __mulvdi3 : long (long a, long b)  // a * b [[llvm]]
36  __negvsi2 : int (int a)            // -a [[llvm]]
37  __negvdi2 : long (long a)          // -a [[llvm]]
38  __subvsi3 : int (int a, int b)     // a - b [[llvm]]
39  __subvdi3 : long (long a, long b)  // a - b [[llvm]]
40
41*Bit operations*::
42
43  __clzsi2 : int (int a)      // number of leading 0-bits in a from MSB [[llvm]]
44  __clzdi2 : int (long a)     // number of leading 0-bits in a from MSB [[llvm]]
45  __ctzsi2 : int (int a)      // number of trailing 0-bits in a from LSB [[llvm]]
46  __ctzdi2 : int (long a)     // number of trailing 0-bits in a from LSB [[llvm]]
47  __ffsdi2 : int (long a)     // index of the least significant 1-bit [[llvm]]
48  __paritysi2 : int (int a)   // parity (if number of 1-bits is even, then return 0) [[llvm]]
49  __paritydi2 : int (long a)  // parity (if number of 1-bits is even, then return 0) [[llvm]]
50  __popcountsi2 : int (int a)       // number of 1-bits [[llvm]]
51  __popcountdi2 : int (long a)      // number of 1-bits [[llvm]]
52  __bswapsi2 : uint32_t (uint32_t)  // reverse the byte order [[generic]]
53  __bswapdi2 : uint64_t (uint64_t)  // reverse the byte order [[generic]]
54
55Floating Point Emulation Routines
56---------------------------------
57
58*Arithmetic functions*::
59
60  __addsf3 : float (float a, float b)      // a + b [[vfp]] [[generic]]
61  __adddf3 : double (double a, double b)   // a + b [[vfp]] [[generic]]
62  __subsf3 : float (float a, float b)      // a - b [[vfp]] [[generic]]
63  __subdf3 : double (double a, double b)   // a - b [[vfp]] [[generic]]
64  __mulsf3 : float (float a, float b)      // a * b [[vfp]] [[generic]]
65  __muldf3 : double (double a, double b)   // a * b [[vfp]] [[generic]]
66  __divsf3 : float (float a, float b)      // a / b [[vfp]] [[generic]]
67  __divdf3 : double (double a, double b)   // a / b [[vfp]] [[generic]]
68  __negsf2 : float (float a)               // -a [[vfp]] [[generic]]
69  __negdf2 : double (double a)             // -a [[vfp]] [[generic]]
70
71*Conversion functions*::
72
73  __extendsfdf2 : double (float a)         // (double)a [[vfp]] [[generic]]
74  __truncdfsf2 : float (double a)          // (float)a [[vfp]] [[generic]]
75  __fixsfsi : int (float a)                // (int)a, rounding toward 0 [[vfp]] [[generic]]
76  __fixdfsi : int (double a)               // (int)a, rounding toward 0 [[vfp]] [[generic]]
77  __fixsfdi : long (float a)               // (long)a, rounding toward 0 [[llvm]]
78  __fixdfdi : long (double a)              // (long)a, rounding toward 0 [[llvm]]
79  __fixunssfsi : unsigned int (float a)    // (unsigned int)a, rounding toward 0, negative number will be 0. [[vfp]] [[llvm]]
80  __fixunsdfsi : unsigned int (double a)   // (unsigned int)a, rounding toward 0, negative number will be 0. [[vfp]] [[llvm]]
81  __fixunssfdi : unsigned long (float a)   // (unsigned long)a, rounding toward 0, negative number will be 0. [[llvm]]
82  __fixunsdfdi : unsigned long (double a)  // (unsigned long)a, rounding toward 0, negative number will be 0. [[llvm]]
83  __floatsisf : float (int i)              // (float)i [[vfp]] [[generic]]
84  __floatsidf : double (int i)             // (double)i [[vfp]] [[generic]]
85  __floatdisf : float (long i)             // (float) i [[llvm]]
86  __floatdidf : double (long i)            // (double)i [[llvm]]
87  __floatunsisf : float (unsigned int i)   // (float)i [[generic]]
88  __floatunsidf : double (unsigned int i)  // (double)i [[generic]]
89  __floatunssisfvfp : float (unsigned int i)   // (float)i  [[llvm compiler-rt extension]] [[vfp]]
90  __floatunssidfvfp : double (unsigned int i)  // (double)i  [[llvm compiler-rt extension]] [[vfp]]
91  __floatundisf : float (unsigned long i)  // (float)i [[llvm]]
92  __floatundidf : double (unsigned long i) // (double)i [[llvm]]
93  __unordsf2 : int (float a, float b)      // if a == NaN or b == NaN, then return non-zero. [[vfp]] [[generic]]
94  __unorddf2 : int (double a, double b)    // if a == NaN or b == NaN, then return non-zero. [[vfp]] [[generic]]
95  __eqsf2 : int (float a, float b)         // a != b  (i.e. return 0 when a == b) (note: NaN != NaN) [[vfp]] [[generic]]
96  __eqdf2 : int (double a, double b)       // a != b (i.e. return 0 when a == b) (note: NaN != NaN) [[vfp]] [[generic]]
97  __nesf2 : int (float a, float b)         // a != b || a == NaN || b == NaN [[vfp]]
98  __nedf2 : int (double a, double b)       // a != b || a == NaN || b == NaN [[vfp]]
99  __gesf2 : int (float a, float b)         // (a >= b) ? nonnegative_value : negative_value [[vfp]] [[generic]]
100  __gedf2 : int (double a, double b)       // (a >= b) ? nonnegative_value : negative_value [[vfp]] [[generic]]
101  __ltsf2 : int (float a, float b)         // (a < b) ? negative_value : nonnegative_value [[vfp]]
102  __ltdf2 : int (double a, double b)       // (a < b) ? negative_value : nonnegative_value [[vfp]]
103  __lesf2 : int (float a, float b)         // (a <= b) ? nonpositive_value : positive_value [[vfp]] [[generic]]
104  __ledf2 : int (double a, double b)       // (a <= b) ? nonpositive_value : positive_value [[vfp]] [[generic]]
105  __gtsf2 : int (float a, float b)         // (a > b) ? positive_value : nonpositive_value [[vfp]]
106  __gtdf2 : int (double a, double b)       // (a > b) ? positive_value : nonpositive_value [[vfp]]
107
108*Other floating-point functions*::
109
110  __powisf2 : float (float a, int b)       // a**b [[llvm]]
111  __powidf2 : double (double a, int b)     // a**b [[llvm]]
112  __mulsc3 : complex_float (float a, float b, float c, float d)       // (a+bi) * (c+di) [[llvm]]
113  __muldc3 : complex_double (double a, double b, double c, double d)  // (a+bi) * (c+di) [[llvm]]
114  __divsc3 : complex_float (float a, float b, float c, float d)       // (a+bi) / (c+di) [[llvm]]
115  __divdc3 : complex_double (double a, double b, double c, double d)  // (a+bi) / (c+di) [[llvm]]
116
117
118
119Miscellaneous Routines
120----------------------
121
122::
123
124  __eprintf : void (char const *, char const *, char const *, char const *)  // fprintf for assertions [[llvm compiler-rt extension]] [[llvm]]
125