2006-11-17 22:10:59 +00:00
|
|
|
//===-- PPCPredicates.cpp - PPC Branch Predicate Information --------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-11-17 22:10:59 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the PowerPC branch predicates.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "PPCPredicates.h"
|
2009-07-11 20:10:48 +00:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2006-11-17 22:10:59 +00:00
|
|
|
#include <cassert>
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
PPC::Predicate PPC::InvertPredicate(PPC::Predicate Opcode) {
|
|
|
|
switch (Opcode) {
|
|
|
|
case PPC::PRED_EQ: return PPC::PRED_NE;
|
|
|
|
case PPC::PRED_NE: return PPC::PRED_EQ;
|
|
|
|
case PPC::PRED_LT: return PPC::PRED_GE;
|
|
|
|
case PPC::PRED_GE: return PPC::PRED_LT;
|
|
|
|
case PPC::PRED_GT: return PPC::PRED_LE;
|
|
|
|
case PPC::PRED_LE: return PPC::PRED_GT;
|
|
|
|
case PPC::PRED_NU: return PPC::PRED_UN;
|
|
|
|
case PPC::PRED_UN: return PPC::PRED_NU;
|
|
|
|
}
|
2013-06-12 20:57:32 +00:00
|
|
|
llvm_unreachable("Unknown PPC branch opcode!");
|
2006-11-17 22:10:59 +00:00
|
|
|
}
|
2013-04-20 05:16:26 +00:00
|
|
|
|
|
|
|
PPC::Predicate PPC::getSwappedPredicate(PPC::Predicate Opcode) {
|
|
|
|
switch (Opcode) {
|
|
|
|
case PPC::PRED_EQ: return PPC::PRED_EQ;
|
|
|
|
case PPC::PRED_NE: return PPC::PRED_NE;
|
|
|
|
case PPC::PRED_LT: return PPC::PRED_GT;
|
|
|
|
case PPC::PRED_GE: return PPC::PRED_LE;
|
|
|
|
case PPC::PRED_GT: return PPC::PRED_LT;
|
|
|
|
case PPC::PRED_LE: return PPC::PRED_GE;
|
|
|
|
case PPC::PRED_NU: return PPC::PRED_NU;
|
|
|
|
case PPC::PRED_UN: return PPC::PRED_UN;
|
|
|
|
}
|
2013-06-12 20:57:32 +00:00
|
|
|
llvm_unreachable("Unknown PPC branch opcode!");
|
2013-04-20 05:16:26 +00:00
|
|
|
}
|
|
|
|
|