summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/VMCore/InstructionsTest.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-04-01 03:34:54 +0000
committerDuncan Sands <baldrick@free.fr>2011-04-01 03:34:54 +0000
commit2d3cdd686b76b4b7815e621f2cd6e19b61c01723 (patch)
treedf566aabb33032e069ab18f3a3e6f804a1b1e0a4 /llvm/unittests/VMCore/InstructionsTest.cpp
parent8a05f661396a231908508fefd1b4bcb60bf3f490 (diff)
downloadbcm5719-llvm-2d3cdd686b76b4b7815e621f2cd6e19b61c01723.tar.gz
bcm5719-llvm-2d3cdd686b76b4b7815e621f2cd6e19b61c01723.zip
While testing dragonegg I noticed that isCastable and getCastOpcode
had gotten out of sync: isCastable didn't think it was possible to cast the x86_mmx type to anything, while it did think it possible to cast an i64 to x86_mmx. llvm-svn: 128705
Diffstat (limited to 'llvm/unittests/VMCore/InstructionsTest.cpp')
-rw-r--r--llvm/unittests/VMCore/InstructionsTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/unittests/VMCore/InstructionsTest.cpp b/llvm/unittests/VMCore/InstructionsTest.cpp
index 1d1127d863b..d286c73d5c6 100644
--- a/llvm/unittests/VMCore/InstructionsTest.cpp
+++ b/llvm/unittests/VMCore/InstructionsTest.cpp
@@ -107,5 +107,18 @@ TEST(InstructionsTest, BranchInst) {
delete bb1;
}
+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* X86MMXTy = Type::getX86_MMXTy(C);
+
+ EXPECT_TRUE(CastInst::isCastable(V8x8Ty, X86MMXTy));
+ EXPECT_TRUE(CastInst::isCastable(X86MMXTy, V8x8Ty));
+ EXPECT_FALSE(CastInst::isCastable(Int64Ty, X86MMXTy));
+}
+
} // end anonymous namespace
} // end namespace llvm
OpenPOWER on IntegriCloud