LLVM 19.0.0git
LanaiCondCode.h
Go to the documentation of this file.
1// The encoding used for conditional codes used in BR instructions
2
3#ifndef LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
4#define LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
5
7
8namespace llvm {
9namespace LPCC {
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
32};
33
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");
70 }
71}
72
77 .EndsWith("ugt", LPCC::ICC_UGT)
79 .EndsWith("ule", LPCC::ICC_ULE)
81 .EndsWith("ult", LPCC::ICC_ULT)
83 .EndsWith("uge", LPCC::ICC_UGE)
94 .EndsWith("t", LPCC::ICC_T) // Has to be after others with suffix t
96}
97} // namespace LPCC
98} // namespace llvm
99
100#endif // LLVM_LIB_TARGET_LANAI_LANAICONDCODE_H
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
R Default(T Value)
Definition: StringSwitch.h:182
StringSwitch & EndsWith(StringLiteral S, T Value)
Definition: StringSwitch.h:76
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static CondCode suffixToLanaiCondCode(StringRef S)
Definition: LanaiCondCode.h:73
static StringRef lanaiCondCodeToString(LPCC::CondCode CC)
Definition: LanaiCondCode.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18