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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361169
91177308-0d34-0410-b5e6-
96231b3b80d8
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:
""""""""""
::
- 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:
"""""""""
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:
""""""""""
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],
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;
}
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;
+ }
};
}