@@ -8,6 +8,7 @@ use gccjit::{ComparisonOp, FunctionType, RValue, ToRValue, Type, UnaryOp, Binary
8
8
use rustc_codegen_ssa:: common:: { IntPredicate , TypeKind } ;
9
9
use rustc_codegen_ssa:: traits:: { BackendTypes , BaseTypeMethods , BuilderMethods , OverflowOp } ;
10
10
use rustc_middle:: ty:: Ty ;
11
+ use rustc_target:: abi:: Endian ;
11
12
12
13
use crate :: builder:: ToGccComp ;
13
14
use crate :: { builder:: Builder , common:: { SignType , TypeReflection } , context:: CodegenCx } ;
@@ -792,10 +793,16 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
792
793
}
793
794
794
795
fn from_low_high ( & self , typ : Type < ' gcc > , low : i64 , high : i64 ) -> RValue < ' gcc > {
796
+ let ( first, last) =
797
+ match self . sess ( ) . target . options . endian {
798
+ Endian :: Little => ( low, high) ,
799
+ Endian :: Big => ( high, low) ,
800
+ } ;
801
+
795
802
let native_int_type = typ. dyncast_array ( ) . expect ( "get element type" ) ;
796
803
let values = [
797
- self . context . new_rvalue_from_long ( native_int_type, low ) ,
798
- self . context . new_rvalue_from_long ( native_int_type, high ) ,
804
+ self . context . new_rvalue_from_long ( native_int_type, first ) ,
805
+ self . context . new_rvalue_from_long ( native_int_type, last ) ,
799
806
] ;
800
807
self . context . new_array_constructor ( None , typ, & values)
801
808
}
0 commit comments