[llvm-commits] Fix PR 13837: Optimization for vector creation from type conversion of another vector

Weiming Zhao weimingz at codeaurora.org
Thu Sep 13 18:09:38 PDT 2012


Hi,

 

This patch addresses PR 13837 (http://llvm.org/bugs/show_bug.cgi?id=13837 ):

 

When a vector is created from type conversion, it generates multiple scalar
conversion instead of a vectorized conversion.

For example:

int4 conv4i(float4 in)

{

  int4 out={ (int)in.x, (int)in.y, (int)in.z, (int)in.w};

  return out;

}

 

Current LLVM first extracts each element of "in" and then does a fp-to-si
for each element and then builds the result vector.

 

This patch allows a vectorized fp-to-si conversion against the input vector
directly, thus results in better performance.

 

A set of unit tests are included in the patch as well.

 

It passes all the test suite and no new fails for the unit test.

 

Please review the attached patch.

 

Thanks,

Weiming

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120913/182e4e50/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PR-13837-Combine-Cast-and-Build_Vector-when-possible.patch
Type: application/octet-stream
Size: 9351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120913/182e4e50/attachment.obj>


More information about the llvm-commits mailing list