[X86] Extend boolean arguments to inline-asm according to getBooleanType
Differential Revision: https://reviews.llvm.org/D60208 llvm-svn: 357615
This commit is contained in:
parent
27a83e99f4
commit
4841643a1d
|
@ -43505,8 +43505,13 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
|
||||||
case 'i': {
|
case 'i': {
|
||||||
// Literal immediates are always ok.
|
// Literal immediates are always ok.
|
||||||
if (ConstantSDNode *CST = dyn_cast<ConstantSDNode>(Op)) {
|
if (ConstantSDNode *CST = dyn_cast<ConstantSDNode>(Op)) {
|
||||||
// Widen to 64 bits here to get it sign extended.
|
bool IsBool = CST->getConstantIntValue()->getBitWidth() == 1;
|
||||||
Result = DAG.getTargetConstant(CST->getSExtValue(), SDLoc(Op), MVT::i64);
|
BooleanContent BCont = getBooleanContents(MVT::i64);
|
||||||
|
ISD::NodeType ExtOpc = IsBool ? getExtendForContent(BCont)
|
||||||
|
: ISD::SIGN_EXTEND;
|
||||||
|
int64_t ExtVal = ExtOpc == ISD::ZERO_EXTEND ? CST->getZExtValue()
|
||||||
|
: CST->getSExtValue();
|
||||||
|
Result = DAG.getTargetConstant(ExtVal, SDLoc(Op), MVT::i64);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||||
|
|
||||||
|
; Make sure that boolean immediates are properly (zero) extended.
|
||||||
|
; CHECK: .Ltmp[[N:[0-9]+]]:
|
||||||
|
; CHECK-NEXT: .quad (42+1)-.Ltmp[[N]]
|
||||||
|
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
define i32 @foo() #0 {
|
||||||
|
entry:
|
||||||
|
tail call void asm sideeffect ".quad 42 + ${0:c} - .\0A\09", "i,~{dirflag},~{fpsr},~{flags}"(i1 true) #0
|
||||||
|
ret i32 1
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes #0 = { nounwind }
|
Loading…
Reference in New Issue