[llvm] r357615 - [X86] Extend boolean arguments to inline-asm according to getBooleanType
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 3 10:43:15 PDT 2019
Author: kparzysz
Date: Wed Apr 3 10:43:14 2019
New Revision: 357615
URL: http://llvm.org/viewvc/llvm-project?rev=357615&view=rev
Log:
[X86] Extend boolean arguments to inline-asm according to getBooleanType
Differential Revision: https://reviews.llvm.org/D60208
Added:
llvm/trunk/test/CodeGen/X86/inline-asm-i-constraint-i1.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=357615&r1=357614&r2=357615&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Apr 3 10:43:14 2019
@@ -43505,8 +43505,13 @@ void X86TargetLowering::LowerAsmOperandF
case 'i': {
// Literal immediates are always ok.
if (ConstantSDNode *CST = dyn_cast<ConstantSDNode>(Op)) {
- // Widen to 64 bits here to get it sign extended.
- Result = DAG.getTargetConstant(CST->getSExtValue(), SDLoc(Op), MVT::i64);
+ bool IsBool = CST->getConstantIntValue()->getBitWidth() == 1;
+ 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;
}
Added: llvm/trunk/test/CodeGen/X86/inline-asm-i-constraint-i1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-i-constraint-i1.ll?rev=357615&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-i-constraint-i1.ll (added)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-i-constraint-i1.ll Wed Apr 3 10:43:14 2019
@@ -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 }
More information about the llvm-commits
mailing list