Hi Guys, I noticed that the operation actions( promote/expand/custom) are set per operation basis. Wondering if we can set it up globally? For example, I have native supported 32 bits registers, to handle 8 bits value operations, I want to do promote. and to support 64 bit operations, I want to expand. If I can set up the operation actions for the same type globally, then I can avoid to list all the operations with the same action . like // expand type MVT::i64 to MVT::i32 for all the operations instead of “ setOperationAction( ISD::ADD, MVT::i64, Expand); setOperationAction( ISD::SUB, MVT::i64, Expand); setOperationAction( ISD::MUL, MVT::i64, Expand); ….. “ Or LLVM is smart enough to do it buy default? best kevin
Hi Kevin, You can put your operations in an array and then you can loop around the setOperationAction, such as: loop i: setOperationAction (your_array[i], MVT::i64, Expand) end loop. That's it. Regards, Erkan. On Fri, Dec 5, 2014 at 6:00 PM, kewuzhang <kewu.zhang at amd.com> wrote:> Hi Guys, > > I noticed that the operation actions( promote/expand/custom) are set per > operation basis. > Wondering if we can set it up globally? > > For example, I have native supported 32 bits registers, to handle 8 > bits value operations, I want to do promote. > and to support 64 bit operations, I want to expand. > > If I can set up the operation actions for the same type globally, then I > can avoid to list all the operations with the same action . > like > > // expand type MVT::i64 to MVT::i32 for all the operations > > instead of > “ > setOperationAction( ISD::ADD, MVT::i64, Expand); > setOperationAction( ISD::SUB, MVT::i64, Expand); > setOperationAction( ISD::MUL, MVT::i64, Expand); > ….. > “ > Or LLVM is smart enough to do it buy default? > > best > > kevin > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Best Regards, Erkan Diken ------------------ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141205/f8b9ec13/attachment.html>
And of course with a nested loop, you can apply setOperationAction of an operation for different MVT types. To do this, you need to keep an array of types as well. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141205/68bab83c/attachment.html>
On Fri, Dec 05, 2014 at 12:00:41PM -0500, kewuzhang wrote:> Hi Guys, > > I noticed that the operation actions( promote/expand/custom) are set per operation basis. > Wondering if we can set it up globally? > > For example, I have native supported 32 bits registers, to handle 8 bits value operations, I want to do promote. > and to support 64 bit operations, I want to expand. >This will happen automatically if you don't declare i8 as a legal type. Do you have something like addRegisterClass(MVT::i8, SomeRegClass) in your TargetLowering constructor? If so, then remove it and see what happens. -Tom> If I can set up the operation actions for the same type globally, then I can avoid to list all the operations with the same action . > like > > // expand type MVT::i64 to MVT::i32 for all the operations > > instead of > “ > setOperationAction( ISD::ADD, MVT::i64, Expand); > setOperationAction( ISD::SUB, MVT::i64, Expand); > setOperationAction( ISD::MUL, MVT::i64, Expand); > ….. > “ > Or LLVM is smart enough to do it buy default? > > best > > kevin > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev