diff options
author | John McCall <rjmccall@apple.com> | 2018-06-01 21:34:26 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2018-06-01 21:34:26 +0000 |
commit | 280c6560317fcb73872e340621861dfd6ecb9333 (patch) | |
tree | 5633ce15ae30163a63376c4d5c4ff6b924a8fd8e /clang/test/CodeGen/vector-alignment.c | |
parent | b8d861c27a1bdf8576f964a3fac533c3df7fe39a (diff) | |
download | bcm5719-llvm-280c6560317fcb73872e340621861dfd6ecb9333.tar.gz bcm5719-llvm-280c6560317fcb73872e340621861dfd6ecb9333.zip |
Cap "voluntary" vector alignment at 16 for all Darwin platforms.
This fixes two major problems:
- We were not capping vector alignment as desired on 32-bit ARM.
- We were using different alignments based on the AVX settings on
Intel, so we did not have a consistent ABI.
This is an ABI break, but we think we can get away with it because
vectors tend to be used mostly in inline code (which is why not having
a consistent ABI has not proven disastrous on Intel).
Intel's AVX types are specified as having 32-byte / 64-byte alignment,
so align them explicitly instead of relying on the base ABI rule.
Note that this sort of attribute is stripped from template arguments
in template substitution, so there's a possibility that code templated
over vectors will produce inadequately-aligned objects. The right
long-term solution for this is for alignment attributes to be
interpreted as true qualifiers and thus preserved in the canonical type.
llvm-svn: 333791
Diffstat (limited to 'clang/test/CodeGen/vector-alignment.c')
-rw-r--r-- | clang/test/CodeGen/vector-alignment.c | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/clang/test/CodeGen/vector-alignment.c b/clang/test/CodeGen/vector-alignment.c index d1fd771fb7d..425819b5a0a 100644 --- a/clang/test/CodeGen/vector-alignment.c +++ b/clang/test/CodeGen/vector-alignment.c @@ -1,38 +1,68 @@ // RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 \ -// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_SSE // RUN: %clang_cc1 -w -triple i386-apple-darwin10 \ -// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_SSE // RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx \ -// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_AVX // RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx \ -// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_AVX // RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx512f \ -// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_AVX512 // RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx512f \ -// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_AVX512 +// RUN: %clang_cc1 -w -triple armv7-apple-ios10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_ARM32 +// RUN: %clang_cc1 -w -triple arm64-apple-ios10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=DARWIN_ARM64 + +// RUN: %clang_cc1 -w -triple x86_64-pc-linux \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC +// RUN: %clang_cc1 -w -triple i386-pc-linux \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC +// RUN: %clang_cc1 -w -triple x86_64-pc-linux -target-feature +avx \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC +// RUN: %clang_cc1 -w -triple i386-pc-linux -target-feature +avx \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC +// RUN: %clang_cc1 -w -triple x86_64-pc-linux -target-feature +avx512f \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC +// RUN: %clang_cc1 -w -triple i386-pc-linux -target-feature +avx512f \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=GENERIC + // rdar://11759609 // At or below target max alignment with no aligned attribute should align based // on the size of vector. double __attribute__((vector_size(16))) v1; -// SSE: @v1 {{.*}}, align 16 -// AVX: @v1 {{.*}}, align 16 -// AVX512: @v1 {{.*}}, align 16 +// DARWIN_SSE: @v1 {{.*}}, align 16 +// DARWIN_AVX: @v1 {{.*}}, align 16 +// DARWIN_AVX512: @v1 {{.*}}, align 16 +// DARWIN_ARM32: @v1 {{.*}}, align 16 +// DARWIN_ARM64: @v1 {{.*}}, align 16 +// GENERIC: @v1 {{.*}}, align 16 double __attribute__((vector_size(32))) v2; -// SSE: @v2 {{.*}}, align 16 -// AVX: @v2 {{.*}}, align 32 -// AVX512: @v2 {{.*}}, align 32 +// DARWIN_SSE: @v2 {{.*}}, align 16 +// DARWIN_AVX: @v2 {{.*}}, align 16 +// DARWIN_AVX512: @v2 {{.*}}, align 16 +// DARWIN_ARM32: @v2 {{.*}}, align 16 +// DARWIN_ARM64: @v2 {{.*}}, align 16 +// GENERIC: @v2 {{.*}}, align 32 // Alignment above target max alignment with no aligned attribute should align // based on the target max. double __attribute__((vector_size(64))) v3; -// SSE: @v3 {{.*}}, align 16 -// AVX: @v3 {{.*}}, align 32 -// AVX512: @v3 {{.*}}, align 64 +// DARWIN_SSE: @v3 {{.*}}, align 16 +// DARWIN_AVX: @v3 {{.*}}, align 16 +// DARWIN_AVX512: @v3 {{.*}}, align 16 +// DARWIN_ARM32: @v3 {{.*}}, align 16 +// DARWIN_ARM64: @v3 {{.*}}, align 16 +// GENERIC: @v3 {{.*}}, align 64 double __attribute__((vector_size(1024))) v4; -// SSE: @v4 {{.*}}, align 16 -// AVX: @v4 {{.*}}, align 32 -// AVX512: @v4 {{.*}}, align 64 +// DARWIN_SSE: @v4 {{.*}}, align 16 +// DARWIN_AVX: @v4 {{.*}}, align 16 +// DARWIN_AVX512: @v4 {{.*}}, align 16 +// DARWIN_ARM32: @v4 {{.*}}, align 16 +// DARWIN_ARM64: @v4 {{.*}}, align 16 +// GENERIC: @v4 {{.*}}, align 1024 // Aliged attribute should always override. double __attribute__((vector_size(16), aligned(16))) v5; @@ -46,13 +76,19 @@ double __attribute__((vector_size(32), aligned(64))) v8; // Check non-power of 2 widths. double __attribute__((vector_size(24))) v9; -// SSE: @v9 {{.*}}, align 16 -// AVX: @v9 {{.*}}, align 32 -// AVX512: @v9 {{.*}}, align 32 +// DARWIN_SSE: @v9 {{.*}}, align 16 +// DARWIN_AVX: @v9 {{.*}}, align 16 +// DARWIN_AVX512: @v9 {{.*}}, align 16 +// DARWIN_ARM32: @v9 {{.*}}, align 16 +// DARWIN_ARM64: @v9 {{.*}}, align 16 +// GENERIC: @v9 {{.*}}, align 32 double __attribute__((vector_size(40))) v10; -// SSE: @v10 {{.*}}, align 16 -// AVX: @v10 {{.*}}, align 32 -// AVX512: @v10 {{.*}}, align 64 +// DARWIN_SSE: @v10 {{.*}}, align 16 +// DARWIN_AVX: @v10 {{.*}}, align 16 +// DARWIN_AVX512: @v10 {{.*}}, align 16 +// DARWIN_ARM32: @v10 {{.*}}, align 16 +// DARWIN_ARM64: @v10 {{.*}}, align 16 +// GENERIC: @v10 {{.*}}, align 64 // Check non-power of 2 widths with aligned attribute. double __attribute__((vector_size(24), aligned(64))) v11; |