<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I just found that you attached the testcase.<div class=""><br class=""></div><div class="">The reason vectorizer fails on it is that there are three induction variables (i, ix, iy), and vectorizer doesn’t know about their strides. If you, for instance, replace inc_x and inc_y with ‘1’, the loop will be vectorized.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Michael</div><div class=""><br class=""></div><div class="">PS: The diagnostics is really confusing here.</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 9, 2015, at 3:52 PM, Michael Zolotukhin <<a href="mailto:mzolotukhin@apple.com" class="">mzolotukhin@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">From this message it looks like the vectorizer is having some general problems with the testcase. I’d suggest to try the simplest case for the beginning, just to make sure vectorizer works. Like this:</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">void foo(int *a, int *b, int *c) {</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">  int i;<br class=""><div class="">  for(i = 0; i < 1000; i++) {</div><div class="">    a[i] = b[i] + c[i];</div><div class="">  }</div><div class="">}</div><div class=""><br class=""></div><div class="">If you compile it with ‘clang -O3 -arch arm64 -S’, you should see the SIMD instructions. If you do see them, it means that your original test is too complicated for the vectorizer right now (that might be due to some bug) - feel free to file a bug.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Michael</div><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 9, 2015, at 3:33 PM, Ralph Campbell <<a href="mailto:ralph.campbell@broadcom.com" class="">ralph.campbell@broadcom.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">% clang -S -O3 -mcpu=cortex-a57 -ffast-math -Rpass-analysis=loop-vectorize dot.c<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">dot.c:15:1: remark: loop not vectorized: value that could not be identified as<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">      reduction is used outside the loop [-Rpass-analysis=loop-vectorize]<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">}<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">^<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">dot.c:15:1: note: could not determine the original source location for :0:0<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I found “llvm-as < /dev/null | llc -march=aarch64 -mattr=help” which listed a bunch of features but when I tried<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">adding “-mfpu=neon” or “-mattr=+neon”, clang complained that the option was unrecognized.<o:p class=""></o:p></span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div class=""><div class="" style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b class=""><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;"><span class="Apple-converted-space"> </span>Michael Zolotukhin [<a href="mailto:mzolotukhin@apple.com" class="" style="color: purple; text-decoration: underline;">mailto:mzolotukhin@apple.com</a>]<span class="Apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Monday, February 09, 2015 3:08 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Ralph Campbell<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span>Arnaud A. de Grandmaison;<span class="Apple-converted-space"> </span><a href="mailto:llvmdev@cs.uiuc.edu" class="" style="color: purple; text-decoration: underline;">llvmdev@cs.uiuc.edu</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [LLVMdev] aarch64 status for generating SIMD instructions<o:p class=""></o:p></span></div></div></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Hi Ralph,<o:p class=""></o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">A bunch of useful options for vectorizers is listed in [1].<o:p class=""></o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Also, what you see might be a target-independent issue, not an aarch64-specific. If you can share the code you tested I can try to explain why vectorizer fails to handle it, and hopefully we can fix it later:)<o:p class=""></o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Thanks,<o:p class=""></o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Michael<o:p class=""></o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">[1] <a href="http://llvm.org/docs/Vectorizers.html" class="" style="color: purple; text-decoration: underline;">http://llvm.org/docs/Vectorizers.html</a><o:p class=""></o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><div class=""><blockquote class="" style="margin-top: 5pt; margin-bottom: 5pt;"><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">On Feb 9, 2015, at 2:19 PM, Ralph Campbell <<a href="mailto:ralph.campbell@broadcom.com" class="" style="color: purple; text-decoration: underline;">ralph.campbell@broadcom.com</a>> wrote:<o:p class=""></o:p></div></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div><div class=""><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">So far, all I have tried is –O3 and with & without “-mcpu=cortex-a57”.</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I’m new to LLVM so I’m not familiar with what optimization flags are available.</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I tried poking around in the LLVM documentation but haven’t found a definitive list.</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">The clang man page is skimpy on details.</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b class=""><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span class="apple-converted-space"><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;"> </span></span><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;">Arnaud A. de Grandmaison [<a href="mailto:arnaud.degrandmaison@arm.com" class="" style="color: purple; text-decoration: underline;">mailto:arnaud.degrandmaison@arm.com</a>]<span class="apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="apple-converted-space"> </span>Monday, February 09, 2015 2:11 PM<br class=""><b class="">To:</b><span class="apple-converted-space"> </span>Ralph Campbell<br class=""><b class="">Cc:</b><span class="apple-converted-space"> </span><a href="mailto:llvmdev@cs.uiuc.edu" class="" style="color: purple; text-decoration: underline;">llvmdev@cs.uiuc.edu</a><br class=""><b class="">Subject:</b><span class="apple-converted-space"> </span>RE: aarch64 status for generating SIMD instructions</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="EN-GB" class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Which compiler flags have you been using ?</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="EN-GB" class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="EN-GB" class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">There is definitely support for AArch64’s SIMD instructions, but their use depends on what the vectorizers can do with your code.</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="EN-GB" class="" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class="" style="border-style: none none none solid; border-left-color: blue; border-left-width: 1.5pt; padding: 0in 0in 0in 4pt;"><div class=""><div class="" style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b class=""><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span class="apple-converted-space"><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;"> </span></span><span class="" style="font-size: 10pt; font-family: Tahoma, sans-serif;"><a href="mailto:llvmdev-bounces@cs.uiuc.edu" class="" style="color: purple; text-decoration: underline;"><span class="" style="color: purple;">llvmdev-bounces@cs.uiuc.edu</span></a><span class="apple-converted-space"> </span>[<a href="mailto:llvmdev-bounces@cs.uiuc.edu" class="" style="color: purple; text-decoration: underline;"><span class="" style="color: purple;">mailto:llvmdev-bounces@cs.uiuc.edu</span></a>]<span class="apple-converted-space"> </span><b class="">On Behalf Of<span class="apple-converted-space"> </span></b>Ralph Campbell<br class=""><b class="">Sent:</b><span class="apple-converted-space"> </span>09 February 2015 22:30<br class=""><b class="">To:</b><span class="apple-converted-space"> </span><a href="mailto:llvmdev@cs.uiuc.edu" class="" style="color: purple; text-decoration: underline;"><span class="" style="color: purple;">llvmdev@cs.uiuc.edu</span></a><br class=""><b class="">Subject:</b><span class="apple-converted-space"> </span>[LLVMdev] aarch64 status for generating SIMD instructions</span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="EN-GB" class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"> </span><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;">I’m using Fedora 22 and gcc 4.9.2 to run llvm 3.5.1 on an ARM Juno reference box (cortex A53 & A57).<o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;">I tried compiling some simple functions like dot product and axpy() into assembly to see if any of the SIMD instructions were generated (they weren’t).<o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;">Perhaps I’m missing some compiler flag to enable it.<o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;">Does anyone know what the status is for aarch64 generating SIMD instructions?<o:p class=""></o:p></span></div></div><div class=""><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 11pt; font-family: Calibri, sans-serif;">Anyone coordinating or leading this effort? (if there is one)<o:p class=""></o:p></span></div></div></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="" style="font-size: 9pt; font-family: Helvetica, sans-serif;">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="" style="color: purple; text-decoration: underline;">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>        <a href="http://llvm.cs.uiuc.edu/" class="" style="color: purple; text-decoration: underline;">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="" style="color: purple; text-decoration: underline;">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></span><o:p class=""></o:p></div></div></blockquote></div><div class="" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p class=""> </o:p></div></div><span id="cid:FFC49321-DAF4-40DA-9D1D-AE12DB02D0CF@apple.com" class=""><dot.s></span><span id="cid:4DF79AC0-24AD-498E-B892-6DD6A0A81CCB@apple.com" class=""><dot.c></span></div></blockquote></div></div></div></div></div></blockquote></div><br class=""></div></body></html>