diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-09-25 19:57:20 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-09-25 19:57:20 +0000 |
commit | 442ffc346f942329bebdccdf54741713646e20ef (patch) | |
tree | d1eac3b55b9aca8a05cb2a88443056f082350dea /unittests/Transforms | |
parent | fe4a778f6ef18a4be78b029b1714ddd5901ca72d (diff) |
Revert r164614 to appease the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164627 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Transforms')
-rw-r--r-- | unittests/Transforms/Utils/IntegerDivision.cpp | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/unittests/Transforms/Utils/IntegerDivision.cpp b/unittests/Transforms/Utils/IntegerDivision.cpp index ff90e6b857..a026b343d2 100644 --- a/unittests/Transforms/Utils/IntegerDivision.cpp +++ b/unittests/Transforms/Utils/IntegerDivision.cpp @@ -51,101 +51,4 @@ TEST(IntegerDivision, SDiv) { Builder.SetInsertPoint(BB->end()); } -TEST(IntegerDivision, UDiv) { - LLVMContext &C(getGlobalContext()); - Module M("test division", C); - IRBuilder<> Builder(C); - - SmallVector<Type*, 2> ArgTys(2, Builder.getInt32Ty()); - Function *F = Function::Create(FunctionType::get(Builder.getInt32Ty(), - ArgTys, false), - GlobalValue::ExternalLinkage, "F", &M); - assert(F->getArgumentList().size() == 2); - - BasicBlock *BB = BasicBlock::Create(C, "", F); - Builder.SetInsertPoint(BB); - - Function::arg_iterator AI = F->arg_begin(); - Value *A = AI++; - Value *B = AI++; - - Value *Div = Builder.CreateUDiv(A, B); - EXPECT_TRUE(BB->front().getOpcode() == Instruction::UDiv); - - Value *Ret = Builder.CreateRet(Div); - - expandDivision(cast<BinaryOperator>(Div)); - EXPECT_TRUE(BB->front().getOpcode() == Instruction::ICmp); - - Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0)); - EXPECT_TRUE(Quotient && Quotient->getOpcode() == Instruction::PHI); - - Builder.SetInsertPoint(BB->end()); -} - - -TEST(IntegerDivision, SRem) { - LLVMContext &C(getGlobalContext()); - Module M("test remainder", C); - IRBuilder<> Builder(C); - - SmallVector<Type*, 2> ArgTys(2, Builder.getInt32Ty()); - Function *F = Function::Create(FunctionType::get(Builder.getInt32Ty(), - ArgTys, false), - GlobalValue::ExternalLinkage, "F", &M); - assert(F->getArgumentList().size() == 2); - - BasicBlock *BB = BasicBlock::Create(C, "", F); - Builder.SetInsertPoint(BB); - - Function::arg_iterator AI = F->arg_begin(); - Value *A = AI++; - Value *B = AI++; - - Value *Rem = Builder.CreateSRem(A, B); - EXPECT_TRUE(BB->front().getOpcode() == Instruction::SRem); - - Value *Ret = Builder.CreateRet(Rem); - - expandRemainder(cast<BinaryOperator>(Rem)); - EXPECT_TRUE(BB->front().getOpcode() == Instruction::AShr); - - Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0)); - EXPECT_TRUE(Remainder && Remainder->getOpcode() == Instruction::Sub); - - Builder.SetInsertPoint(BB->end()); -} - -TEST(IntegerDivision, URem) { - LLVMContext &C(getGlobalContext()); - Module M("test remainder", C); - IRBuilder<> Builder(C); - - SmallVector<Type*, 2> ArgTys(2, Builder.getInt32Ty()); - Function *F = Function::Create(FunctionType::get(Builder.getInt32Ty(), - ArgTys, false), - GlobalValue::ExternalLinkage, "F", &M); - assert(F->getArgumentList().size() == 2); - - BasicBlock *BB = BasicBlock::Create(C, "", F); - Builder.SetInsertPoint(BB); - - Function::arg_iterator AI = F->arg_begin(); - Value *A = AI++; - Value *B = AI++; - - Value *Rem = Builder.CreateURem(A, B); - EXPECT_TRUE(BB->front().getOpcode() == Instruction::URem); - - Value *Ret = Builder.CreateRet(Rem); - - expandRemainder(cast<BinaryOperator>(Rem)); - EXPECT_TRUE(BB->front().getOpcode() == Instruction::ICmp); - - Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0)); - EXPECT_TRUE(Remainder && Remainder->getOpcode() == Instruction::Sub); - - Builder.SetInsertPoint(BB->end()); -} - } |