<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">I ran the BB vectorizer as I guess this
is the SLP vectorizer.<br>
<br>
BBV: using target information<br>
BBV: fusing loop #1 for for.body in _Z3barmmPfS_S_...<br>
BBV: found 2 instructions with candidate pairs<br>
BBV: found 0 pair connections.<br>
BBV: done!<br>
<br>
However, this was run on the unrolled loop (I guess).<br>
<br>
Here is the IR printed by 'opt':<br>
<br>
entry:<br>
%cmp9 = icmp ult i64 %start, %end<br>
br i1 %cmp9, label %for.body, label %for.end<br>
<br>
for.body: ; preds =
%entry, %for.body<br>
%storemerge10 = phi i64 [ %inc, %for.body ], [ %start, %entry ]<br>
%div = lshr i64 %storemerge10, 2<br>
%mul1 = shl i64 %div, 3<br>
%rem = and i64 %storemerge10, 3<br>
%add2 = or i64 %mul1, %rem<br>
%0 = lshr i64 %storemerge10, 1<br>
%add51 = shl i64 %0, 2<br>
%mul6 = or i64 %rem, %add51<br>
%add8 = or i64 %mul6, 4<br>
%arrayidx = getelementptr inbounds float* %a, i64 %add2<br>
%1 = load float* %arrayidx, align 4<br>
%arrayidx9 = getelementptr inbounds float* %b, i64 %add2<br>
%2 = load float* %arrayidx9, align 4<br>
%add10 = fadd float %1, %2<br>
%arrayidx11 = getelementptr inbounds float* %c, i64 %add2<br>
store float %add10, float* %arrayidx11, align 4<br>
%arrayidx12 = getelementptr inbounds float* %a, i64 %add8<br>
%3 = load float* %arrayidx12, align 4<br>
%arrayidx13 = getelementptr inbounds float* %b, i64 %add8<br>
%4 = load float* %arrayidx13, align 4<br>
%add14 = fadd float %3, %4<br>
%arrayidx15 = getelementptr inbounds float* %c, i64 %add8<br>
store float %add14, float* %arrayidx15, align 4<br>
%inc = add i64 %storemerge10, 1<br>
%exitcond = icmp eq i64 %inc, %end<br>
br i1 %exitcond, label %for.end, label %for.body<br>
<br>
for.end: ; preds =
%for.body, %entry<br>
ret void<br>
<br>
<br>
Is what you're saying that I should unroll the loop first by a
given factor and then run SLP again? How would I do that say for a
factor of 2?<br>
<br>
Frank<br>
<br>
<br>
<br>
On 30/10/13 13:28, Renato Golin wrote:<br>
</div>
<blockquote
cite="mid:CAMSE1ke1ew4V-BH0ihKOoQ+YXfS9KtrHSp_Tp7LkiMuXH+-9yA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">On 30 October 2013 09:25, Nadav Rotem
<<a moz-do-not-send="true" href="mailto:nrotem@apple.com">nrotem@apple.com</a>>
wrote:
<div class="gmail_quote">
<blockquote class="gmail_quote">
The access pattern to arrays a and b is non-linear.
Unrolled loops are usually handled by the SLP-vectorizer.
Are ir0 and ir1 consecutive for all values for i ?<br>
</blockquote>
</div>
<br>
</div>
<div class="gmail_extra">
Based on his list of values, it seems that the induction
stride is linear within each block of 4 iterations, but it's
not a clear relationship.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">As you say, it should be possible to
spot that once the loop is unrolled, and get the SLP to
vectorize if the relationship becomes clear. </div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Maybe I'm wrong, but this looks like a
problem of missed opportunities, not technically hard to
implement.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">
--renato</div>
</div>
</blockquote>
<br>
<br>
</body>
</html>