[LLVMdev] type legalization/operation action
Tom Stellard
tom at stellard.net
Thu Feb 5 14:41:35 PST 2015
On Thu, Feb 05, 2015 at 04:56:25PM -0500, kewuzhang wrote:
> Dear there,
>
> I have a target which is supporting the 32 bit operations natively. Right now,I want to make it support the 16 bits operations as well.
If you want to make 16-bit types legal you need to call:
addRegisterClass(MVT::i16, SomeRegisterClass) in your Target's TargetLowering
implementation.
> My initial thought is:
> (1)
> I can adding something like “ CCIfType< [i16], CCPromoteToType<i32>>”, to the CallingConv.td, then “all” the 16 bits operands will be automatically promoted to 32 bits, it will be all set.
> but looks it is not the case.
>
> (2)
> Then I tried adding something like “ setOperationAction(ISD::ADD, MVT::i16, Promote)” to the IselLowering, it still failed to select the (i16 + i16)..
>
Promoting ISD::ADD is not supported. Take a look in SelectionDAGLegalize::PromoteNode()
to see which opcodes can be promoted. You will either need to custome lower it or
properly handle it in the PromoteNode() function.
-Tom
> wondering which part I missed?
>
> best
>
> Kevin
> _______________________________________________
> 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