summaryrefslogtreecommitdiffstats
path: root/unittests/VMCore/InstructionsTest.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-10-20 21:10:27 +0000
committerdim <dim@FreeBSD.org>2011-10-20 21:10:27 +0000
commit7b3392326c40c3c20697816acae597ba7b3144eb (patch)
tree2cbcf22585e99f8a87d12d5ff94f392c0d266819 /unittests/VMCore/InstructionsTest.cpp
parent1176aa52646fe641a4243a246aa7f960c708a274 (diff)
downloadFreeBSD-src-7b3392326c40c3c20697816acae597ba7b3144eb.zip
FreeBSD-src-7b3392326c40c3c20697816acae597ba7b3144eb.tar.gz
Vendor import of llvm release_30 branch r142614:
http://llvm.org/svn/llvm-project/llvm/branches/release_30@142614
Diffstat (limited to 'unittests/VMCore/InstructionsTest.cpp')
-rw-r--r--unittests/VMCore/InstructionsTest.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/unittests/VMCore/InstructionsTest.cpp b/unittests/VMCore/InstructionsTest.cpp
index 9624b81..f0197bb 100644
--- a/unittests/VMCore/InstructionsTest.cpp
+++ b/unittests/VMCore/InstructionsTest.cpp
@@ -26,16 +26,16 @@ TEST(InstructionsTest, ReturnInst) {
EXPECT_EQ(r0->getNumOperands(), 0U);
EXPECT_EQ(r0->op_begin(), r0->op_end());
- const IntegerType* Int1 = IntegerType::get(C, 1);
+ IntegerType* Int1 = IntegerType::get(C, 1);
Constant* One = ConstantInt::get(Int1, 1, true);
const ReturnInst* r1 = ReturnInst::Create(C, One);
- EXPECT_EQ(r1->getNumOperands(), 1U);
+ EXPECT_EQ(1U, r1->getNumOperands());
User::const_op_iterator b(r1->op_begin());
- EXPECT_NE(b, r1->op_end());
- EXPECT_EQ(*b, One);
- EXPECT_EQ(r1->getOperand(0), One);
+ EXPECT_NE(r1->op_end(), b);
+ EXPECT_EQ(One, *b);
+ EXPECT_EQ(One, r1->getOperand(0));
++b;
- EXPECT_EQ(b, r1->op_end());
+ EXPECT_EQ(r1->op_end(), b);
// clean up
delete r0;
@@ -54,17 +54,17 @@ TEST(InstructionsTest, BranchInst) {
EXPECT_TRUE(b0->isUnconditional());
EXPECT_FALSE(b0->isConditional());
- EXPECT_EQ(b0->getNumSuccessors(), 1U);
+ EXPECT_EQ(1U, b0->getNumSuccessors());
// check num operands
- EXPECT_EQ(b0->getNumOperands(), 1U);
+ EXPECT_EQ(1U, b0->getNumOperands());
EXPECT_NE(b0->op_begin(), b0->op_end());
- EXPECT_EQ(llvm::next(b0->op_begin()), b0->op_end());
+ EXPECT_EQ(b0->op_end(), llvm::next(b0->op_begin()));
- EXPECT_EQ(llvm::next(b0->op_begin()), b0->op_end());
+ EXPECT_EQ(b0->op_end(), llvm::next(b0->op_begin()));
- const IntegerType* Int1 = IntegerType::get(C, 1);
+ IntegerType* Int1 = IntegerType::get(C, 1);
Constant* One = ConstantInt::get(Int1, 1, true);
// Conditional BranchInst
@@ -72,33 +72,33 @@ TEST(InstructionsTest, BranchInst) {
EXPECT_FALSE(b1->isUnconditional());
EXPECT_TRUE(b1->isConditional());
- EXPECT_EQ(b1->getNumSuccessors(), 2U);
+ EXPECT_EQ(2U, b1->getNumSuccessors());
// check num operands
- EXPECT_EQ(b1->getNumOperands(), 3U);
+ EXPECT_EQ(3U, b1->getNumOperands());
User::const_op_iterator b(b1->op_begin());
// check COND
EXPECT_NE(b, b1->op_end());
- EXPECT_EQ(*b, One);
- EXPECT_EQ(b1->getOperand(0), One);
- EXPECT_EQ(b1->getCondition(), One);
+ EXPECT_EQ(One, *b);
+ EXPECT_EQ(One, b1->getOperand(0));
+ EXPECT_EQ(One, b1->getCondition());
++b;
// check ELSE
- EXPECT_EQ(*b, bb1);
- EXPECT_EQ(b1->getOperand(1), bb1);
- EXPECT_EQ(b1->getSuccessor(1), bb1);
+ EXPECT_EQ(bb1, *b);
+ EXPECT_EQ(bb1, b1->getOperand(1));
+ EXPECT_EQ(bb1, b1->getSuccessor(1));
++b;
// check THEN
- EXPECT_EQ(*b, bb0);
- EXPECT_EQ(b1->getOperand(2), bb0);
- EXPECT_EQ(b1->getSuccessor(0), bb0);
+ EXPECT_EQ(bb0, *b);
+ EXPECT_EQ(bb0, b1->getOperand(2));
+ EXPECT_EQ(bb0, b1->getSuccessor(0));
++b;
- EXPECT_EQ(b, b1->op_end());
+ EXPECT_EQ(b1->op_end(), b);
// clean up
delete b0;
@@ -111,11 +111,11 @@ TEST(InstructionsTest, BranchInst) {
TEST(InstructionsTest, CastInst) {
LLVMContext &C(getGlobalContext());
- const Type* Int8Ty = Type::getInt8Ty(C);
- const Type* Int64Ty = Type::getInt64Ty(C);
- const Type* V8x8Ty = VectorType::get(Int8Ty, 8);
- const Type* V8x64Ty = VectorType::get(Int64Ty, 8);
- const Type* X86MMXTy = Type::getX86_MMXTy(C);
+ Type* Int8Ty = Type::getInt8Ty(C);
+ Type* Int64Ty = Type::getInt64Ty(C);
+ Type* V8x8Ty = VectorType::get(Int8Ty, 8);
+ Type* V8x64Ty = VectorType::get(Int64Ty, 8);
+ Type* X86MMXTy = Type::getX86_MMXTy(C);
const Constant* c8 = Constant::getNullValue(V8x8Ty);
const Constant* c64 = Constant::getNullValue(V8x64Ty);
@@ -125,8 +125,8 @@ TEST(InstructionsTest, CastInst) {
EXPECT_FALSE(CastInst::isCastable(Int64Ty, X86MMXTy));
EXPECT_TRUE(CastInst::isCastable(V8x64Ty, V8x8Ty));
EXPECT_TRUE(CastInst::isCastable(V8x8Ty, V8x64Ty));
- EXPECT_EQ(CastInst::getCastOpcode(c64, true, V8x8Ty, true), CastInst::Trunc);
- EXPECT_EQ(CastInst::getCastOpcode(c8, true, V8x64Ty, true), CastInst::SExt);
+ EXPECT_EQ(CastInst::Trunc, CastInst::getCastOpcode(c64, true, V8x8Ty, true));
+ EXPECT_EQ(CastInst::SExt, CastInst::getCastOpcode(c8, true, V8x64Ty, true));
}
} // end anonymous namespace
OpenPOWER on IntegriCloud