1df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//===-- PPCPredicates.h - PPC Branch Predicate Information ------*- C++ -*-===//
2df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//
3df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//                     The LLVM Compiler Infrastructure
4df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//
54ee451de366474b9c228b4e5fa573795a715216dChris Lattner// This file is distributed under the University of Illinois Open Source
64ee451de366474b9c228b4e5fa573795a715216dChris Lattner// License. See LICENSE.TXT for details.
7df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//
8df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//===----------------------------------------------------------------------===//
9df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//
10df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner// This file describes the PowerPC branch predicates.
11df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//
12df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner//===----------------------------------------------------------------------===//
13df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner
14df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner#ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
15df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner#define LLVM_TARGET_POWERPC_PPCPREDICATES_H
16df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner
17399532b25a939d8c653fd453137bb8e01dc4b8fcRafael Espindola// GCC #defines PPC on Linux but we use it as our namespace name
18399532b25a939d8c653fd453137bb8e01dc4b8fcRafael Espindola#undef PPC
19399532b25a939d8c653fd453137bb8e01dc4b8fcRafael Espindola
2053856be683113838cc112331adca3717d4a520ccSylvestre Ledru// Generated files will use "namespace PPC". To avoid symbol clash,
2153856be683113838cc112331adca3717d4a520ccSylvestre Ledru// undefine PPC here. PPC may be predefined on some hosts.
2253856be683113838cc112331adca3717d4a520ccSylvestre Ledru#undef PPC
2353856be683113838cc112331adca3717d4a520ccSylvestre Ledru
24df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattnernamespace llvm {
25df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattnernamespace PPC {
26df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner  /// Predicate - These are "(BI << 5) | BO"  for various predicates.
27df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner  enum Predicate {
282e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_LT       = (0 << 5) | 12,
292e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_LE       = (1 << 5) |  4,
302e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_EQ       = (2 << 5) | 12,
312e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_GE       = (0 << 5) |  4,
322e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_GT       = (1 << 5) | 12,
332e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_NE       = (2 << 5) |  4,
342e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_UN       = (3 << 5) | 12,
352e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_NU       = (3 << 5) |  4,
362e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_LT_MINUS = (0 << 5) | 14,
372e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_LE_MINUS = (1 << 5) |  6,
382e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_EQ_MINUS = (2 << 5) | 14,
392e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_GE_MINUS = (0 << 5) |  6,
402e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_GT_MINUS = (1 << 5) | 14,
412e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_NE_MINUS = (2 << 5) |  6,
422e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_UN_MINUS = (3 << 5) | 14,
432e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_NU_MINUS = (3 << 5) |  6,
442e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_LT_PLUS  = (0 << 5) | 15,
452e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_LE_PLUS  = (1 << 5) |  7,
462e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_EQ_PLUS  = (2 << 5) | 15,
472e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_GE_PLUS  = (0 << 5) |  7,
482e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_GT_PLUS  = (1 << 5) | 15,
492e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_NE_PLUS  = (2 << 5) |  7,
502e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_UN_PLUS  = (3 << 5) | 15,
512e8bd8950345b0857130dd0f4068222a79c103f2Ulrich Weigand    PRED_NU_PLUS  = (3 << 5) |  7
52df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner  };
53df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner
54df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner  /// Invert the specified predicate.  != -> ==, < -> >=.
55df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner  Predicate InvertPredicate(Predicate Opcode);
56abe64dc6f7363c7e6170568e382fb06d81d62f51Hal Finkel
57abe64dc6f7363c7e6170568e382fb06d81d62f51Hal Finkel  /// Assume the condition register is set by MI(a,b), return the predicate if
58abe64dc6f7363c7e6170568e382fb06d81d62f51Hal Finkel  /// we modify the instructions such that condition register is set by MI(b,a).
59abe64dc6f7363c7e6170568e382fb06d81d62f51Hal Finkel  Predicate getSwappedPredicate(Predicate Opcode);
60df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner}
61df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner}
62df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner
63df4ed6350b2a51f71c0980e86c9078f4046ea706Chris Lattner#endif
64