[cfe-commits] r44604 - in /cfe/trunk: CodeGen/CGBuiltin.cpp include/clang/AST/Builtins.def
Anders Carlsson
andersca at mac.com
Tue Dec 4 23:22:49 PST 2007
Author: andersca
Date: Wed Dec 5 01:22:48 2007
New Revision: 44604
URL: http://llvm.org/viewvc/llvm-project?rev=44604&view=rev
Log:
Implement codegen for builtin infinity functions.
Modified:
cfe/trunk/CodeGen/CGBuiltin.cpp
cfe/trunk/include/clang/AST/Builtins.def
Modified: cfe/trunk/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGBuiltin.cpp?rev=44604&r1=44603&r2=44604&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/CodeGen/CGBuiltin.cpp Wed Dec 5 01:22:48 2007
@@ -112,6 +112,22 @@
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);
Modified: cfe/trunk/include/clang/AST/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Builtins.def?rev=44604&r1=44603&r2=44604&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Builtins.def (original)
+++ cfe/trunk/include/clang/AST/Builtins.def Wed Dec 5 01:22:48 2007
@@ -54,9 +54,9 @@
// F -> this is a libc/libm function with a '__builtin_' prefix added.
// Standard libc/libm functions:
-BUILTIN(__builtin_inf , "d" , "ncF")
-BUILTIN(__builtin_inff , "f" , "ncF")
-BUILTIN(__builtin_infl , "Ld" , "ncF")
+BUILTIN(__builtin_inf , "d" , "nc")
+BUILTIN(__builtin_inff , "f" , "nc")
+BUILTIN(__builtin_infl , "Ld" , "nc")
BUILTIN(__builtin_abs , "ii" , "ncF")
BUILTIN(__builtin_fabs , "dd" , "ncF")
BUILTIN(__builtin_fabsf, "ff" , "ncF")
More information about the cfe-commits
mailing list