[LLVMbugs] [Bug 11976] New: BB vectorizer does not copy data to increase the number of pairable instructions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Feb 10 10:25:04 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=11976
Bug #: 11976
Summary: BB vectorizer does not copy data to increase the
number of pairable instructions
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: spop at codeaurora.org
CC: hfinkel at anl.gov, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8038
--> http://llvm.org/bugs/attachment.cgi?id=8038
testcase
While looking at why the attached testcase does not get vectorized
profitably on ARM, I realized that the length of the instruction
chains using the data in vector registers is too short with respect to
what I could be doing on paper with a pencil ;-)
Here is the kernel to be vectorized:
a = *r++;
b = *r++;
c = *r++;
*w++ = 3*a - 5*b + 7*c;
*w++ = 11*a - 13*b + 17*c;
*w++ = 19*a - 23*b - 29*c;
Currently the BB vectorizer pairs the first two multiplies and then
goes back to scalar mode for the rest of the computation, so we have
something like this:
load {a,b}
{x,y} = {3,5} * {a,b}
t = x + y
u = 7 * c
t = t + u
store t
{x,y} = {11,13} * {a,b}
t = x + y
u = 17 * c
t = t + u
store t
[...]
This is suboptimal as we have the overhead of transfer between vector
and scalar registers inside the loop.
A better way to vectorize this loop is to duplicate the data, and this
would increase the number of instructions that can then be paired,
like this:
load {a,b}
({a,a}, {b,b}) = shuffle ({a,b}, copy {a,b})
load c
{c,c} = build_vector (c)
{a1,a2} = {3,11} * {a,a}
{b1,b2} = {5,13} * {b,b}
{c1,c2} = {7,17} * {c,c}
{t1,t2} = {a1,a2} + {b1,b2} + {c1,c2}
store {t1,t2}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list