-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for 128-bit return values
- Loading branch information
1 parent
4c5acc4
commit cc2ba3b
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer. | ||
|
||
// compile-flags: -C no-prepopulate-passes -O | ||
// only-x86_64 | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub struct S { | ||
a: u64, | ||
b: u32, | ||
c: u32, | ||
} | ||
|
||
// CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s) | ||
#[no_mangle] | ||
pub fn modify(s: S) -> S { | ||
S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c } | ||
} | ||
|
||
#[repr(packed)] | ||
pub struct TooBig { | ||
a: u64, | ||
b: u32, | ||
c: u32, | ||
d: u8, | ||
} | ||
|
||
// CHECK: define void @m_big(%TooBig* [[ATTRS:.*sret.*]], %TooBig* [[ATTRS2:.*]] %s) | ||
#[no_mangle] | ||
pub fn m_big(s: TooBig) -> TooBig { | ||
TooBig { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c, d: s.d + s.d } | ||
} |