[PATCH] [CodeGen] Teach X86_64ABIInfo about AVX512.

John McCall rjmccall at gmail.com
Wed May 20 23:50:12 PDT 2015

Comment at: lib/CodeGen/TargetInfo.cpp:1634-1635
@@ -1630,3 +1633,4 @@
   unsigned getOpenMPSimdDefaultAlignment(QualType) const override {
+    // FIXME: What about AVX512?
     return getABIInfo().hasAVX() ? 32 : 16;
ab wrote:
> This I'm not sure;  it makes sense to me to align to 64 when we have AVX512.
> There's also the WinX86_64 counterpart, which I'm even less confident about.
I am pretty skeptical of even the original code here, frankly.  Are clients really making stronger promises just because they're compiling with AVX enabled?  Note that the compiler doesn't *do* anything to achieve this; it literally just makes a more aggressive assumption about what the user has done.

It seems to me like the (1) the OpenMP people ought to review this and seriously consider it and (2) this number needs to be available to code in some portable manner, probably via a predefined macro.  Which means it probably ought to be defined in the AST-level TargetInfo.  CC'ing Alexey Bataev.

Comment at: lib/CodeGen/TargetInfo.cpp:1934
@@ -1930,1 +1933,3 @@
+    } else if (Size == 128 || (isNamedArg && (hasAVX() && Size == 256) ||
+                               (hasAVX512() && Size == 512))) {
       // Arguments of 256-bits are split into four eightbyte chunks. The
Please parenthesize this second ||.  It's actually wrong as written: && binds tighter than ||, but you want isNamedArg to apply to both.



More information about the cfe-commits mailing list