[LLVMdev] Undoing DAG Combiner patterns
Tom Stellard
tom at stellard.net
Thu May 16 07:12:40 PDT 2013
On Thu, May 16, 2013 at 02:03:14AM +0000, Martin Filteau wrote:
> Hi all,
>
> It's the first LLVM backend we do for our asynchronous DSP. So, I apologize if this is a trivial question!
>
> The target-independent DAG combiner performs the following transformation:
>
> sub n, c -> add n, -c
>
It looks to me like this transformation would happen during the
legalization phase. Is sub legal on your target? If not, you
can custom lower it e.g.:
setOperationAction(ISD::SUB, MVT::i32, Custom);
and then handle ISD::SUB in the TargetLowering::LowerOperation()
function.
-Tom
> For our target, negative constants are more costly to encode. What is the best place to revert to a sub instruction?
>
> Kind regards,
>
> -- Martin
>
> www.octasic.com<http://www.octasic.com>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list