mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[Intrinsics] Merge lround.i32 and lround.i64 into a single intrinsic with overloaded result type. Make result type for llvm.llround overloaded instead of fixing to i64
We shouldn't really make assumptions about possible sizes for long and long long. And longer term we should probably support vectorizing these intrinsics. By making the result types not fixed we can support vectors as well. Differential Revision: https://reviews.llvm.org/D62026 llvm-svn: 361169
This commit is contained in:
parent
305566e0d3
commit
a306e612b4
@ -12398,8 +12398,7 @@ nearest integer.
|
||||
Arguments:
|
||||
""""""""""
|
||||
|
||||
The argument is a floating-point number and return is i32 for
|
||||
``llvm.lround.i32`` and i64 for ``llvm.lround.i64``.
|
||||
The argument is a floating-point number and return is an integer type.
|
||||
|
||||
Semantics:
|
||||
""""""""""
|
||||
@ -12418,11 +12417,11 @@ floating-point type. Not all targets support all types however.
|
||||
|
||||
::
|
||||
|
||||
declare i64 @llvm.lround.f32(float %Val)
|
||||
declare i64 @llvm.lround.f64(double %Val)
|
||||
declare i64 @llvm.lround.f80(float %Val)
|
||||
declare i64 @llvm.lround.f128(double %Val)
|
||||
declare i64 @llvm.lround.ppcf128(double %Val)
|
||||
declare i64 @llvm.lround.i64.f32(float %Val)
|
||||
declare i64 @llvm.lround.i64.f64(double %Val)
|
||||
declare i64 @llvm.lround.i64.f80(float %Val)
|
||||
declare i64 @llvm.lround.i64.f128(double %Val)
|
||||
declare i64 @llvm.lround.i64.ppcf128(double %Val)
|
||||
|
||||
Overview:
|
||||
"""""""""
|
||||
@ -12433,7 +12432,7 @@ nearest integer.
|
||||
Arguments:
|
||||
""""""""""
|
||||
|
||||
The argument is a floating-point number and return is i64.
|
||||
The argument is a floating-point number and return is an integer type.
|
||||
|
||||
Semantics:
|
||||
""""""""""
|
||||
|
@ -539,9 +539,8 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
|
||||
def int_canonicalize : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>],
|
||||
[IntrNoMem]>;
|
||||
|
||||
def int_lround_i32 : Intrinsic<[llvm_i32_ty], [llvm_anyfloat_ty]>;
|
||||
def int_lround_i64 : Intrinsic<[llvm_i64_ty], [llvm_anyfloat_ty]>;
|
||||
def int_llround : Intrinsic<[llvm_i64_ty], [llvm_anyfloat_ty]>;
|
||||
def int_lround : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
|
||||
def int_llround : Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty]>;
|
||||
}
|
||||
|
||||
def int_minnum : Intrinsic<[llvm_anyfloat_ty],
|
||||
|
@ -6034,18 +6034,16 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
|
||||
getValue(I.getArgOperand(0))));
|
||||
return;
|
||||
}
|
||||
case Intrinsic::lround_i32:
|
||||
case Intrinsic::lround_i64:
|
||||
case Intrinsic::lround:
|
||||
case Intrinsic::llround: {
|
||||
unsigned Opcode;
|
||||
MVT RetVT;
|
||||
switch (Intrinsic) {
|
||||
default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
|
||||
case Intrinsic::lround_i32: Opcode = ISD::LROUND; RetVT = MVT::i32; break;
|
||||
case Intrinsic::lround_i64: Opcode = ISD::LROUND; RetVT = MVT::i64; break;
|
||||
case Intrinsic::llround: Opcode = ISD::LLROUND; RetVT = MVT::i64; break;
|
||||
case Intrinsic::lround: Opcode = ISD::LROUND; break;
|
||||
case Intrinsic::llround: Opcode = ISD::LLROUND; break;
|
||||
}
|
||||
|
||||
EVT RetVT = TLI.getValueType(DAG.getDataLayout(), I.getType());
|
||||
setValue(&I, DAG.getNode(Opcode, sdl, RetVT,
|
||||
getValue(I.getArgOperand(0))));
|
||||
return;
|
||||
|
@ -4620,6 +4620,14 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Intrinsic::lround:
|
||||
case Intrinsic::llround: {
|
||||
Type *ValTy = Call.getArgOperand(0)->getType();
|
||||
Type *ResultTy = Call.getType();
|
||||
Assert(!ValTy->isVectorTy() && !ResultTy->isVectorTy(),
|
||||
"Intrinsic does not support vectors", &Call);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user