@@ -4,7 +4,9 @@ mod simd;
4
4
#[ cfg( feature="master" ) ]
5
5
use std:: iter;
6
6
7
- use gccjit:: { ComparisonOp , Function , RValue , ToRValue , Type , UnaryOp , FunctionType } ;
7
+ #[ cfg( feature="master" ) ]
8
+ use gccjit:: FunctionType ;
9
+ use gccjit:: { ComparisonOp , Function , RValue , ToRValue , Type , UnaryOp } ;
8
10
use rustc_codegen_ssa:: MemFlags ;
9
11
use rustc_codegen_ssa:: base:: wants_msvc_seh;
10
12
use rustc_codegen_ssa:: common:: IntPredicate ;
@@ -143,11 +145,15 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
143
145
144
146
sym:: volatile_load | sym:: unaligned_volatile_load => {
145
147
let tp_ty = fn_args. type_at ( 0 ) ;
146
- let mut ptr = args[ 0 ] . immediate ( ) ;
147
- if let PassMode :: Cast { cast : ty, .. } = & fn_abi. ret . mode {
148
- ptr = self . pointercast ( ptr, self . type_ptr_to ( ty. gcc_type ( self ) ) ) ;
149
- }
150
- let load = self . volatile_load ( ptr. get_type ( ) , ptr) ;
148
+ let ptr = args[ 0 ] . immediate ( ) ;
149
+ let load =
150
+ if let PassMode :: Cast { cast : ty, pad_i32 : _ } = & fn_abi. ret . mode {
151
+ let gcc_ty = ty. gcc_type ( self ) ;
152
+ self . volatile_load ( gcc_ty, ptr)
153
+ }
154
+ else {
155
+ self . volatile_load ( self . layout_of ( tp_ty) . gcc_type ( self ) , ptr)
156
+ } ;
151
157
// TODO(antoyo): set alignment.
152
158
self . to_immediate ( load, self . layout_of ( tp_ty) )
153
159
}
0 commit comments