[Docs] Improve SLP code snippet
authorSanjay Patel <spatel@rotateright.com>
Mon, 9 Dec 2019 22:07:30 +0000 (17:07 -0500)
committerSanjay Patel <spatel@rotateright.com>
Tue, 10 Dec 2019 14:32:40 +0000 (09:32 -0500)
New C code snippet is more viable for SLP vectorization in most architectures.

Patch by: @lsandov1 (Leonardo Sandoval)

Differential Revision: https://reviews.llvm.org/D70866

llvm/docs/Vectorizers.rst

index fd1525c..f8477f2 100644 (file)
@@ -418,8 +418,10 @@ into vector operations.
 .. code-block:: c++
 
   void foo(int a1, int a2, int b1, int b2, int *A) {
-    A[0] = a1*(a1 + b1)/b1 + 50*b1/a1;
-    A[1] = a2*(a2 + b2)/b2 + 50*b2/a2;
+    A[0] = a1*(a1 + b1);
+    A[1] = a2*(a2 + b2);
+    A[2] = a1*(a1 + b1);
+    A[3] = a2*(a2 + b2);
   }
 
 The SLP-vectorizer processes the code bottom-up, across basic blocks, in search of scalars to combine.