PPCPredicates.h revision 263508
1139749Simp//===-- PPCPredicates.h - PPC Branch Predicate Information ------*- C++ -*-===//
267276Sjon//
367276Sjon//                     The LLVM Compiler Infrastructure
467276Sjon//
567276Sjon// This file is distributed under the University of Illinois Open Source
667276Sjon// License. See LICENSE.TXT for details.
767276Sjon//
867276Sjon//===----------------------------------------------------------------------===//
9140198Simp//
1067276Sjon// This file describes the PowerPC branch predicates.
11140198Simp//
12140198Simp//===----------------------------------------------------------------------===//
1367276Sjon
1467276Sjon#ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
1567276Sjon#define LLVM_TARGET_POWERPC_PPCPREDICATES_H
1667276Sjon
17140198Simp// GCC #defines PPC on Linux but we use it as our namespace name
18140198Simp#undef PPC
1967276Sjon
2067276Sjon// Generated files will use "namespace PPC". To avoid symbol clash,
2167276Sjon// undefine PPC here. PPC may be predefined on some hosts.
2267276Sjon#undef PPC
2367276Sjon
2467276Sjonnamespace llvm {
2567276Sjonnamespace PPC {
2667276Sjon  /// Predicate - These are "(BI << 5) | BO"  for various predicates.
2767276Sjon  enum Predicate {
2867276Sjon    PRED_LT       = (0 << 5) | 12,
2967276Sjon    PRED_LE       = (1 << 5) |  4,
3067276Sjon    PRED_EQ       = (2 << 5) | 12,
3167276Sjon    PRED_GE       = (0 << 5) |  4,
32141412Simp    PRED_GT       = (1 << 5) | 12,
3367276Sjon    PRED_NE       = (2 << 5) |  4,
3470715Sjon    PRED_UN       = (3 << 5) | 12,
3570715Sjon    PRED_NU       = (3 << 5) |  4,
3682375Sjon    PRED_LT_MINUS = (0 << 5) | 14,
3767276Sjon    PRED_LE_MINUS = (1 << 5) |  6,
3867276Sjon    PRED_EQ_MINUS = (2 << 5) | 14,
3982375Sjon    PRED_GE_MINUS = (0 << 5) |  6,
4082375Sjon    PRED_GT_MINUS = (1 << 5) | 14,
4182378Sjon    PRED_NE_MINUS = (2 << 5) |  6,
4282378Sjon    PRED_UN_MINUS = (3 << 5) | 14,
4382378Sjon    PRED_NU_MINUS = (3 << 5) |  6,
4482378Sjon    PRED_LT_PLUS  = (0 << 5) | 15,
45    PRED_LE_PLUS  = (1 << 5) |  7,
46    PRED_EQ_PLUS  = (2 << 5) | 15,
47    PRED_GE_PLUS  = (0 << 5) |  7,
48    PRED_GT_PLUS  = (1 << 5) | 15,
49    PRED_NE_PLUS  = (2 << 5) |  7,
50    PRED_UN_PLUS  = (3 << 5) | 15,
51    PRED_NU_PLUS  = (3 << 5) |  7
52  };
53
54  /// Invert the specified predicate.  != -> ==, < -> >=.
55  Predicate InvertPredicate(Predicate Opcode);
56
57  /// Assume the condition register is set by MI(a,b), return the predicate if
58  /// we modify the instructions such that condition register is set by MI(b,a).
59  Predicate getSwappedPredicate(Predicate Opcode);
60}
61}
62
63#endif
64