|
| 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. |
| 4 | +// |
| 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. |
| 10 | + |
| 11 | +// compile-flags: -C no-prepopulate-passes |
| 12 | +#![crate_type = "lib"] |
| 13 | + |
| 14 | +#![feature(attr_literals)] |
| 15 | +#![feature(repr_align)] |
| 16 | + |
| 17 | +#[repr(align(64))] |
| 18 | +pub struct Align64(i32); |
| 19 | + |
| 20 | +pub struct Nested64 { |
| 21 | + a: Align64, |
| 22 | + b: i32, |
| 23 | + c: i32, |
| 24 | + d: i8, |
| 25 | +} |
| 26 | + |
| 27 | +pub enum Enum64 { |
| 28 | + A(Align64), |
| 29 | + B(i32), |
| 30 | +} |
| 31 | + |
| 32 | +// CHECK-LABEL: @align64 |
| 33 | +#[no_mangle] |
| 34 | +pub fn align64(i : i32) -> Align64 { |
| 35 | +// CHECK: %a64 = alloca %Align64, align 64 |
| 36 | +// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 64, i32 64, i1 false) |
| 37 | + let a64 = Align64(i); |
| 38 | + a64 |
| 39 | +} |
| 40 | + |
| 41 | +// CHECK-LABEL: @nested64 |
| 42 | +#[no_mangle] |
| 43 | +pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 { |
| 44 | +// CHECK: %n64 = alloca %Nested64, align 64 |
| 45 | +// CHECK: %a = alloca %Align64, align 64 |
| 46 | + let n64 = Nested64 { a, b, c, d }; |
| 47 | + n64 |
| 48 | +} |
| 49 | + |
| 50 | +// CHECK-LABEL: @enum64 |
| 51 | +#[no_mangle] |
| 52 | +pub fn enum64(a: Align64) -> Enum64 { |
| 53 | +// CHECK: %e64 = alloca %Enum64, align 64 |
| 54 | +// CHECK: %a = alloca %Align64, align 64 |
| 55 | + let e64 = Enum64::A(a); |
| 56 | + e64 |
| 57 | +} |
0 commit comments