[cfe-commits] r41926 - in /cfe/trunk/CodeGen: CGExprComplex.cpp CGExprScalar.cpp
Chris Lattner
sabre at nondot.org
Wed Sep 12 23:19:19 PDT 2007
Author: lattner
Date: Thu Sep 13 01:19:18 2007
New Revision: 41926
URL: http://llvm.org/viewvc/llvm-project?rev=41926&view=rev
Log:
update to match llvm mainline api
Modified:
cfe/trunk/CodeGen/CGExprComplex.cpp
cfe/trunk/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprComplex.cpp?rev=41926&r1=41925&r2=41926&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/CodeGen/CGExprComplex.cpp Thu Sep 13 01:19:18 2007
@@ -301,9 +301,16 @@
llvm::Value *NextVal;
if (isa<llvm::IntegerType>(InVal.first->getType()))
NextVal = llvm::ConstantInt::get(InVal.first->getType(), AmountVal);
- else
+ else if (InVal.first->getType() == llvm::Type::FloatTy)
+ // FIXME: Handle long double.
NextVal = llvm::ConstantFP::get(InVal.first->getType(),
- static_cast<double>(AmountVal));
+ llvm::APFloat(static_cast<float>(AmountVal)));
+ else {
+ // FIXME: Handle long double.
+ assert(InVal.first->getType() == llvm::Type::DoubleTy);
+ NextVal = llvm::ConstantFP::get(InVal.first->getType(),
+ llvm::APFloat(static_cast<double>(AmountVal)));
+ }
// Add the inc/dec to the real part.
NextVal = Builder.CreateAdd(InVal.first, NextVal, isInc ? "inc" : "dec");
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=41926&r1=41925&r2=41926&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Thu Sep 13 01:19:18 2007
@@ -474,9 +474,16 @@
// Add the inc/dec to the real part.
if (isa<llvm::IntegerType>(InVal->getType()))
NextVal = llvm::ConstantInt::get(InVal->getType(), AmountVal);
- else
- NextVal = llvm::ConstantFP::get(InVal->getType(),
- static_cast<double>(AmountVal));
+ else if (InVal->getType() == llvm::Type::FloatTy)
+ // FIXME: Handle long double.
+ NextVal = llvm::ConstantFP::get(InVal->getType(),
+ llvm::APFloat(static_cast<float>(AmountVal)));
+ else {
+ // FIXME: Handle long double.
+ assert(InVal->getType() == llvm::Type::DoubleTy);
+ NextVal = llvm::ConstantFP::get(InVal->getType(),
+ llvm::APFloat(static_cast<double>(AmountVal)));
+ }
NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
}
More information about the cfe-commits
mailing list