All, Attached is the final patch for llvm-gcc4 to make it work with the DIV instruction changes that I just committed to LLVM. You'll need to apply this patch to your llvm-gcc4 if you update LLVM before the patch is applied to the subversion repository. It should be done in 24 hours.
Thanks, Reid.
Index: gcc/llvm-convert.cpp =================================================================== --- gcc/llvm-convert.cpp (revision 187) +++ gcc/llvm-convert.cpp (working copy) @@ -544,9 +544,18 @@ case PLUS_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Add);break; case MINUS_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Sub);break; case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Mul);break; - case TRUNC_DIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Div);break; - case EXACT_DIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Div);break; - case RDIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Div);break; + case TRUNC_DIV_EXPR: + if (TYPE_UNSIGNED(TREE_TYPE(exp))) + Result = EmitBinOp(exp, DestLoc, Instruction::UDiv); + else + Result = EmitBinOp(exp, DestLoc, Instruction::SDiv); + break; + case EXACT_DIV_EXPR: + Result = EmitBinOp(exp, DestLoc, Instruction::UDiv); + break; + case RDIV_EXPR: + Result = EmitBinOp(exp, DestLoc, Instruction::FDiv); + break; case TRUNC_MOD_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Rem);break; case BIT_AND_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::And);break; case BIT_IOR_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Or );break; @@ -2263,6 +2272,7 @@ // everything to the result type. LHS = NOOPCastToType(LHS, Ty); RHS = NOOPCastToType(RHS, Ty); + return BinaryOperator::create((Instruction::BinaryOps)Opc, LHS, RHS, "tmp", CurBB); } @@ -3584,12 +3594,12 @@ Value *Tmp4 = BinaryOperator::createMul(RHSr, RHSr, "tmp", CurBB); // c*c Value *Tmp5 = BinaryOperator::createMul(RHSi, RHSi, "tmp", CurBB); // d*d Value *Tmp6 = BinaryOperator::createAdd(Tmp4, Tmp5, "tmp", CurBB); // cc+dd - DSTr = BinaryOperator::createDiv(Tmp3, Tmp6, "tmp", CurBB); + DSTr = BinaryOperator::createFDiv(Tmp3, Tmp6, "tmp", CurBB); Value *Tmp7 = BinaryOperator::createMul(LHSi, RHSr, "tmp", CurBB); // b*c Value *Tmp8 = BinaryOperator::createMul(LHSr, RHSi, "tmp", CurBB); // a*d Value *Tmp9 = BinaryOperator::createSub(Tmp7, Tmp8, "tmp", CurBB); // bc-ad - DSTi = BinaryOperator::createDiv(Tmp9, Tmp6, "tmp", CurBB); + DSTi = BinaryOperator::createFDiv(Tmp9, Tmp6, "tmp", CurBB); break; } case EQ_EXPR: // (a+ib) == (c+id) = (a == c) & (b == d) Index: gcc/config/i386/i386.h =================================================================== --- gcc/config/i386/i386.h (revision 187) +++ gcc/config/i386/i386.h (working copy) @@ -4195,7 +4195,7 @@ } \ case IX86_BUILTIN_DIVPS: \ case IX86_BUILTIN_DIVPD: \ - RESULT = BinaryOperator::createDiv(OPS[0], OPS[1], "tmp", CURBB); \ + RESULT = BinaryOperator::createFDiv(OPS[0], OPS[1], "tmp", CURBB); \ return true; \ case IX86_BUILTIN_PAND128: \ RESULT = BinaryOperator::createAnd(OPS[0], OPS[1], "tmp", CURBB); \
_______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits