[PATCH] Bump X86 Darwin MaxVectorAlign to 64, for AVX512.
Ahmed Bougacha
ahmed.bougacha at gmail.com
Wed Jun 24 18:51:25 PDT 2015
Hi rjmccall,
Without this, 64-byte vector types (__m512), specified to be 64-byte aligned in the AVX512 draft SysV ABI, will only be 32-byte aligned.
One might raise a couple valid concerns:
- this doesn't change alignment of anything other than clang-generated vector code. So malloc() and all will still only be 16-byte aligned.
- we've gotten to a point where unaligned accesses are good enough, why care about alignment?
To which I pedantically counter:
- there's precedent: AVX bumped alignment to 32, so vector users are already familiar with the issue.
- because the spec says so ;)
http://reviews.llvm.org/D10724
Files:
lib/Basic/Targets.cpp
test/CodeGen/vector-alignment.c
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3561,7 +3561,7 @@
LongDoubleWidth = 128;
LongDoubleAlign = 128;
SuitableAlign = 128;
- MaxVectorAlign = 256;
+ MaxVectorAlign = 512;
SizeType = UnsignedLong;
IntPtrType = SignedLong;
DescriptionString = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128";
@@ -3893,7 +3893,7 @@
DarwinX86_64TargetInfo(const llvm::Triple &Triple)
: DarwinTargetInfo<X86_64TargetInfo>(Triple) {
Int64Type = SignedLongLong;
- MaxVectorAlign = 256;
+ MaxVectorAlign = 512;
// The 64-bit iOS simulator uses the builtin bool type for Objective-C.
llvm::Triple T = llvm::Triple(Triple);
if (T.isiOS())
Index: test/CodeGen/vector-alignment.c
===================================================================
--- test/CodeGen/vector-alignment.c
+++ test/CodeGen/vector-alignment.c
@@ -1,38 +1,39 @@
// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -w -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
// 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;
// CHECK: @v1 {{.*}}, align 16
double __attribute__((vector_size(32))) v2;
// CHECK: @v2 {{.*}}, align 32
+double __attribute__((vector_size(64))) v3;
+// CHECK: @v3 {{.*}}, align 64
// Alignment above target max alignment with no aligned attribute should align
// based on the target max.
-double __attribute__((vector_size(64))) v3;
-// CHECK: @v3 {{.*}}, align 32
double __attribute__((vector_size(1024))) v4;
-// CHECK: @v4 {{.*}}, align 32
+// CHECK: @v4 {{.*}}, align 64
// Aliged attribute should always override.
double __attribute__((vector_size(16), aligned(16))) v5;
// CHECK: @v5 {{.*}}, align 16
-double __attribute__((vector_size(16), aligned(64))) v6;
-// CHECK: @v6 {{.*}}, align 64
+double __attribute__((vector_size(16), aligned(128))) v6;
+// CHECK: @v6 {{.*}}, align 128
double __attribute__((vector_size(32), aligned(16))) v7;
// CHECK: @v7 {{.*}}, align 16
-double __attribute__((vector_size(32), aligned(64))) v8;
-// CHECK: @v8 {{.*}}, align 64
+double __attribute__((vector_size(32), aligned(128))) v8;
+// CHECK: @v8 {{.*}}, align 128
// Check non-power of 2 widths.
double __attribute__((vector_size(24))) v9;
// CHECK: @v9 {{.*}}, align 32
double __attribute__((vector_size(40))) v10;
-// CHECK: @v10 {{.*}}, align 32
+// CHECK: @v10 {{.*}}, align 64
// Check non-power of 2 widths with aligned attribute.
-double __attribute__((vector_size(24), aligned(64))) v11;
-// CHECK: @v11 {{.*}}, align 64
+double __attribute__((vector_size(24), aligned(128))) v11;
+// CHECK: @v11 {{.*}}, align 128
double __attribute__((vector_size(80), aligned(16))) v12;
// CHECK: @v12 {{.*}}, align 16
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10724.28433.patch
Type: text/x-patch
Size: 2980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150625/52d0dfd5/attachment.bin>
More information about the cfe-commits
mailing list