Path: blob/main/contrib/llvm-project/llvm/lib/Target/Lanai/LanaiCondCode.h
35271 views
// The encoding used for conditional codes used in BR instructions12#ifndef LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H3#define LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H45#include "llvm/ADT/StringSwitch.h"67namespace llvm {8namespace LPCC {9enum CondCode {10ICC_T = 0, // true11ICC_F = 1, // false12ICC_HI = 2, // high13ICC_UGT = 2, // unsigned greater than14ICC_LS = 3, // low or same15ICC_ULE = 3, // unsigned less than or equal16ICC_CC = 4, // carry cleared17ICC_ULT = 4, // unsigned less than18ICC_CS = 5, // carry set19ICC_UGE = 5, // unsigned greater than or equal20ICC_NE = 6, // not equal21ICC_EQ = 7, // equal22ICC_VC = 8, // oVerflow cleared23ICC_VS = 9, // oVerflow set24ICC_PL = 10, // plus25ICC_MI = 11, // minus26ICC_GE = 12, // greater than or equal27ICC_LT = 13, // less than28ICC_GT = 14, // greater than29ICC_LE = 15, // less than or equal30UNKNOWN31};3233inline static StringRef lanaiCondCodeToString(LPCC::CondCode CC) {34switch (CC) {35case LPCC::ICC_T:36return "t"; // true37case LPCC::ICC_F:38return "f"; // false39case LPCC::ICC_NE:40return "ne"; // not equal41case LPCC::ICC_EQ:42return "eq"; // equal43case LPCC::ICC_VC:44return "vc"; // oVerflow cleared45case LPCC::ICC_VS:46return "vs"; // oVerflow set47case LPCC::ICC_PL:48return "pl"; // plus49case LPCC::ICC_MI:50return "mi"; // minus51case LPCC::ICC_GE:52return "ge"; // greater than or equal53case LPCC::ICC_LT:54return "lt"; // less than55case LPCC::ICC_GT:56return "gt"; // greater than57case LPCC::ICC_LE:58return "le"; // less than or equal59case LPCC::ICC_UGT:60return "ugt"; // high | unsigned greater than61case LPCC::ICC_ULE:62return "ule"; // low or same | unsigned less or equal63case LPCC::ICC_ULT:64return "ult"; // carry cleared | unsigned less than65case LPCC::ICC_UGE:66return "uge"; // carry set | unsigned than or equal67default:68llvm_unreachable("Invalid cond code");69}70}7172inline static CondCode suffixToLanaiCondCode(StringRef S) {73return StringSwitch<CondCode>(S)74.EndsWith("f", LPCC::ICC_F)75.EndsWith("hi", LPCC::ICC_HI)76.EndsWith("ugt", LPCC::ICC_UGT)77.EndsWith("ls", LPCC::ICC_LS)78.EndsWith("ule", LPCC::ICC_ULE)79.EndsWith("cc", LPCC::ICC_CC)80.EndsWith("ult", LPCC::ICC_ULT)81.EndsWith("cs", LPCC::ICC_CS)82.EndsWith("uge", LPCC::ICC_UGE)83.EndsWith("ne", LPCC::ICC_NE)84.EndsWith("eq", LPCC::ICC_EQ)85.EndsWith("vc", LPCC::ICC_VC)86.EndsWith("vs", LPCC::ICC_VS)87.EndsWith("pl", LPCC::ICC_PL)88.EndsWith("mi", LPCC::ICC_MI)89.EndsWith("ge", LPCC::ICC_GE)90.EndsWith("lt", LPCC::ICC_LT)91.EndsWith("gt", LPCC::ICC_GT)92.EndsWith("le", LPCC::ICC_LE)93.EndsWith("t", LPCC::ICC_T) // Has to be after others with suffix t94.Default(LPCC::UNKNOWN);95}96} // namespace LPCC97} // namespace llvm9899#endif // LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H100101102