]>
git.proxmox.com Git - rustc.git/blob - src/test/codegen/align-struct.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // compile-flags: -C no-prepopulate-passes
12 // ignore-tidy-linelength
14 #![crate_type = "lib"]
17 pub struct Align64(i32);
18 // CHECK: %Align64 = type { [0 x i32], i32, [15 x i32] }
26 // CHECK: %Nested64 = type { [0 x i64], %Align64, [0 x i32], i32, [0 x i32], i32, [0 x i8], i8, [55 x i8] }
32 // CHECK: %Enum4 = type { [0 x i32], i32, [1 x i32] }
33 // CHECK: %"Enum4::A" = type { [1 x i32], i32, [0 x i32] }
39 // CHECK: %Enum64 = type { [0 x i32], i32, [31 x i32] }
40 // CHECK: %"Enum64::A" = type { [8 x i64], %Align64, [0 x i64] }
42 // CHECK-LABEL: @align64
44 pub fn align64(i
: i32) -> Align64
{
45 // CHECK: %a64 = alloca %Align64, align 64
46 // CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 64, i32 64, i1 false)
51 // CHECK-LABEL: @nested64
53 pub fn nested64(a
: Align64
, b
: i32, c
: i32, d
: i8) -> Nested64
{
54 // CHECK: %n64 = alloca %Nested64, align 64
55 let n64
= Nested64 { a, b, c, d }
;
59 // CHECK-LABEL: @enum4
61 pub fn enum4(a
: i32) -> Enum4
{
62 // CHECK: %e4 = alloca %Enum4, align 4
67 // CHECK-LABEL: @enum64
69 pub fn enum64(a
: Align64
) -> Enum64
{
70 // CHECK: %e64 = alloca %Enum64, align 64
71 let e64
= Enum64
::A(a
);