]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/vector-alignment.c
Vendor import of clang release_38 branch r258549:
[FreeBSD/FreeBSD.git] / test / CodeGen / vector-alignment.c
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
14
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
26 // Alignment above target max alignment with no aligned attribute should align
27 // based on the target max.
28 double __attribute__((vector_size(64))) v3;
29 // SSE: @v3 {{.*}}, align 16
30 // AVX: @v3 {{.*}}, align 32
31 // AVX512: @v3 {{.*}}, align 64
32 double __attribute__((vector_size(1024))) v4;
33 // SSE: @v4 {{.*}}, align 16
34 // AVX: @v4 {{.*}}, align 32
35 // AVX512: @v4 {{.*}}, align 64
36
37 // Aliged attribute should always override.
38 double __attribute__((vector_size(16), aligned(16))) v5;
39 // ALL: @v5 {{.*}}, align 16
40 double __attribute__((vector_size(16), aligned(64))) v6;
41 // ALL: @v6 {{.*}}, align 64
42 double __attribute__((vector_size(32), aligned(16))) v7;
43 // ALL: @v7 {{.*}}, align 16
44 double __attribute__((vector_size(32), aligned(64))) v8;
45 // ALL: @v8 {{.*}}, align 64
46
47 // Check non-power of 2 widths.
48 double __attribute__((vector_size(24))) v9;
49 // SSE: @v9 {{.*}}, align 16
50 // AVX: @v9 {{.*}}, align 32
51 // AVX512: @v9 {{.*}}, align 32
52 double __attribute__((vector_size(40))) v10;
53 // SSE: @v10 {{.*}}, align 16
54 // AVX: @v10 {{.*}}, align 32
55 // AVX512: @v10 {{.*}}, align 64
56
57 // Check non-power of 2 widths with aligned attribute.
58 double __attribute__((vector_size(24), aligned(64))) v11;
59 // ALL: @v11 {{.*}}, align 64
60 double __attribute__((vector_size(80), aligned(16))) v12;
61 // ALL: @v12 {{.*}}, align 16