[PATCH] Teach instcombine how to combine multiply of constant splat of known power-of-2

Andrea_DiBiagio at sn.scee.net Andrea_DiBiagio at sn.scee.net
Thu May 23 07:23:35 PDT 2013


Hello,

I'd like to contribute a patch that teaches instcombine how to rewrite
vector multiply instructions into shifts when the second operand 
of the multiply is a splat of a known constant power-of-2.

Prior to this change, the following two combine rules only worked for 
scalar
types:
 1) ((X << C1)*C2) == (X * (C2 << C1))
 2) X*(2^C) == X << C

With this patch:
 rule 1. can be used also when C2 is a splat of a known power-of-2;
 rule 2. can be used also when C is a splat of a known power-of-2.

I'd guess that probably whoever originally implemented those two combine
rules forgot to handle also the case where C/C2 is a vector.
If I am wrong and there was a reason why those rules were originally only 
enabled to combine constant vector splats then I would be interested to
know what that reason is.



Thanks!
-- Andrea Di Biagio
SN Systems - Sony Computer Entertainment Group

**********************************************************************
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-instcombine.diff
Type: application/octet-stream
Size: 14184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130523/647bec45/attachment.obj>


More information about the llvm-commits mailing list