File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -2848,7 +2848,7 @@ where
28482848 || abi == SpecAbi :: RustIntrinsic
28492849 || abi == SpecAbi :: PlatformIntrinsic
28502850 {
2851- let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > , is_ret : bool | {
2851+ let fixup = |arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > | {
28522852 if arg. is_ignore ( ) {
28532853 return ;
28542854 }
@@ -2886,9 +2886,9 @@ where
28862886 _ => return ,
28872887 }
28882888
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 ;
28922892 let size = arg. layout . size ;
28932893
28942894 if arg. layout . is_unsized ( ) || size > max_by_val_size {
@@ -2900,9 +2900,9 @@ where
29002900 arg. cast_to ( Reg { kind : RegKind :: Integer , size } ) ;
29012901 }
29022902 } ;
2903- fixup ( & mut self . ret , true ) ;
2903+ fixup ( & mut self . ret ) ;
29042904 for arg in & mut self . args {
2905- fixup ( arg, false ) ;
2905+ fixup ( arg) ;
29062906 }
29072907 return ;
29082908 }
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.
22
33// compile-flags: -C no-prepopulate-passes -O
44// only-x86_64
@@ -11,7 +11,7 @@ pub struct S {
1111 c : u32 ,
1212}
1313
14- // CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s )
14+ // CHECK: define i128 @modify(i128{{( %0)?}} )
1515#[ no_mangle]
1616pub fn modify ( s : S ) -> S {
1717 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}
6363#[ no_mangle]
6464pub fn test_UnionU128 ( _: UnionU128 ) -> UnionU128 { loop { } }
6565
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+
6671#[ 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)
6974#[ no_mangle]
70- pub fn test_CUnionU128 ( _: CUnionU128 ) { loop { } }
75+ pub fn test_CUnionU128x2 ( _: CUnionU128x2 ) { loop { } }
7176
7277pub union UnionBool { b : bool }
7378// CHECK: define zeroext i1 @test_UnionBool(i8 %b)
You can’t perform that action at this time.
0 commit comments