xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/align-param.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple i386-apple-macosx10.7.2 < %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // The preferred alignment for a long long on x86-32 is 8; make sure the
4*f4a2713aSLionel Sambuc // alloca for x uses that alignment.
test(long long x)5*f4a2713aSLionel Sambuc int test (long long x) {
6*f4a2713aSLionel Sambuc   return (int)x;
7*f4a2713aSLionel Sambuc }
8*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @test
9*f4a2713aSLionel Sambuc // CHECK: alloca i64, align 8
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc // Make sure we honor the aligned attribute.
13*f4a2713aSLionel Sambuc struct X { int x,y,z,a; };
test2(struct X x __attribute ((aligned (16))))14*f4a2713aSLionel Sambuc int test2(struct X x __attribute((aligned(16)))) {
15*f4a2713aSLionel Sambuc   return x.z;
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @test2
18*f4a2713aSLionel Sambuc // CHECK: alloca %struct.X, align 16
19