@@ -127,6 +127,9 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>(
127
127
likely | unlikely, ( c a) {
128
128
ret. write_cvalue( fx, a) ;
129
129
} ;
130
+ breakpoint, ( ) {
131
+ fx. bcx. ins( ) . debugtrap( ) ;
132
+ } ;
130
133
copy | copy_nonoverlapping, <elem_ty> ( v src, v dst, v count) {
131
134
let elem_size: u64 = fx. layout_of( elem_ty) . size. bytes( ) ;
132
135
let elem_size = fx
@@ -286,8 +289,12 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>(
286
289
let res = fx. bcx. ins( ) . rotr( x, y) ;
287
290
ret. write_cvalue( fx, CValue :: ByVal ( res, layout) ) ;
288
291
} ;
289
- offset, ( v base, v offset) {
290
- let res = fx. bcx. ins( ) . iadd( base, offset) ;
292
+ offset, ( c base, v offset) {
293
+ let pointee_ty = base. layout( ) . ty. builtin_deref( true ) . unwrap( ) . ty;
294
+ let pointee_size = fx. layout_of( pointee_ty) . size. bytes( ) ;
295
+ let ptr_diff = fx. bcx. ins( ) . imul_imm( offset, pointee_size as i64 ) ;
296
+ let base_val = base. load_scalar( fx) ;
297
+ let res = fx. bcx. ins( ) . iadd( base_val, ptr_diff) ;
291
298
ret. write_cvalue( fx, CValue :: ByVal ( res, args[ 0 ] . layout( ) ) ) ;
292
299
} ;
293
300
transmute, <src_ty, dst_ty> ( c from) {
0 commit comments