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 @@ -2818,7 +2818,7 @@ where
2818
2818
|| abi == SpecAbi :: RustIntrinsic
2819
2819
|| abi == SpecAbi :: PlatformIntrinsic
2820
2820
{
2821
- let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > , is_ret : bool | {
2821
+ let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > | {
2822
2822
if arg. is_ignore ( ) {
2823
2823
return ;
2824
2824
}
@@ -2856,9 +2856,9 @@ where
2856
2856
_ => return ,
2857
2857
}
2858
2858
2859
- // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
2860
- // will usually return these in 2 registers, which is more efficient than by-ref.
2861
- let max_by_val_size = if is_ret { Pointer . size ( cx) * 2 } else { Pointer . size ( cx ) } ;
2859
+ // Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`.
2860
+ // LLVM will usually pass these in 2 registers, which is more efficient than by-ref.
2861
+ let max_by_val_size = Pointer . size ( cx) * 2 ;
2862
2862
let size = arg. layout . size ;
2863
2863
2864
2864
if arg. layout . is_unsized ( ) || size > max_by_val_size {
@@ -2870,9 +2870,9 @@ where
2870
2870
arg. cast_to ( Reg { kind : RegKind :: Integer , size } ) ;
2871
2871
}
2872
2872
} ;
2873
- fixup ( & mut self . ret , true ) ;
2873
+ fixup ( & mut self . ret ) ;
2874
2874
for arg in & mut self . args {
2875
- fixup ( arg, false ) ;
2875
+ fixup ( arg) ;
2876
2876
}
2877
2877
return ;
2878
2878
}
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