xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/alloca-align.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct s0 {
4*f4a2713aSLionel Sambuc   int Start, End;
5*f4a2713aSLionel Sambuc   unsigned Alignment;
6*f4a2713aSLionel Sambuc   int TheStores __attribute__((aligned(16)));
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f0
10*f4a2713aSLionel Sambuc // CHECK: alloca %struct.s0, align 16
f0()11*f4a2713aSLionel Sambuc extern "C" void f0() {
12*f4a2713aSLionel Sambuc   (void) s0();
13*f4a2713aSLionel Sambuc }
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @f1
16*f4a2713aSLionel Sambuc // CHECK: alloca %struct.s0, align 16
f1()17*f4a2713aSLionel Sambuc extern "C" void f1() {
18*f4a2713aSLionel Sambuc   (void) (struct s0) { 0, 0, 0, 0 };
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @f2
22*f4a2713aSLionel Sambuc // CHECK: alloca %struct.s1, align 2
23*f4a2713aSLionel Sambuc struct s1 { short x; short y; };
f2(int a,struct s1 * x,struct s1 * y)24*f4a2713aSLionel Sambuc extern "C" struct s1 f2(int a, struct s1 *x, struct s1 *y) {
25*f4a2713aSLionel Sambuc   if (a)
26*f4a2713aSLionel Sambuc     return *x;
27*f4a2713aSLionel Sambuc   return *y;
28*f4a2713aSLionel Sambuc }
29