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
13 // min-llvm-version 7.0
15 #![crate_type = "lib"]
18 pub struct Align64(i32);
19 // CHECK: %Align64 = type { [0 x i32], i32, [15 x i32] }
27 // CHECK: %Nested64 = type { [0 x i64], %Align64, [0 x i32], i32, [0 x i32], i32, [0 x i8], i8, [55 x i8] }
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* align 64 %{{.*}}, i8* align 64 %{{.*}}, i{{[0-9]+}} 64, i1 false)
51 // For issue 54028: make sure that we are specifying the correct alignment for fields of aligned
53 // CHECK-LABEL: @align64_load
55 pub fn align64_load(a: Align64) -> i32 {
56 // CHECK: [[FIELD:%.*]] = bitcast %Align64* %{{.*}} to i32*
57 // CHECK: {{%.*}} = load i32, i32* [[FIELD]], align 64
61 // CHECK-LABEL: @nested64
63 pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 {
64 // CHECK: %n64 = alloca %Nested64, align 64
65 let n64 = Nested64 { a, b, c, d };
69 // CHECK-LABEL: @enum4
71 pub fn enum4(a: i32) -> Enum4 {
72 // CHECK: %e4 = alloca { i32, i32 }, align 4
77 // CHECK-LABEL: @enum64
79 pub fn enum64(a: Align64) -> Enum64 {
80 // CHECK: %e64 = alloca %Enum64, align 64
81 let e64 = Enum64::A(a);