mirror of
https://github.com/RPCSX/llvm.git
synced 2025-03-04 10:59:04 +00:00
Fix assertion failure with fp128 to unsigned i64 conversion
Patch by Mitch Bodart Differential Revision: http://reviews.llvm.org/D13780 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250550 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9bad2f04b3
commit
bde51df753
@ -12779,7 +12779,7 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the given FP_TO_SINT (IsSigned) or FP_TO_UINT (!IsSigned) operation
|
// If the given FP_TO_SINT (IsSigned) or FP_TO_UINT (!IsSigned) operation
|
||||||
// is legal, or has an f16 source (which needs to be promoted to f32),
|
// is legal, or has an fp128 or f16 source (which needs to be promoted to f32),
|
||||||
// just return an <SDValue(), SDValue()> pair.
|
// just return an <SDValue(), SDValue()> pair.
|
||||||
// Otherwise it is assumed to be a conversion from one of f32, f64 or f80
|
// Otherwise it is assumed to be a conversion from one of f32, f64 or f80
|
||||||
// to i16, i32 or i64, and we lower it to a legal sequence.
|
// to i16, i32 or i64, and we lower it to a legal sequence.
|
||||||
@ -12796,15 +12796,11 @@ X86TargetLowering::FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG,
|
|||||||
EVT TheVT = Op.getOperand(0).getValueType();
|
EVT TheVT = Op.getOperand(0).getValueType();
|
||||||
auto PtrVT = getPointerTy(DAG.getDataLayout());
|
auto PtrVT = getPointerTy(DAG.getDataLayout());
|
||||||
|
|
||||||
if (TheVT == MVT::f16)
|
if (TheVT != MVT::f32 && TheVT != MVT::f64 && TheVT != MVT::f80) {
|
||||||
// We need to promote the f16 to f32 before using the lowering
|
// f16 must be promoted before using the lowering in this routine.
|
||||||
// in this routine.
|
// fp128 does not use this lowering.
|
||||||
return std::make_pair(SDValue(), SDValue());
|
return std::make_pair(SDValue(), SDValue());
|
||||||
|
}
|
||||||
assert((TheVT == MVT::f32 ||
|
|
||||||
TheVT == MVT::f64 ||
|
|
||||||
TheVT == MVT::f80) &&
|
|
||||||
"Unexpected FP operand type in FP_TO_INTHelper");
|
|
||||||
|
|
||||||
// If using FIST to compute an unsigned i64, we'll need some fixup
|
// If using FIST to compute an unsigned i64, we'll need some fixup
|
||||||
// to handle values above the maximum signed i64. A FIST is always
|
// to handle values above the maximum signed i64. A FIST is always
|
||||||
|
@ -133,3 +133,19 @@ define i64 @x_to_s64(x86_fp80 %a) nounwind {
|
|||||||
%r = fptosi x86_fp80 %a to i64
|
%r = fptosi x86_fp80 %a to i64
|
||||||
ret i64 %r
|
ret i64 %r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; CHECK-LABEL: t_to_u64
|
||||||
|
; CHECK: __fixunstfdi
|
||||||
|
; CHECK: ret
|
||||||
|
define i64 @t_to_u64(fp128 %a) nounwind {
|
||||||
|
%r = fptoui fp128 %a to i64
|
||||||
|
ret i64 %r
|
||||||
|
}
|
||||||
|
|
||||||
|
; CHECK-LABEL: t_to_s64
|
||||||
|
; CHECK: __fixtfdi
|
||||||
|
; CHECK: ret
|
||||||
|
define i64 @t_to_s64(fp128 %a) nounwind {
|
||||||
|
%r = fptosi fp128 %a to i64
|
||||||
|
ret i64 %r
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user