1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[X86] Only allow f32, f64, or f80 to be used with 'f' inline assembly constraint.

Avoids crash when using i128. Gives better error than
'scalar-to-vector conversion failed' for other types.
This commit is contained in:
Craig Topper 2020-05-13 12:51:18 -07:00
parent d1c7a5a9fb
commit 892a44aaf7
2 changed files with 10 additions and 1 deletions

View File

@ -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);

View File

@ -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
}