[PATCH] D70866: Improve SLP code snippet

Leonardo Sandoval via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 29 12:47:57 PST 2019


lsandov1 created this revision.
lsandov1 added reviewers: nadav, spatel, fhahn.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

New C code snippet is more viable for SLP vectorization in most architectures.


https://reviews.llvm.org/D70866

Files:
  llvm/docs/Vectorizers.rst


Index: llvm/docs/Vectorizers.rst
===================================================================
--- llvm/docs/Vectorizers.rst
+++ llvm/docs/Vectorizers.rst
@@ -417,9 +417,11 @@
 
 .. 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;
+  void foo(long a1, long a2, long b1, long b2, long *A) {
+    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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70866.231573.patch
Type: text/x-patch
Size: 615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191129/ae758dba/attachment.bin>


More information about the llvm-commits mailing list