diff options
author | Duncan Sands <baldrick@free.fr> | 2011-04-01 03:34:54 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-04-01 03:34:54 +0000 |
commit | 607946533d4eb781713b363605c4a241503dbe0e (patch) | |
tree | de13d8bf26bcf858154d4ef7bbc09194eec732f0 /unittests | |
parent | 234823297e0fc0babddd2ab84054bf68f64a54d1 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128705 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/VMCore/InstructionsTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/VMCore/InstructionsTest.cpp b/unittests/VMCore/InstructionsTest.cpp index 1d1127d863b..d286c73d5c6 100644 --- a/unittests/VMCore/InstructionsTest.cpp +++ b/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 |