change the canonical form of "cond ? -1 : 0" to be

"sext cond" instead of a select.  This simplifies some instcombine
code, matches the policy for zext (cond ? 1 : 0 -> zext), and allows
us to generate better code for a testcase on ppc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94339 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-24 00:09:49 +00:00
parent eb38ebf15c
commit abb992d6a3
6 changed files with 80 additions and 73 deletions

View File

@@ -423,7 +423,7 @@ m_Select(const Cond &C, const LHS &L, const RHS &R) {
}
/// m_SelectCst - This matches a select of two constants, e.g.:
/// m_SelectCst(m_Value(V), -1, 0)
/// m_SelectCst<-1, 0>(m_Value(V))
template<int64_t L, int64_t R, typename Cond>
inline SelectClass_match<Cond, constantint_ty<L>, constantint_ty<R> >
m_SelectCst(const Cond &C) {
@@ -466,6 +466,20 @@ inline CastClass_match<OpTy, Instruction::Trunc>
m_Trunc(const OpTy &Op) {
return CastClass_match<OpTy, Instruction::Trunc>(Op);
}
/// m_SExt
template<typename OpTy>
inline CastClass_match<OpTy, Instruction::SExt>
m_SExt(const OpTy &Op) {
return CastClass_match<OpTy, Instruction::SExt>(Op);
}
/// m_ZExt
template<typename OpTy>
inline CastClass_match<OpTy, Instruction::ZExt>
m_ZExt(const OpTy &Op) {
return CastClass_match<OpTy, Instruction::ZExt>(Op);
}
//===----------------------------------------------------------------------===//