forked from OSchip/llvm-project
Implement codegen for builtin infinity functions.
llvm-svn: 44604
This commit is contained in:
parent
cbdb6f5b5d
commit
e8ee04c0bc
|
@ -112,6 +112,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
|
||||||
|
|
||||||
return RValue::get(V);
|
return RValue::get(V);
|
||||||
}
|
}
|
||||||
|
case Builtin::BI__builtin_inff: {
|
||||||
|
llvm::APFloat f(llvm::APFloat::IEEEsingle,
|
||||||
|
llvm::APFloat::fcInfinity, false);
|
||||||
|
|
||||||
|
llvm::Value *V = llvm::ConstantFP::get(llvm::Type::FloatTy, f);
|
||||||
|
return RValue::get(V);
|
||||||
|
}
|
||||||
|
case Builtin::BI__builtin_inf:
|
||||||
|
// FIXME: mapping long double onto double.
|
||||||
|
case Builtin::BI__builtin_infl: {
|
||||||
|
llvm::APFloat f(llvm::APFloat::IEEEdouble,
|
||||||
|
llvm::APFloat::fcInfinity, false);
|
||||||
|
|
||||||
|
llvm::Value *V = llvm::ConstantFP::get(llvm::Type::DoubleTy, f);
|
||||||
|
return RValue::get(V);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RValue::get(0);
|
return RValue::get(0);
|
||||||
|
|
|
@ -54,9 +54,9 @@
|
||||||
// F -> this is a libc/libm function with a '__builtin_' prefix added.
|
// F -> this is a libc/libm function with a '__builtin_' prefix added.
|
||||||
|
|
||||||
// Standard libc/libm functions:
|
// Standard libc/libm functions:
|
||||||
BUILTIN(__builtin_inf , "d" , "ncF")
|
BUILTIN(__builtin_inf , "d" , "nc")
|
||||||
BUILTIN(__builtin_inff , "f" , "ncF")
|
BUILTIN(__builtin_inff , "f" , "nc")
|
||||||
BUILTIN(__builtin_infl , "Ld" , "ncF")
|
BUILTIN(__builtin_infl , "Ld" , "nc")
|
||||||
BUILTIN(__builtin_abs , "ii" , "ncF")
|
BUILTIN(__builtin_abs , "ii" , "ncF")
|
||||||
BUILTIN(__builtin_fabs , "dd" , "ncF")
|
BUILTIN(__builtin_fabs , "dd" , "ncF")
|
||||||
BUILTIN(__builtin_fabsf, "ff" , "ncF")
|
BUILTIN(__builtin_fabsf, "ff" , "ncF")
|
||||||
|
|
Loading…
Reference in New Issue