[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / vector-alignment.c
blob803e7fb90db5fd9461b6aef5177f9595bd578e7e
1 // RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 \
2 // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE
3 // RUN: %clang_cc1 -w -triple i386-apple-darwin10 \
4 // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE
5 // RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx \
6 // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX
7 // RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx \
8 // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX
9 // RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx512f \
10 // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX512
11 // RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx512f \
12 // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX512
13 // rdar://11759609
15 // At or below target max alignment with no aligned attribute should align based
16 // on the size of vector.
17 double __attribute__((vector_size(16))) v1;
18 // SSE: @v1 {{.*}}, align 16
19 // AVX: @v1 {{.*}}, align 16
20 // AVX512: @v1 {{.*}}, align 16
21 double __attribute__((vector_size(32))) v2;
22 // SSE: @v2 {{.*}}, align 16
23 // AVX: @v2 {{.*}}, align 32
24 // AVX512: @v2 {{.*}}, align 32
25 typedef __attribute__((__ext_vector_type__(16))) _Bool v2b_type;
26 v2b_type v2b;
27 // ALL: @v2b {{.*}}, align 2
29 // Alignment above target max alignment with no aligned attribute should align
30 // based on the target max.
31 double __attribute__((vector_size(64))) v3;
32 // SSE: @v3 {{.*}}, align 16
33 // AVX: @v3 {{.*}}, align 32
34 // AVX512: @v3 {{.*}}, align 64
35 double __attribute__((vector_size(1024))) v4;
36 // SSE: @v4 {{.*}}, align 16
37 // AVX: @v4 {{.*}}, align 32
38 // AVX512: @v4 {{.*}}, align 64
39 typedef __attribute__((__ext_vector_type__(8192))) _Bool v4b_type;
40 v4b_type v4b;
41 // SSE: @v4b {{.*}}, align 16
42 // AVX: @v4b {{.*}}, align 32
43 // AVX512: @v4b {{.*}}, align 64
45 // Aliged attribute should always override.
46 double __attribute__((vector_size(16), aligned(16))) v5;
47 // ALL: @v5 {{.*}}, align 16
48 double __attribute__((vector_size(16), aligned(64))) v6;
49 // ALL: @v6 {{.*}}, align 64
50 double __attribute__((vector_size(32), aligned(16))) v7;
51 // ALL: @v7 {{.*}}, align 16
52 double __attribute__((vector_size(32), aligned(64))) v8;
53 // ALL: @v8 {{.*}}, align 64
54 typedef __attribute__((ext_vector_type(256), aligned(128))) _Bool v8b_type;
55 v8b_type v8b;
56 // ALL: @v8b {{.*}}, align 128
58 // Check non-power of 2 widths.
59 double __attribute__((vector_size(24))) v9;
60 // SSE: @v9 {{.*}}, align 16
61 // AVX: @v9 {{.*}}, align 32
62 // AVX512: @v9 {{.*}}, align 32
63 double __attribute__((vector_size(40))) v10;
64 // SSE: @v10 {{.*}}, align 16
65 // AVX: @v10 {{.*}}, align 32
66 // AVX512: @v10 {{.*}}, align 64
67 typedef __attribute__((ext_vector_type(248))) _Bool v10b_type;
68 v10b_type v10b;
69 // SSE: @v10b {{.*}}, align 16
70 // AVX: @v10b {{.*}}, align 32
71 // AVX512: @v10b {{.*}}, align 32
73 // Check non-power of 2 widths with aligned attribute.
74 double __attribute__((vector_size(24), aligned(64))) v11;
75 // ALL: @v11 {{.*}}, align 64
76 double __attribute__((vector_size(80), aligned(16))) v12;
77 // ALL: @v12 {{.*}}, align 16
78 typedef __attribute__((ext_vector_type(248), aligned(4))) _Bool v12b_type;
79 v12b_type v12b;
80 // ALL: @v12b {{.*}}, align 4