[llvm] r370293 - [X86] Make inline assembly 'x' and 'v' constraints work for f128.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 28 22:13:56 PDT 2019
Author: ctopper
Date: Wed Aug 28 22:13:56 2019
New Revision: 370293
URL: http://llvm.org/viewvc/llvm-project?rev=370293&view=rev
Log:
[X86] Make inline assembly 'x' and 'v' constraints work for f128.
Including a type legalizer fix to make bitcast operand promotion
work correctly when getSoftenedFloat returns f128 instead of i128.
Fixes PR43157
Added:
llvm/trunk/test/CodeGen/X86/pr43157.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=370293&r1=370292&r2=370293&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Aug 28 22:13:56 2019
@@ -895,8 +895,12 @@ bool DAGTypeLegalizer::CanSkipSoftenFloa
}
SDValue DAGTypeLegalizer::SoftenFloatOp_BITCAST(SDNode *N) {
- return DAG.getNode(ISD::BITCAST, SDLoc(N), N->getValueType(0),
- GetSoftenedFloat(N->getOperand(0)));
+ SDValue Op0 = GetSoftenedFloat(N->getOperand(0));
+
+ if (Op0 == N->getOperand(0))
+ return SDValue();
+
+ return DAG.getNode(ISD::BITCAST, SDLoc(N), N->getValueType(0), Op0);
}
SDValue DAGTypeLegalizer::SoftenFloatOp_COPY_TO_REG(SDNode *N) {
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=370293&r1=370292&r2=370293&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Aug 28 22:13:56 2019
@@ -45784,8 +45784,9 @@ X86TargetLowering::getRegForInlineAsmCon
if (VConstraint && Subtarget.hasVLX())
return std::make_pair(0U, &X86::FR64XRegClass);
return std::make_pair(0U, &X86::FR64RegClass);
- // TODO: Handle f128 and i128 in FR128RegClass after it is tested well.
- // Vector types.
+ // TODO: Handle i128 in FR128RegClass after it is tested well.
+ // Vector types and fp128.
+ case MVT::f128:
case MVT::v16i8:
case MVT::v8i16:
case MVT::v4i32:
Added: llvm/trunk/test/CodeGen/X86/pr43157.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr43157.ll?rev=370293&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr43157.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr43157.ll Wed Aug 28 22:13:56 2019
@@ -0,0 +1,20 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-pc-linux -o - -mattr=+mmx | FileCheck %s
+
+define void @foo(fp128 %x) {
+; CHECK-LABEL: foo:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: pushq %rax
+; CHECK-NEXT: .cfi_def_cfa_offset 16
+; CHECK-NEXT: movaps {{.*}}(%rip), %xmm1
+; CHECK-NEXT: callq __multf3
+; CHECK-NEXT: #APP
+; CHECK-NEXT: #NO_APP
+; CHECK-NEXT: popq %rax
+; CHECK-NEXT: .cfi_def_cfa_offset 8
+; CHECK-NEXT: retq
+entry:
+ %mul = fmul fp128 %x, 0xL00000000000000003FFF800000000000
+ tail call void asm sideeffect "", "x,~{dirflag},~{fpsr},~{flags}"(fp128 %mul)
+ ret void
+}
More information about the llvm-commits
mailing list