]> git.proxmox.com Git - rustc.git/blob - src/test/codegen/return-value-in-reg.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / codegen / return-value-in-reg.rs
1 //! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer.
2
3 // compile-flags: -C no-prepopulate-passes -O
4 // only-x86_64
5
6 #![crate_type = "lib"]
7
8 pub struct S {
9 a: u64,
10 b: u32,
11 c: u32,
12 }
13
14 // CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s)
15 #[no_mangle]
16 pub fn modify(s: S) -> S {
17 S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c }
18 }
19
20 #[repr(packed)]
21 pub struct TooBig {
22 a: u64,
23 b: u32,
24 c: u32,
25 d: u8,
26 }
27
28 // CHECK: define void @m_big(%TooBig* [[ATTRS:.*sret.*]], %TooBig* [[ATTRS2:.*]] %s)
29 #[no_mangle]
30 pub fn m_big(s: TooBig) -> TooBig {
31 TooBig { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c, d: s.d + s.d }
32 }