File tree 3 files changed +16
-11
lines changed
compiler/rustc_middle/src/ty
3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -2848,7 +2848,7 @@ where
2848
2848
|| abi == SpecAbi :: RustIntrinsic
2849
2849
|| abi == SpecAbi :: PlatformIntrinsic
2850
2850
{
2851
- let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > , is_ret : bool | {
2851
+ let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > | {
2852
2852
if arg. is_ignore ( ) {
2853
2853
return ;
2854
2854
}
@@ -2886,9 +2886,9 @@ where
2886
2886
_ => return ,
2887
2887
}
2888
2888
2889
- // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
2890
- // will usually return these in 2 registers, which is more efficient than by-ref.
2891
- let max_by_val_size = if is_ret { Pointer . size ( cx) * 2 } else { Pointer . size ( cx ) } ;
2889
+ // Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`.
2890
+ // LLVM will usually pass these in 2 registers, which is more efficient than by-ref.
2891
+ let max_by_val_size = Pointer . size ( cx) * 2 ;
2892
2892
let size = arg. layout . size ;
2893
2893
2894
2894
if arg. layout . is_unsized ( ) || size > max_by_val_size {
@@ -2900,9 +2900,9 @@ where
2900
2900
arg. cast_to ( Reg { kind : RegKind :: Integer , size } ) ;
2901
2901
}
2902
2902
} ;
2903
- fixup ( & mut self . ret , true ) ;
2903
+ fixup ( & mut self . ret ) ;
2904
2904
for arg in & mut self . args {
2905
- fixup ( arg, false ) ;
2905
+ fixup ( arg) ;
2906
2906
}
2907
2907
return ;
2908
2908
}
Original file line number Diff line number Diff line change 1
- //! This test checks that types of up to 128 bits are returned by-value instead of via out- pointer.
1
+ //! Check that types of up to 128 bits are passed and returned by-value instead of via pointer.
2
2
3
3
// compile-flags: -C no-prepopulate-passes -O
4
4
// only-x86_64
@@ -11,7 +11,7 @@ pub struct S {
11
11
c : u32 ,
12
12
}
13
13
14
- // CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s )
14
+ // CHECK: define i128 @modify(i128{{( %0)?}} )
15
15
#[ no_mangle]
16
16
pub fn modify ( s : S ) -> S {
17
17
S { a : s. a + s. a , b : s. b + s. b , c : s. c + s. c }
Original file line number Diff line number Diff line change @@ -63,11 +63,16 @@ pub union UnionU128{a:u128}
63
63
#[ no_mangle]
64
64
pub fn test_UnionU128 ( _: UnionU128 ) -> UnionU128 { loop { } }
65
65
66
+ pub union UnionU128x2 { a : ( u128 , u128 ) }
67
+ // CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1)
68
+ #[ no_mangle]
69
+ pub fn test_UnionU128x2 ( _: UnionU128x2 ) { loop { } }
70
+
66
71
#[ repr( C ) ]
67
- pub union CUnionU128 { a : u128 }
68
- // CHECK: define void @test_CUnionU128(%CUnionU128 * {{.*}} %_1)
72
+ pub union CUnionU128x2 { a : ( u128 , u128 ) }
73
+ // CHECK: define void @test_CUnionU128x2(%CUnionU128x2 * {{.*}} %_1)
69
74
#[ no_mangle]
70
- pub fn test_CUnionU128 ( _: CUnionU128 ) { loop { } }
75
+ pub fn test_CUnionU128x2 ( _: CUnionU128x2 ) { loop { } }
71
76
72
77
pub union UnionBool { b : bool }
73
78
// CHECK: define zeroext i1 @test_UnionBool(i8 %b)
You can’t perform that action at this time.
0 commit comments