VE.h
3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//===-- VE.h - Top-level interface for VE representation --------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains the entry points for global functions defined in the LLVM
// VE back-end.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_VE_VE_H
#define LLVM_LIB_TARGET_VE_VE_H
#include "MCTargetDesc/VEMCTargetDesc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetMachine.h"
namespace llvm {
class FunctionPass;
class VETargetMachine;
class formatted_raw_ostream;
class AsmPrinter;
class MCInst;
class MachineInstr;
FunctionPass *createVEISelDag(VETargetMachine &TM);
FunctionPass *createVEPromoteToI1Pass();
void LowerVEMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
AsmPrinter &AP);
} // namespace llvm
namespace llvm {
// Enums corresponding to VE condition codes, both icc's and fcc's. These
// values must be kept in sync with the ones in the .td file.
namespace VECC {
enum CondCodes {
// Integer comparison
CC_IG = 0, // Greater
CC_IL = 1, // Less
CC_INE = 2, // Not Equal
CC_IEQ = 3, // Equal
CC_IGE = 4, // Greater or Equal
CC_ILE = 5, // Less or Equal
// Floating point comparison
CC_AF = 0 + 6, // Never
CC_G = 1 + 6, // Greater
CC_L = 2 + 6, // Less
CC_NE = 3 + 6, // Not Equal
CC_EQ = 4 + 6, // Equal
CC_GE = 5 + 6, // Greater or Equal
CC_LE = 6 + 6, // Less or Equal
CC_NUM = 7 + 6, // Number
CC_NAN = 8 + 6, // NaN
CC_GNAN = 9 + 6, // Greater or NaN
CC_LNAN = 10 + 6, // Less or NaN
CC_NENAN = 11 + 6, // Not Equal or NaN
CC_EQNAN = 12 + 6, // Equal or NaN
CC_GENAN = 13 + 6, // Greater or Equal or NaN
CC_LENAN = 14 + 6, // Less or Equal or NaN
CC_AT = 15 + 6, // Always
};
}
inline static const char *VECondCodeToString(VECC::CondCodes CC) {
switch (CC) {
case VECC::CC_IG: return "gt";
case VECC::CC_IL: return "lt";
case VECC::CC_INE: return "ne";
case VECC::CC_IEQ: return "eq";
case VECC::CC_IGE: return "ge";
case VECC::CC_ILE: return "le";
case VECC::CC_AF: return "af";
case VECC::CC_G: return "gt";
case VECC::CC_L: return "lt";
case VECC::CC_NE: return "ne";
case VECC::CC_EQ: return "eq";
case VECC::CC_GE: return "ge";
case VECC::CC_LE: return "le";
case VECC::CC_NUM: return "num";
case VECC::CC_NAN: return "nan";
case VECC::CC_GNAN: return "gtnan";
case VECC::CC_LNAN: return "ltnan";
case VECC::CC_NENAN: return "nenan";
case VECC::CC_EQNAN: return "eqnan";
case VECC::CC_GENAN: return "genan";
case VECC::CC_LENAN: return "lenan";
case VECC::CC_AT: return "at";
}
llvm_unreachable("Invalid cond code");
}
// Different to Hi_32/Lo_32 the HI32 and LO32 functions
// preserve the correct numerical value
// on the LLVM data type for MC immediates (int64_t).
inline static int64_t HI32(int64_t imm) {
return (int32_t)(imm >> 32);
}
inline static int64_t LO32(int64_t imm) {
return (int32_t)(imm);
}
} // namespace llvm
#endif