[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
Fri May 24 05:46:41 PDT 2013
Hi Rafael,
Rafael EspĂndola <rafael.espindola at gmail.com> wrote on 23/05/2013
18:13:29:
> you explicitly test that things like
>
> define i32 @MulTest3_i8(i32 %InVec) {
> entry:
> %0 = bitcast i32 %InVec to <4 x i8>
> %mul = mul <4 x i8> %0, <i8 4, i8 4, i8 2, i8 2>
> %1 = bitcast <4 x i8> %mul to i32
> ret i32 %1
> }
>
> are not optimized. Why is it not profitable to use
>
> shl <4 x i8> %0, <i8 2, i8 2, i8 1, i8 1>
>
> ?
My original test simply tried to verify that multiply by constant splats
of known
power-of-2 were correctly optimized into shifts.
However, I think that converting a mul into a shift is profitable even in
the
case you reported and probably my patch should be rewritten to address the
general case
(i.e. not only the case of constant splats).
I will update this thread as soon as I have a new patch available.
Thanks for the feedback!
-- 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
More information about the llvm-commits
mailing list