<div dir="ltr">Shufflevector is a powerful instruction that can be used to copy a scalar to every elements of a vector, concatenate smaller vectors into a larger vector, rearrange elements one or two vectors, etc. Without example code I can't say for sure what the use of shufflevector in your case is for.<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 6, 2021 at 10:44 PM Sudakshina Dutta <<a href="mailto:sudakshina@iitgoa.ac.in">sudakshina@iitgoa.ac.in</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Dear Craig,<div dir="auto"><br></div><div dir="auto">Thanks for your reply. It seems the control flow of the vectorized program is very different from that of the source code. Is there any document describing difference in control flow, the reason for using shufflevector, etc ?</div><div dir="auto"><br></div><div dir="auto">Sudakshina </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 7 Jun 2021, 07:41 Craig Topper, <<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">There's some notes here <a href="https://llvm.org/docs/Vectorizers.html" rel="noreferrer" target="_blank">https://llvm.org/docs/Vectorizers.html</a> but I didn't look too closely at it.  If you compile with -fno-discard-values names or use a debug build, some of the basic blocks will be named similar to the CFG diagram in this section <a href="https://llvm.org/docs/Vectorizers.html#epilogue-vectorization" rel="noreferrer" target="_blank">https://llvm.org/docs/Vectorizers.html#epilogue-vectorization</a> <div><br></div><div><div><div dir="ltr">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 6, 2021 at 7:04 PM Sudakshina Dutta via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear Stefanos,</div><div><br></div><div>I want to understand how the generated code works. For example, the code that I generated using -Rpass=loop-vectorize -Rpass-analysis=loop-vectorize has many shufflevector and other instructions. I wanted to have a document (if there exists any) where an example on loop-vectorization is done with some explanation on the workflow of the code.</div><div><br></div><div>Thanks,</div><div>Sudakshina<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 7, 2021 at 7:03 AM Stefanos Baziotis <<a href="mailto:stefanos.baziotis@gmail.com" rel="noreferrer" target="_blank">stefanos.baziotis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Sudakshina,<div><br></div><div>First, it helps if you can put your code in a godbolt snippet, like this [1]. It helps people in multiple ways (e.g., they don't have to download files, they can see exactly what cmd arguments you used, they can</div><div>tweak the cmd arguments without having LLVM on their machine etc.).</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Is there any comprehensive tutorial/document to understand generated instructions or the semantics of the vectorized code ?</blockquote><div><br></div><div>This is quite generic, what is more specifically that you want to understand? Do you want to understand what each individual instruction does? Do you maybe understand that but</div><div>you don't know what is the general method to generate, let's say by hand, vectorized code (or more specifically, branching vectorized code). Or maybe, you want to understand</div><div>how _LLVM_ generates this code, i.e., the inner workings of the vectorization passes.</div><div><br></div><div>Best,</div><div>Stefanos</div><div><br></div><div>[1] <a href="https://godbolt.org/z/8eKqnrMPn" rel="noreferrer" target="_blank">https://godbolt.org/z/8eKqnrMPn</a><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Στις Κυρ, 6 Ιουν 2021 στις 6:17 π.μ., ο/η Sudakshina Dutta via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>> έγραψε:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear all,</div><div><br></div><div>Greetings. I have generated a vectorized code from a C source file (attached). Is there any comprehensive tutorial/document to understand generated instructions or the semantics of the vectorized code ?</div><div><br></div><div>Thanks,</div><div>Sudakshina<br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>