mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
IR: Add ConstantFP::getNaN()
This is a wrapper around APFloat::getNaN(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235332 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -663,6 +663,17 @@ Constant *ConstantFP::get(Type *Ty, StringRef Str) {
|
||||
return C;
|
||||
}
|
||||
|
||||
Constant *ConstantFP::getNaN(Type *Ty, bool Negative, unsigned Type) {
|
||||
const fltSemantics &Semantics = *TypeToFloatSemantics(Ty->getScalarType());
|
||||
APFloat NaN = APFloat::getNaN(Semantics, Negative, Type);
|
||||
Constant *C = get(Ty->getContext(), NaN);
|
||||
|
||||
if (VectorType *VTy = dyn_cast<VectorType>(Ty))
|
||||
return ConstantVector::getSplat(VTy->getNumElements(), C);
|
||||
|
||||
return C;
|
||||
}
|
||||
|
||||
Constant *ConstantFP::getNegativeZero(Type *Ty) {
|
||||
const fltSemantics &Semantics = *TypeToFloatSemantics(Ty->getScalarType());
|
||||
APFloat NegZero = APFloat::getZero(Semantics, /*Negative=*/true);
|
||||
|
Reference in New Issue
Block a user