Hi Matthijs,
Yes, I've turned off the link-time optimizations (otherwise it just
propagates my constant vectors and immediate prints the result). ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/google/slight_smile.png?v=12)
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];
}
And here's part of the output from the online demo:
LoadInst* float_tmp2 = new LoadInst(ptr_x, "tmp2", false, label_entry);
LoadInst* float_tmp5 = new LoadInst(ptr_y, "tmp5", false, label_entry);
BinaryOperator* float_tmp6 = BinaryOperator::create(Instruction::Add,
float_tmp2, float_tmp5, "tmp6", label_entry);
StoreInst* void_20 = new StoreInst(float_tmp6, ptr_z, false, label_entry);
GetElementPtrInst* ptr_tmp10 = new GetElementPtrInst(ptr_x, const_int32_13,
"tmp10", label_entry);
LoadInst* float_tmp11 = new LoadInst(ptr_tmp10, "tmp11", false,
label_entry);
GetElementPtrInst* ptr_tmp13 = new GetElementPtrInst(ptr_y, const_int32_13,
"tmp13", label_entry);
LoadInst* float_tmp14 = new LoadInst(ptr_tmp13, "tmp14", false,
label_entry);
BinaryOperator* float_tmp15 = BinaryOperator::create(Instruction::Add,
float_tmp11, float_tmp14, "tmp15", label_entry);
...
So it just processes one element at a time instead of with one (SIMD)
operation.
Thank you,
-Nicolas (not Anton) ![:stuck_out_tongue: :stuck_out_tongue:](https://emoji.discourse-cdn.com/google/stuck_out_tongue.png?v=12)