# [LLVMbugs] [Bug 18086] New: Implement Pragma Vectorize - Choice/Parameters

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 28 15:31:50 PST 2013

```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: unassignedbugs at nondot.org
Reporter: renato.golin at linaro.org
CC: llvmbugs at cs.uiuc.edu
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

#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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131128/a1c86eb3/attachment.html>
```