[LLVMdev] question on scalarization
Bjorn De Sutter
bjorn.desutter at elis.ugent.be
Tue Feb 14 03:31:13 PST 2012
Hi all,
I have a backend for an in house architecture, and would like to start working on support for vector datatypes and intrinsics. As I starter I would like to have vector code scalarized, as is done, e.g., for the Mips backend. However, I cannot find a way to force the instruction selector or type legalizer to scalarize the vectors (i.e., vector types and vector ops). Can anyone help me out?
The code I am trying to compile is as follows:
typedef short v2sw __attribute__ ((vector_size (8)));
int main(int argc, char ** argv) {
v2sw a = {1,2,3,4};
v2sw b = {5,6,7,8};
v2sw c = a;
int i;
for (i=0;i<argc;i++)
c += b;
printf("%d %d %d %d\n",c[0],c[1],c[2],c[3]);
return 0;
}
When I compile this to bytecode with clang and then invoke llc with -march=mips, everything goes fine and the code is scalarized. But when I try it on my backend, I get
LLVM ERROR: Cannot select: 0xa5e2730: v4i16 = BUILD_VECTOR 0xa5e29d8, 0xa5e2378, 0xa5e21e0, 0xa5e2158 [ID=14]
0xa5e29d8: i32 = Constant<1> [ID=11]
0xa5e2378: i32 = Constant<2> [ID=10]
0xa5e21e0: i32 = Constant<3> [ID=9]
0xa5e2158: i32 = Constant<4> [ID=8]
Now I've looked at the Mips backend and other backends in detail, but I didn't find anything that would force the scalarization in there (like references to v64, v4i16, BUILD_VECTOR, ...), so I am clueless ...
Thanks,
Bjorn De Sutter
Computer Systems Lab
Ghent University
More information about the llvm-dev
mailing list