[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp
Reid Spencer
rspencer at reidspencer.com
Wed May 2 21:06:57 PDT 2007
Leo,
Looks like Chris didn't wait very long before reverting the CBE patch. Please try your patch again. It *must* pass all of llvm/test and llvm-test to be accepted.
Thanks,
Reid.
On Wed, 2 May 2007 21:57:31 -0500
Chris Lattner <sabre at nondot.org> wrote:
>
>
>Changes in directory llvm/lib/Target/CBackend:
>
>CBackend.cpp updated: 1.342 -> 1.343
>---
>Log message:
>
>revert reid's patch to fix these failures:
>test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll for PR1099: http://llvm.org/PR1099 [DEJAGNU]
>Applications/SPASS/SPASS [CBE]
>Regression/C/2004-03-15-IndirectGoto [CBE]
>
>
>
>---
>Diffs of the changes: (+28 -100)
>
> CBackend.cpp | 128 ++++++++++++-----------------------------------------------
> 1 files changed, 28 insertions(+), 100 deletions(-)
>
>
>Index: llvm/lib/Target/CBackend/CBackend.cpp
>diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.342 llvm/lib/Target/CBackend/CBackend.cpp:1.343
>--- llvm/lib/Target/CBackend/CBackend.cpp:1.342 Wed May 2 20:11:53 2007
>+++ llvm/lib/Target/CBackend/CBackend.cpp Wed May 2 21:57:13 2007
>@@ -412,29 +412,6 @@
> }
> }
>
>-#define IMPL_SIGN_EXTENSION(OpTy, Func) { \
>- const IntegerType* IntTy = cast<IntegerType>(OpTy); \
>- unsigned BitWidth = IntTy->getBitWidth(); \
>- if (BitWidth != 8 && BitWidth != 16 && BitWidth != 32 && \
>- BitWidth != 64 && BitWidth != 128) { \
>- const char * Suffix; \
>- if (BitWidth <=32)\
>- Suffix = "U"; \
>- else \
>- Suffix = "ULL"; \
>- Out << "("; \
>- Func; \
>- Out << " & (1" << Suffix << " << " << BitWidth - 1 << " ) ? "; \
>- Func; \
>- Out << " | " << (~IntTy->getBitMask()) << Suffix << " : "; \
>- Func; \
>- Out << " & " << IntTy->getBitMask() << Suffix; \
>- Out << ")";\
>- } \
>- else \
>- Func; \
>- }
>-
> // Pass the Type* and the variable name and this prints out the variable
> // declaration.
> //
>@@ -734,39 +711,23 @@
> case Instruction::BitCast:
> Out << "(";
> printCast(CE->getOpcode(), CE->getOperand(0)->getType(), CE->getType());
>- if (CE->getOpcode() == Instruction::Trunc ||
>- CE->getOpcode() == Instruction::FPToUI ||
>- CE->getOpcode() == Instruction::FPToSI ||
>- CE->getOpcode() == Instruction::PtrToInt) {
>- if (const IntegerType* IntTy = dyn_cast<IntegerType>(CE->getType())) {
>- uint64_t BitMask = IntTy->getBitMask();
>- printConstant(CE->getOperand(0));
>- Out << "&" << BitMask << (IntTy->getBitWidth() <=32 ? "U": "ULL");
>- }
>- }
>- else if (CE->getOpcode() == Instruction::SExt &&
>- CE->getOperand(0)->getType() == Type::Int1Ty) {
>+ if (CE->getOpcode() == Instruction::SExt &&
>+ CE->getOperand(0)->getType() == Type::Int1Ty) {
> // Make sure we really sext from bool here by subtracting from 0
> Out << "0-";
>- printConstant(CE->getOperand(0));
> }
>- else if (CE->getOpcode() == Instruction::SExt &&
>- CE->getOperand(0)->getType()->getTypeID() == Type::IntegerTyID) {
>- IMPL_SIGN_EXTENSION(CE->getOperand(0)->getType(),
>- printConstant(CE->getOperand(0)));
>- }
>- else if (CE->getOpcode() == Instruction::ZExt &&
>- CE->getOperand(0)->getType()->getTypeID() == Type::IntegerTyID){
>- const IntegerType* IntTy =
>- cast<IntegerType>(CE->getOperand(0)->getType());
>- uint64_t BitMask = IntTy->getBitMask();
>- writeOperand(CE->getOperand(0));
>- Out << "&" << BitMask << (IntTy->getBitWidth() <=32 ? "U": "ULL");
>- }
>- else
>- printConstant(CE->getOperand(0));
>- Out << ")";
>+ printConstant(CE->getOperand(0));
>+ if (CE->getType() == Type::Int1Ty &&
>+ (CE->getOpcode() == Instruction::Trunc ||
>+ CE->getOpcode() == Instruction::FPToUI ||
>+ CE->getOpcode() == Instruction::FPToSI ||
>+ CE->getOpcode() == Instruction::PtrToInt)) {
>+ // Make sure we really truncate to bool here by anding with 1
>+ Out << "&1u";
>+ }
>+ Out << ')';
> return;
>+
> case Instruction::GetElementPtr:
> Out << "(&(";
> printIndexingExpression(CE->getOperand(0), gep_type_begin(CPV),
>@@ -1267,11 +1228,7 @@
> Out << "((";
> printSimpleType(Out, OpTy, castIsSigned);
> Out << ")";
>- if (castIsSigned && OpTy->getTypeID() == Type::IntegerTyID) {
>- IMPL_SIGN_EXTENSION(OpTy, writeOperand(Operand));
>- }
>- else
>- writeOperand(Operand);
>+ writeOperand(Operand);
> Out << ")";
> } else
> writeOperand(Operand);
>@@ -1296,9 +1253,7 @@
> switch (predicate) {
> default:
> // for eq and ne, it doesn't matter
>- break;
>- case ICmpInst::ICMP_EQ:
>- case ICmpInst::ICMP_NE:
>+ break;
> case ICmpInst::ICMP_UGT:
> case ICmpInst::ICMP_UGE:
> case ICmpInst::ICMP_ULT:
>@@ -1323,25 +1278,10 @@
> else
> printType(Out, OpTy); // not integer, sign doesn't matter
> Out << ")";
>- if(castIsSigned && OpTy->getTypeID() == Type::IntegerTyID) {
>- IMPL_SIGN_EXTENSION(OpTy, writeOperand(Operand));
>- } else {
>- writeOperand(Operand);
>- if(OpTy->getTypeID() == Type::IntegerTyID){
>- const IntegerType * IntTy = cast<IntegerType>(OpTy);
>- uint64_t BitMask = IntTy->getBitMask();
>- Out << "&" << BitMask << (IntTy->getBitWidth() <=32 ? "U": "ULL");
>- }
>- }
>+ writeOperand(Operand);
> Out << ")";
>- } else {
>+ } else
> writeOperand(Operand);
>- if(OpTy->getTypeID() == Type::IntegerTyID){
>- const IntegerType * IntTy = cast<IntegerType>(OpTy);
>- uint64_t BitMask = IntTy->getBitMask();
>- Out << "&" << BitMask << (IntTy->getBitWidth() <=32 ? "U": "ULL");
>- }
>- }
> }
>
> // generateCompilerSpecificCode - This is where we add conditional compilation
>@@ -2406,33 +2346,21 @@
> << getFloatBitCastField(I.getType());
> } else {
> printCast(I.getOpcode(), SrcTy, DstTy);
>- if (I.getOpcode() == Instruction::Trunc ||
>- I.getOpcode() == Instruction::FPToUI ||
>- I.getOpcode() == Instruction::FPToSI ||
>- I.getOpcode() == Instruction::PtrToInt) {
>- if (const IntegerType* IntTy = dyn_cast<IntegerType>(DstTy)){
>- uint64_t BitMask = IntTy->getBitMask();
>- writeOperand(I.getOperand(0));
>- Out << "&" << BitMask << (IntTy->getBitWidth() <=32 ? "U": "ULL");
>- }
>- } else if (I.getOpcode() == Instruction::SExt && SrcTy == Type::Int1Ty) {
>+ if (I.getOpcode() == Instruction::SExt && SrcTy == Type::Int1Ty) {
> // Make sure we really get a sext from bool by subtracing the bool from 0
> Out << "0-";
>- writeOperand(I.getOperand(0));
>- } else if (I.getOpcode() == Instruction::SExt &&
>- SrcTy->getTypeID() == Type::IntegerTyID) {
>- IMPL_SIGN_EXTENSION(SrcTy, writeOperand(I.getOperand(0)) );
>- } else if (I.getOpcode() == Instruction::ZExt &&
>- SrcTy->getTypeID() == Type::IntegerTyID) {
>- const IntegerType* IntTy = cast<IntegerType>(SrcTy);
>- uint64_t BitMask = IntTy->getBitMask();
>- writeOperand(I.getOperand(0));
>- Out << "&" << BitMask << (IntTy->getBitWidth() <=32 ? "U": "ULL");
> }
>- else
>- writeOperand(I.getOperand(0));
>+ writeOperand(I.getOperand(0));
>+ if (DstTy == Type::Int1Ty &&
>+ (I.getOpcode() == Instruction::Trunc ||
>+ I.getOpcode() == Instruction::FPToUI ||
>+ I.getOpcode() == Instruction::FPToSI ||
>+ I.getOpcode() == Instruction::PtrToInt)) {
>+ // Make sure we really get a trunc to bool by anding the operand with 1
>+ Out << "&1u";
>+ }
> }
>- Out << ")";
>+ Out << ')';
> }
>
> void CWriter::visitSelectInst(SelectInst &I) {
>
>
>
>_______________________________________________
>llvm-commits mailing list
>llvm-commits at cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list