]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/arg-return-value-in-reg.rs
Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
[rust.git] / src / test / codegen / arg-return-value-in-reg.rs
1 //! Check that types of up to 128 bits are passed and returned by-value instead of via 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(i128{{( %0)?}})
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 }