[cfe-commits] r49980 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 19 17:50:39 PDT 2008
Author: lattner
Date: Sat Apr 19 19:50:39 2008
New Revision: 49980
URL: http://llvm.org/viewvc/llvm-project?rev=49980&view=rev
Log:
implement a fixme, add support for ++/-- on long double.
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=49980&r1=49979&r2=49980&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Sat Apr 19 19:50:39 2008
@@ -14,6 +14,7 @@
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "clang/AST/AST.h"
+#include "clang/Basic/TargetInfo.h"
#include "llvm/Constants.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
@@ -43,7 +44,6 @@
llvm::IRBuilder &Builder;
CGObjCRuntime *Runtime;
-
public:
ScalarExprEmitter(CodeGenFunction &cgf) : CGF(cgf),
@@ -602,14 +602,15 @@
if (isa<llvm::IntegerType>(InVal->getType()))
NextVal = llvm::ConstantInt::get(InVal->getType(), AmountVal);
else if (InVal->getType() == llvm::Type::FloatTy)
- // FIXME: Handle long double.
NextVal =
llvm::ConstantFP::get(llvm::APFloat(static_cast<float>(AmountVal)));
- else {
- // FIXME: Handle long double.
- assert(InVal->getType() == llvm::Type::DoubleTy);
+ else if (InVal->getType() == llvm::Type::DoubleTy)
NextVal =
llvm::ConstantFP::get(llvm::APFloat(static_cast<double>(AmountVal)));
+ else {
+ llvm::APFloat F(static_cast<float>(AmountVal));
+ F.convert(*CGF.Target.getLongDoubleFormat(), llvm::APFloat::rmTowardZero);
+ NextVal = llvm::ConstantFP::get(F);
}
NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
}
More information about the cfe-commits
mailing list