File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed
compiler-rt/compiler-rt-cdylib Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,17 @@ fn main() {
6060 "addsf3.c" ,
6161 "powidf2.c" ,
6262 "powisf2.c" ,
63+ // 128 bit integers
64+ "lshrti3.c" ,
65+ "modti3.c" ,
66+ "muloti4.c" ,
67+ "multi3.c" ,
68+ "udivmodti4.c" ,
69+ "udivti3.c" ,
70+ "umodti3.c" ,
71+ "ashlti3.c" ,
72+ "ashrti3.c" ,
73+ "divti3.c" ,
6374 ] ) ;
6475
6576 for src in sources. files . iter ( ) {
Original file line number Diff line number Diff line change @@ -58,6 +58,33 @@ declare!(___adddf3, __adddf3);
5858declare ! ( ___powisf2, __powisf2) ;
5959declare ! ( ___powidf2, __powidf2) ;
6060
61+ #[ cfg( all( not( windows) , target_pointer_width="64" ) ) ]
62+ pub mod int_128 {
63+ extern {
64+ fn __lshrti3 ( ) ;
65+ fn __modti3 ( ) ;
66+ fn __muloti4 ( ) ;
67+ fn __multi3 ( ) ;
68+ fn __udivmodti4 ( ) ;
69+ fn __udivti3 ( ) ;
70+ fn __umodti3 ( ) ;
71+ fn __ashlti3 ( ) ;
72+ fn __ashrti3 ( ) ;
73+ fn __divti3 ( ) ;
74+ }
75+
76+ declare ! ( ___lshrti3, __lshrti3) ;
77+ declare ! ( ___modti3, __modti3) ;
78+ declare ! ( ___muloti4, __muloti4) ;
79+ declare ! ( ___multi3, __multi3) ;
80+ declare ! ( ___udivmodti4, __udivmodti4) ;
81+ declare ! ( ___udivti3, __udivti3) ;
82+ declare ! ( ___umodti3, __umodti3) ;
83+ declare ! ( ___ashlti3, __ashlti3) ;
84+ declare ! ( ___ashrti3, __ashrti3) ;
85+ declare ! ( ___divti3, __divti3) ;
86+ }
87+
6188#[ lang = "eh_personality" ]
6289fn eh_personality ( ) { }
6390#[ lang = "panic_fmt" ]
Original file line number Diff line number Diff line change @@ -120,3 +120,27 @@ mod tests {
120120 }
121121 }
122122}
123+
124+ #[ cfg( test) ]
125+ #[ cfg( all( not( windows) , target_pointer_width="64" ) ) ]
126+ mod tests_i128 {
127+ use qc:: I128 ;
128+
129+ check ! {
130+ fn __multi3( f: extern fn ( i128 , i128 ) -> i128 , a: I128 , b: I128 )
131+ -> Option <i128 > {
132+ Some ( f( a. 0 , b. 0 ) )
133+ }
134+ fn __muloti4( f: extern fn ( i128 , i128 , & mut i32 ) -> i128 ,
135+ a: I128 ,
136+ b: I128 ) -> Option <( i128 , i32 ) > {
137+ let ( a, b) = ( a. 0 , b. 0 ) ;
138+ let mut overflow = 2 ;
139+ let r = f( a, b, & mut overflow) ;
140+ if overflow != 0 && overflow != 1 {
141+ return None
142+ }
143+ Some ( ( r, overflow) )
144+ }
145+ }
146+ }
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ macro_rules! arbitrary_large {
144144
145145arbitrary_large ! ( I64 : i64 ) ;
146146arbitrary_large ! ( U64 : u64 ) ;
147+ arbitrary_large ! ( I128 : i128 ) ;
148+ arbitrary_large ! ( U128 : u128 ) ;
147149
148150macro_rules! arbitrary_float {
149151 ( $TY: ident : $ty: ident) => {
You can’t perform that action at this time.
0 commit comments