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 | 2d3cdd686b76b4b7815e621f2cd6e19b61c01723 (patch) | |
| tree | df566aabb33032e069ab18f3a3e6f804a1b1e0a4 /llvm/lib/VMCore | |
| parent | 8a05f661396a231908508fefd1b4bcb60bf3f490 (diff) | |
| download | bcm5719-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/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index d1290281cb1..622edde5124 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -2297,8 +2297,12 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) { if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) { // Casting from vector return DestPTy->getBitWidth() == SrcPTy->getBitWidth(); - } else { // Casting from something else - return DestPTy->getBitWidth() == SrcBits; + } else if (DestPTy->getBitWidth() == SrcBits) { + return true; // float/int -> vector + } else if (SrcTy->isX86_MMXTy()) { + return DestPTy->getBitWidth() == 64; // MMX to 64-bit vector + } else { + return false; } } else if (DestTy->isPointerTy()) { // Casting to pointer if (SrcTy->isPointerTy()) { // Casting from pointer @@ -2308,8 +2312,12 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) { } else { // Casting from something else return false; } - } else if (DestTy->isX86_MMXTy()) { - return SrcBits == 64; + } else if (DestTy->isX86_MMXTy()) { + if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) { + return SrcPTy->getBitWidth() == 64; // 64-bit vector to MMX + } else { + return false; + } } else { // Casting to something else return false; } |

