Skip to content

Commit cc2ba3b

Browse files
Add a test for 128-bit return values
1 parent 4c5acc4 commit cc2ba3b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}

0 commit comments

Comments
 (0)