The PowerPC backend on PPC64 for non-Darwin (SVR4 ABI) systems currently has a problem handling integer types smaller than 64 bits. This is because the ABI specifies that these types are zero-extended to 64 bits on the stack and the default logic provided in LegalizeDAG does not use that convention. Specifically, for these targets we have: setOperationAction(ISD::VAARG, MVT::Other, Expand); I thought that I could solve this problem by: setOperationAction(ISD::VAARG, MVT::i1, Promote); AddPromotedToType (ISD::VAARG, MVT::i1, MVT::i64); setOperationAction(ISD::VAARG, MVT::i8, Promote); AddPromotedToType (ISD::VAARG, MVT::i8, MVT::i64); setOperationAction(ISD::VAARG, MVT::i16, Promote); AddPromotedToType (ISD::VAARG, MVT::i16, MVT::i64); setOperationAction(ISD::VAARG, MVT::i32, Promote); AddPromotedToType (ISD::VAARG, MVT::i32, MVT::i64); but this does not seem to have any effect. I thought this would work because SDValue DAGTypeLegalizer::PromoteIntRes_VAARG seems to have the appropriate logic. Is this a bug, or am I misunderstanding how Promote works? Thanks again, Hal -- Hal Finkel Postdoctoral Appointee Leadership Computing Facility Argonne National Laboratory
Hi Finkel, Le 23/03/2012 05:50, Hal Finkel a écrit :> The PowerPC backend on PPC64 for non-Darwin (SVR4 ABI) systems > currently has a problem handling integer types smaller than 64 bits. > This is because the ABI specifies that these types are zero-extended to > 64 bits on the stack and the default logic provided in LegalizeDAG does > not use that convention. Specifically, for these targets we have: > setOperationAction(ISD::VAARG, MVT::Other, Expand); > I thought that I could solve this problem by: > setOperationAction(ISD::VAARG, MVT::i1, Promote); > AddPromotedToType (ISD::VAARG, MVT::i1, MVT::i64); > setOperationAction(ISD::VAARG, MVT::i8, Promote); > AddPromotedToType (ISD::VAARG, MVT::i8, MVT::i64); > setOperationAction(ISD::VAARG, MVT::i16, Promote); > AddPromotedToType (ISD::VAARG, MVT::i16, MVT::i64); > setOperationAction(ISD::VAARG, MVT::i32, Promote); > AddPromotedToType (ISD::VAARG, MVT::i32, MVT::i64); > but this does not seem to have any effect. I thought this would work > because SDValue DAGTypeLegalizer::PromoteIntRes_VAARG seems to have the > appropriate logic. Is this a bug, or am I misunderstanding how Promote > works?IMHO, you are doing it right but it looks like ISD::VAARG is not handled in SelectionDAGLegalize::PromoteNode() yet. DAGTypeLegalizer is used to legalize "non-legal" types regardless of the operation (need confirmation). Ivan> > Thanks again, > Hal >
On Fri, 23 Mar 2012 09:50:12 +0100 Ivan Llopard <ivanllopard at gmail.com> wrote:> Hi Finkel, > > Le 23/03/2012 05:50, Hal Finkel a écrit : > > The PowerPC backend on PPC64 for non-Darwin (SVR4 ABI) systems > > currently has a problem handling integer types smaller than 64 bits. > > This is because the ABI specifies that these types are > > zero-extended to 64 bits on the stack and the default logic > > provided in LegalizeDAG does not use that convention. Specifically, > > for these targets we have: setOperationAction(ISD::VAARG, > > MVT::Other, Expand); I thought that I could solve this problem by: > > setOperationAction(ISD::VAARG, MVT::i1, Promote); > > AddPromotedToType (ISD::VAARG, MVT::i1, MVT::i64); > > setOperationAction(ISD::VAARG, MVT::i8, Promote); > > AddPromotedToType (ISD::VAARG, MVT::i8, MVT::i64); > > setOperationAction(ISD::VAARG, MVT::i16, Promote); > > AddPromotedToType (ISD::VAARG, MVT::i16, MVT::i64); > > setOperationAction(ISD::VAARG, MVT::i32, Promote); > > AddPromotedToType (ISD::VAARG, MVT::i32, MVT::i64); > > but this does not seem to have any effect. I thought this would work > > because SDValue DAGTypeLegalizer::PromoteIntRes_VAARG seems to have > > the appropriate logic. Is this a bug, or am I misunderstanding how > > Promote works? > > IMHO, you are doing it right but it looks like ISD::VAARG is not > handled in SelectionDAGLegalize::PromoteNode() yet. DAGTypeLegalizer > is used to legalize "non-legal" types regardless of the operation > (need confirmation).Thanks! That makes sense, and looking more closely at the PromoteIntRes_VAARG code, it finds the type to which to promote by calling TLI.getRegisterType, which won't work in this case. This should not be difficult to fix. -Hal> > Ivan > > > > > Thanks again, > > Hal > >-- Hal Finkel Postdoctoral Appointee Leadership Computing Facility Argonne National Laboratory 1-630-252-0023 hfinkel at anl.gov
Maybe Matching Threads
- [LLVMdev] Fixing VAARG on PPC64
- [LLVMdev] Fixing VAARG on PPC64
- [LLVMdev] Fixing VAARG on PPC64
- [LLVMdev] Promote MVT::f32 load/store to MVT::i32 cause infinite loop in LegalizeDAG?
- [LLVMdev] Promote MVT::f32 load/store to MVT::i32 cause infinite loop in LegalizeDAG?