diff options
author | Kees Cook <keescook@google.com> | 2019-05-22 16:16:15 +0000 |
---|---|---|
committer | Kees Cook <keescook@google.com> | 2019-05-22 16:16:15 +0000 |
commit | c2187c20a461c19ff50dc358b932c44f2ef5d6c6 (patch) | |
tree | f05dfc1070aac8cd4e1f1fabbf62d4c54d12e86a /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | a7a687e500042f078c8a0f6ca0e947e93af4de5f (diff) | |
download | bcm5719-llvm-c2187c20a461c19ff50dc358b932c44f2ef5d6c6.tar.gz bcm5719-llvm-c2187c20a461c19ff50dc358b932c44f2ef5d6c6.zip |
[TargetLowering] Extend bool args to inline-asm according to getBooleanType
Summary:
This extends Krzysztof Parzyszek's X86-specific solution
(https://reviews.llvm.org/D60208) to the generic code pointed out by
James Y Knight.
Reviewers: kparzysz, craig.topper, nickdesaulniers
Subscribers: efriedma, sdardis, nemanjai, javed.absar, eraman, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, llvm-commits, srhines, void, nickdesaulniers, jyknight
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60224
llvm-svn: 361404
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 74683fcf585..4d950984b29 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -3562,7 +3562,16 @@ void TargetLowering::LowerAsmOperandForConstraint(SDValue Op, return; } else if ((C = dyn_cast<ConstantSDNode>(Op)) && ConstraintLetter != 's') { - Ops.push_back(DAG.getTargetConstant(Offset + C->getSExtValue(), + // gcc prints these as sign extended. Sign extend value to 64 bits + // now; without this it would get ZExt'd later in + // ScheduleDAGSDNodes::EmitNode, which is very generic. + bool IsBool = C->getConstantIntValue()->getBitWidth() == 1; + BooleanContent BCont = getBooleanContents(MVT::i64); + ISD::NodeType ExtOpc = IsBool ? getExtendForContent(BCont) + : ISD::SIGN_EXTEND; + int64_t ExtVal = ExtOpc == ISD::ZERO_EXTEND ? C->getZExtValue() + : C->getSExtValue(); + Ops.push_back(DAG.getTargetConstant(Offset + ExtVal, SDLoc(C), MVT::i64)); return; } else { |