[LLVMdev] Undoing DAG Combiner patterns
evan.cheng at apple.com
Thu May 16 10:48:33 PDT 2013
A better way to handle this is to a td pattern to match "add n, -c" to a subtraction. I believe several targets do something similar to this.
On May 16, 2013, at 7:12 AM, Tom Stellard <tom at stellard.net> wrote:
> 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()
>> For our target, negative constants are more costly to encode. What is the best place to revert to a sub instruction?
>> Kind regards,
>> -- Martin
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev