@@ -128,33 +128,28 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
128
128
}
129
129
130
130
fn const_uint_big ( & self , typ : Type < ' gcc > , num : u128 ) -> RValue < ' gcc > {
131
- println ! ( "Num: {:?}" , num) ;
132
131
let num64: Result < i64 , _ > = num. try_into ( ) ;
133
132
if let Ok ( num) = num64 {
134
- println ! ( "1" ) ;
135
133
// FIXME: workaround for a bug where libgccjit is expecting a constant.
136
134
// The operations >> 64 and | low are making the normal case a non-constant.
137
135
return self . context . new_rvalue_from_long ( typ, num as i64 ) ;
138
136
}
139
137
140
138
if num >> 64 != 0 {
141
- println ! ( "2" ) ;
142
139
// FIXME: use a new function new_rvalue_from_unsigned_long()?
143
140
let low = self . context . new_rvalue_from_long ( self . u64_type , num as u64 as i64 ) ;
144
141
let high = self . context . new_rvalue_from_long ( typ, ( num >> 64 ) as u64 as i64 ) ;
145
142
146
143
let sixty_four = self . context . new_rvalue_from_long ( typ, 64 ) ;
147
144
( high << sixty_four) | self . context . new_cast ( None , low, typ)
148
145
}
146
+ else if typ. is_i128 ( self ) {
147
+ let num = self . context . new_rvalue_from_long ( self . u64_type , num as u64 as i64 ) ;
148
+ self . context . new_cast ( None , num, typ)
149
+ }
149
150
else {
150
- println ! ( "3" ) ;
151
151
self . context . new_rvalue_from_long ( typ, num as u64 as i64 )
152
152
}
153
-
154
- /*unsafe {
155
- let words = [u as u64, (u >> 64) as u64];
156
- llvm::LLVMConstIntOfArbitraryPrecision(t, 2, words.as_ptr())
157
- }*/
158
153
}
159
154
160
155
fn const_bool ( & self , val : bool ) -> RValue < ' gcc > {
0 commit comments