http://llvm.org/bugs/show_bug.cgi?id=18086

            Bug ID: 18086
           Summary: Implement Pragma Vectorize - Choice/Parameters
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Implementing pragmas to control vectorization is important to work around
deficiencies in the compiler, language or to create specific tests without
confusing boilerplate or specific target defined.

These pragmas are also great for probing what the compiler is able to do, and
to pick and chose widths and unroll factors that the compiler gets the cost
wrong. Hopefully, users will use them to report improvements to the compiler.

The simplest vectorization pragmas to implement:

#pragma vectorize enable/disable

Simply turns the vectorizer on/off on that loop. This doesn't guarantee that
the loop will get vectorized if it's not legal, but it will enable the
vectorizer even if the optimization level is too low or if the cost model
thinks it's a bad idea.

#pragma vectorize width(4)

for (i = 0; i < N; ++i) {
  A[i] = B[i];
}
=>    
for (i = 0; i < N; i +=4) {
  A[i:i+3] = B[i:i+3];
}

#pragma vectorize unroll(2)

for (i = 0; i < N; ++i) {
  A[i] = B[i];
}
=>    
for (i = 0; i < N; i +=2) {
  A[i] = B[i];
  A[i+1] = B[i+1];
}

Ultimately, the pragmas need to trigger warnings to the user, explaining why,
if some of the instructions could not be followed, for instance if:

- The target doesn't support the specified width
- The loop cannot be vectorized because of memory dependencies

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to