[PATCH] Loop Vectorizer doesn't use %zmm registers on targets supporting AVX512.

Zinovy Nis zinovy.nis at gmail.com
Fri Mar 14 05:31:05 PDT 2014


zinovy.nis added you to the CC list for the revision "Loop Vectorizer doesn't use %zmm registers on targets supporting AVX512.".

Hi delena, rob.khasanov, volkalexey, nadav,

This code

  void foo(float * restrict a, float * restrict b, float * restrict c, unsigned n)
  {
     for (unsigned i = 0; i < n; ++i)
         c[i] = a[i] * b[i];
  }
  
was compiled with "-march=knl" but used only %ymm registers.

With my fix applied the generated code will use %zmm registers as it should be.

http://llvm-reviews.chandlerc.com/D3078

Files:
  lib/Target/X86/X86TargetTransformInfo.cpp

Index: lib/Target/X86/X86TargetTransformInfo.cpp
===================================================================
--- lib/Target/X86/X86TargetTransformInfo.cpp
+++ lib/Target/X86/X86TargetTransformInfo.cpp
@@ -148,6 +148,7 @@
 
 unsigned X86TTI::getRegisterBitWidth(bool Vector) const {
   if (Vector) {
+    if (ST->hasAVX512()) return 512;
     if (ST->hasAVX()) return 256;
     if (ST->hasSSE1()) return 128;
     return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3078.1.patch
Type: text/x-patch
Size: 431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140314/955b53ba/attachment.bin>


More information about the llvm-commits mailing list