diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 34431fda1be..7cfdcf22ac8 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -48541,7 +48541,9 @@ X86TargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, return std::make_pair(0U, &X86::RFP32RegClass); if (VT == MVT::f64 && !isScalarFPTypeInSSEReg(VT)) return std::make_pair(0U, &X86::RFP64RegClass); - return std::make_pair(0U, &X86::RFP80RegClass); + if (VT == MVT::f32 || VT == MVT::f64 || VT == MVT::f80) + return std::make_pair(0U, &X86::RFP80RegClass); + break; case 'y': // MMX_REGS if MMX allowed. if (!Subtarget.hasMMX()) break; return std::make_pair(0U, &X86::VR64RegClass); diff --git a/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll b/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll index a6f9f9a29ea..79084935541 100644 --- a/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll +++ b/test/CodeGen/X86/asm-reject-reg-type-mismatch.ll @@ -12,3 +12,10 @@ define void @fp80(x86_fp80) { tail call void asm sideeffect "", "r"(x86_fp80 %0) ret void } + +; CHECK: error: couldn't allocate input reg for constraint 'f' +define void @f_constraint_i128(i128* %0) { + %2 = load i128, i128* %0, align 16 + tail call void asm sideeffect "", "f"(i128 %2) + ret void +}