[llvm] r199114 - [SystemZ] Optimize (sext (ashr (shl ...), ...))

Richard Sandiford rsandifo at linux.vnet.ibm.com
Tue Jan 14 01:16:14 PST 2014


Hal Finkel <hfinkel at anl.gov> writes:
> ----- Original Message -----
>> From: "Richard Sandiford" <rsandifo at linux.vnet.ibm.com>
>> To: llvm-commits at cs.uiuc.edu
>> Sent: Monday, January 13, 2014 9:17:53 AM
>> Subject: [llvm] r199114 - [SystemZ] Optimize (sext (ashr (shl ...), ...))
>> 
>> Author: rsandifo
>> Date: Mon Jan 13 09:17:53 2014
>> New Revision: 199114
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=199114&view=rev
>> Log:
>> [SystemZ] Optimize (sext (ashr (shl ...), ...))
>> 
>> ...into (ashr (shl (anyext X), ...), ...), which requires one fewer
>> instruction.  The (anyext X) can sometimes be simplified too.
>> 
>> I didn't do this in DAGCombiner because widening shifts isn't a win
>> on all targets.
>
> Hrmm, but this looks like it should be useful for PPC64 as well. Can you
> please move this into DAGCombine and add some TargetLowering callback to
> control it?

What kind of callback though?  I think if I suggested a callback to
control this specific optimisation it'd probably get rejected.  (I assume
we wouldn't want individual callbacks for many different transforms.)

Or we could assign target-dependent costs to each operation and do
the transformation only if the new form is cheaper than the old form.
But does DAGCombiner do that kind of thing at the moment?

Thanks,
Richard




More information about the llvm-commits mailing list