summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2014-03-12 23:23:44 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2014-03-12 23:23:44 +0000
commit6a7d263e8b86d13efa04a7fc64ec37103d03d73e (patch)
tree33a6331b66d68d7d8497366893de2e548934765e
parent9a4d525b7df6f5274f438bebf05414f93b619e78 (diff)
downloadllvm-6a7d263e8b86d13efa04a7fc64ec37103d03d73e.tar.gz
llvm-6a7d263e8b86d13efa04a7fc64ec37103d03d73e.tar.bz2
llvm-6a7d263e8b86d13efa04a7fc64ec37103d03d73e.tar.xz
Fix vectorizer docs.
This example is not vectorized because LLVM does not prove no-wrapping of "a[i*7] += ...". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203734 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/Vectorizers.rst9
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/Vectorizers.rst b/docs/Vectorizers.rst
index 61ebca2bb5..823fd9e670 100644
--- a/docs/Vectorizers.rst
+++ b/docs/Vectorizers.rst
@@ -182,11 +182,14 @@ that scatter/gathers memory.
.. code-block:: c++
- int foo(int *A, int *B, int n, int k) {
- for (int i = 0; i < n; ++i)
- A[i*7] += B[i*k];
+ int foo(int * A, int * B, int n) {
+ for (intptr_t i = 0; i < n; ++i)
+ A[i] += B[i*4];
}
+In many situations the cost model will inform LLVM that this is not beneficial
+and LLVM will only vectorize such code if forced with "-mllvm -force-vector-width=#".
+
Vectorization of Mixed Types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^