[LLVMdev] Vector code
Frits van Bommel
fvbommel at wxs.nl
Thu May 8 14:56:04 PDT 2008
Nicolas Capens wrote:
> Here's essentially what I try to generate:
>
> void add(float z[4], float x[4], float y[4])
> {
> z[0] = x[0] + y[0];
> z[1] = x[1] + y[1];
> z[2] = x[2] + y[2];
> z[3] = x[3] + y[3];
> }
This is the vectorized llvm-assembly equivalent:
-----
define void @add(<4 x float>* %z, <4 x float>* %x, <4 x float>* %y) {
entry:
%xs = load <4 x float>* %x
%ys = load <4 x float>* %y
%zs = add <4 x float> %xs, %ys
store <4 x float> %zs, <4 x float>* %z
ret void
}
------
Run that through "llvm-as < code.ll | llc -march=cpp" to see the code to
construct it.
More information about the llvm-dev
mailing list