[PATCH] X86: fold SSE2/AVX2 logical shift by immediate amout into zero vector when possible

Andrea_DiBiagio at sn.scee.net Andrea_DiBiagio at sn.scee.net
Mon Jul 1 04:01:44 PDT 2013


Friendly ping.

> From: Andrea DiBiagio/SN R&D/BS/UK/SCEE
> Hi all,
> 
> I'd like to contribute a patch that teaches the x86 backend how to 
> combine SSE2/AVX2 packed logical shifts by immediate amount into 
> vectors of all 0s.
> 
> SSE2/AVX2 logical shift by immediate amount where the amount is 
> greater than or
> equal to the vector element size always return a vector of all 0s.
> 
> Example:
>  pslld $35, %xmm0   # SSE2 packed doubleword logical shift left.
>                     # %xmm0 is a vector of packed int (MVT::v4i32).
> 
> The shift from this example will return a vector of all zeros in %xmm0 
and 
> therefore it could be easily rewritten for example as:
>  xorps %xmm0, %xmm0
> 
> This patch adds a new target combine rule in X86ISelLowering.cpp to
> make sure that we simplify when possible vector shifts into zero 
vectors.
> 
> I added two new tests to verify that vector shifts are correctly folded 
into
> vectors of all 0s when the immediate amount is equal or exceeds 
> the vector element size.
> 
> Thanks,
> Andrea Di Biagio
> SN Systems - Sony Computer Entertainment



**********************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify postmaster at scee.net
This footnote also confirms that this email message has been checked for 
all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United 
Kingdom
Registered in England: 3277793
**********************************************************************

P Please consider the environment before printing this e-mail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 14804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130701/c57f9a61/attachment.obj>


More information about the llvm-commits mailing list