<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
It looks like we've never added V % C == C2 in
computeKnownBitsFromAssume. This would be a simple patch to add if
you're interested in fixing the compiler to handle this case.<br>
<br>
You might also get this to work by using N & 0x1 == 0. It looks
like we do handle that case. If that doesn't work, it probably
means the vectorizer isn't asking the right questions here. <br>
<br>
Philip<br>
<br>
<div class="moz-cite-prefix">On 12/22/2015 02:34 PM, Mark Schimmel
via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:549704409B55EF4EA338DE0614245F449400EF3C@US01WEMBX2.internal.synopsys.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">void test_copy_vec(const short* restrict
src, short* restrict res, int N) {<o:p></o:p></p>
<p class="MsoNormal"> __builtin_assume( (N > 1) &&
(N%2 == 0) );<o:p></o:p></p>
<p class="MsoNormal"> #pragma clang loop vectorize(enable)
vectorize_width(2) interleave_count(1)<o:p></o:p></p>
<p class="MsoNormal"> for (int j=0; j<N; ++j)<o:p></o:p></p>
<p class="MsoNormal"> *res++ = *src++;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If I use __builtin_assume(N>1) then llvm
knows the loop will execute and not check for (j <= 0), but
I can’t seem to get it to accept N is even. Is there a way to
get llvm to vectorize the loop and not generate the additional
scalar loop conditions?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>