Implement codegen for builtin infinity functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44604 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGBuiltin.cpp b/CodeGen/CGBuiltin.cpp
index 27c82e8..8f9b7b3 100644
--- a/CodeGen/CGBuiltin.cpp
+++ b/CodeGen/CGBuiltin.cpp
@@ -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);