[ARM] MVE integer min and max
[llvm-core.git] / lib / Target / Lanai / LanaiCondCode.h
blob6c5bdefc83dc75951c471a203341f59e72391cbb
1 // The encoding used for conditional codes used in BR instructions
3 #ifndef LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
4 #define LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
6 #include "llvm/ADT/StringSwitch.h"
8 namespace llvm {
9 namespace LPCC {
10 enum CondCode {
11 ICC_T = 0, // true
12 ICC_F = 1, // false
13 ICC_HI = 2, // high
14 ICC_UGT = 2, // unsigned greater than
15 ICC_LS = 3, // low or same
16 ICC_ULE = 3, // unsigned less than or equal
17 ICC_CC = 4, // carry cleared
18 ICC_ULT = 4, // unsigned less than
19 ICC_CS = 5, // carry set
20 ICC_UGE = 5, // unsigned greater than or equal
21 ICC_NE = 6, // not equal
22 ICC_EQ = 7, // equal
23 ICC_VC = 8, // oVerflow cleared
24 ICC_VS = 9, // oVerflow set
25 ICC_PL = 10, // plus
26 ICC_MI = 11, // minus
27 ICC_GE = 12, // greater than or equal
28 ICC_LT = 13, // less than
29 ICC_GT = 14, // greater than
30 ICC_LE = 15, // less than or equal
31 UNKNOWN
34 inline static StringRef lanaiCondCodeToString(LPCC::CondCode CC) {
35 switch (CC) {
36 case LPCC::ICC_T:
37 return "t"; // true
38 case LPCC::ICC_F:
39 return "f"; // false
40 case LPCC::ICC_NE:
41 return "ne"; // not equal
42 case LPCC::ICC_EQ:
43 return "eq"; // equal
44 case LPCC::ICC_VC:
45 return "vc"; // oVerflow cleared
46 case LPCC::ICC_VS:
47 return "vs"; // oVerflow set
48 case LPCC::ICC_PL:
49 return "pl"; // plus
50 case LPCC::ICC_MI:
51 return "mi"; // minus
52 case LPCC::ICC_GE:
53 return "ge"; // greater than or equal
54 case LPCC::ICC_LT:
55 return "lt"; // less than
56 case LPCC::ICC_GT:
57 return "gt"; // greater than
58 case LPCC::ICC_LE:
59 return "le"; // less than or equal
60 case LPCC::ICC_UGT:
61 return "ugt"; // high | unsigned greater than
62 case LPCC::ICC_ULE:
63 return "ule"; // low or same | unsigned less or equal
64 case LPCC::ICC_ULT:
65 return "ult"; // carry cleared | unsigned less than
66 case LPCC::ICC_UGE:
67 return "uge"; // carry set | unsigned than or equal
68 default:
69 llvm_unreachable("Invalid cond code");
73 inline static CondCode suffixToLanaiCondCode(StringRef S) {
74 return StringSwitch<CondCode>(S)
75 .EndsWith("f", LPCC::ICC_F)
76 .EndsWith("hi", LPCC::ICC_HI)
77 .EndsWith("ugt", LPCC::ICC_UGT)
78 .EndsWith("ls", LPCC::ICC_LS)
79 .EndsWith("ule", LPCC::ICC_ULE)
80 .EndsWith("cc", LPCC::ICC_CC)
81 .EndsWith("ult", LPCC::ICC_ULT)
82 .EndsWith("cs", LPCC::ICC_CS)
83 .EndsWith("uge", LPCC::ICC_UGE)
84 .EndsWith("ne", LPCC::ICC_NE)
85 .EndsWith("eq", LPCC::ICC_EQ)
86 .EndsWith("vc", LPCC::ICC_VC)
87 .EndsWith("vs", LPCC::ICC_VS)
88 .EndsWith("pl", LPCC::ICC_PL)
89 .EndsWith("mi", LPCC::ICC_MI)
90 .EndsWith("ge", LPCC::ICC_GE)
91 .EndsWith("lt", LPCC::ICC_LT)
92 .EndsWith("gt", LPCC::ICC_GT)
93 .EndsWith("le", LPCC::ICC_LE)
94 .EndsWith("t", LPCC::ICC_T) // Has to be after others with suffix t
95 .Default(LPCC::UNKNOWN);
97 } // namespace LPCC
98 } // namespace llvm
100 #endif // LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H