diff options
author | Derek Schuff <dschuff@chromium.org> | 2012-11-14 16:47:45 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2012-11-15 10:12:39 -0800 |
commit | 923f52fb3f6670e843ffe0b8da2f2bad898d752c (patch) | |
tree | a279587ac525162817217dbbe0f01a91893a9d0b /lib/Target/TargetTransformImpl.cpp | |
parent | f4099a3c92570a80cd9a3850cda598c5ea446b96 (diff) | |
parent | 08e9cb46feb0c8e08e3d309a0f9fd75a04ca54fb (diff) |
Merge commit '08e9cb46feb0c8e08e3d309a0f9fd75a04ca54fb'
(svn r167699, also the 3.2 branch point)
Conflicts:
lib/Target/X86/X86Subtarget.cpp
Diffstat (limited to 'lib/Target/TargetTransformImpl.cpp')
-rw-r--r-- | lib/Target/TargetTransformImpl.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/TargetTransformImpl.cpp b/lib/Target/TargetTransformImpl.cpp index c07332de32..b36e6f858f 100644 --- a/lib/Target/TargetTransformImpl.cpp +++ b/lib/Target/TargetTransformImpl.cpp @@ -214,8 +214,16 @@ unsigned VectorTargetTransformImpl::getCastInstrCost(unsigned Opcode, Type *Dst, // Handle scalar conversions. if (!Src->isVectorTy() && !Dst->isVectorTy()) { - // Scalar bitcasts and truncs are usually free. - if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc) + // Scalar bitcasts are usually free. + if (Opcode == Instruction::BitCast) + return 0; + + if (Opcode == Instruction::Trunc && + TLI->isTruncateFree(SrcLT.second, DstLT.second)) + return 0; + + if (Opcode == Instruction::ZExt && + TLI->isZExtFree(SrcLT.second, DstLT.second)) return 0; // Just check the op cost. If the operation is legal then assume it costs 1. |