LLVM  9.0.0svn
SystemZ.h
Go to the documentation of this file.
1 //==- SystemZ.h - Top-Level Interface for SystemZ representation -*- C++ -*-==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the entry points for global functions defined in
10 // the LLVM SystemZ backend.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZ_H
15 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZ_H
16 
18 #include "llvm/Support/CodeGen.h"
19 
20 namespace llvm {
21 class SystemZTargetMachine;
22 class FunctionPass;
23 
24 namespace SystemZ {
25 // Condition-code mask values.
26 const unsigned CCMASK_0 = 1 << 3;
27 const unsigned CCMASK_1 = 1 << 2;
28 const unsigned CCMASK_2 = 1 << 1;
29 const unsigned CCMASK_3 = 1 << 0;
30 const unsigned CCMASK_ANY = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;
31 
32 // Condition-code mask assignments for integer and floating-point
33 // comparisons.
34 const unsigned CCMASK_CMP_EQ = CCMASK_0;
35 const unsigned CCMASK_CMP_LT = CCMASK_1;
36 const unsigned CCMASK_CMP_GT = CCMASK_2;
37 const unsigned CCMASK_CMP_NE = CCMASK_CMP_LT | CCMASK_CMP_GT;
38 const unsigned CCMASK_CMP_LE = CCMASK_CMP_EQ | CCMASK_CMP_LT;
39 const unsigned CCMASK_CMP_GE = CCMASK_CMP_EQ | CCMASK_CMP_GT;
40 
41 // Condition-code mask assignments for floating-point comparisons only.
42 const unsigned CCMASK_CMP_UO = CCMASK_3;
43 const unsigned CCMASK_CMP_O = CCMASK_ANY ^ CCMASK_CMP_UO;
44 
45 // All condition-code values produced by comparisons.
46 const unsigned CCMASK_ICMP = CCMASK_0 | CCMASK_1 | CCMASK_2;
47 const unsigned CCMASK_FCMP = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;
48 
49 // Condition-code mask assignments for arithmetical operations.
50 const unsigned CCMASK_ARITH_EQ = CCMASK_0;
51 const unsigned CCMASK_ARITH_LT = CCMASK_1;
52 const unsigned CCMASK_ARITH_GT = CCMASK_2;
54 const unsigned CCMASK_ARITH = CCMASK_ANY;
55 
56 // Condition-code mask assignments for logical operations.
57 const unsigned CCMASK_LOGICAL_ZERO = CCMASK_0 | CCMASK_2;
58 const unsigned CCMASK_LOGICAL_NONZERO = CCMASK_1 | CCMASK_2;
59 const unsigned CCMASK_LOGICAL_CARRY = CCMASK_2 | CCMASK_3;
60 const unsigned CCMASK_LOGICAL_NOCARRY = CCMASK_0 | CCMASK_1;
63 const unsigned CCMASK_LOGICAL = CCMASK_ANY;
64 
65 // Condition-code mask assignments for CS.
66 const unsigned CCMASK_CS_EQ = CCMASK_0;
67 const unsigned CCMASK_CS_NE = CCMASK_1;
68 const unsigned CCMASK_CS = CCMASK_0 | CCMASK_1;
69 
70 // Condition-code mask assignments for a completed SRST loop.
71 const unsigned CCMASK_SRST_FOUND = CCMASK_1;
72 const unsigned CCMASK_SRST_NOTFOUND = CCMASK_2;
73 const unsigned CCMASK_SRST = CCMASK_1 | CCMASK_2;
74 
75 // Condition-code mask assignments for TEST UNDER MASK.
76 const unsigned CCMASK_TM_ALL_0 = CCMASK_0;
79 const unsigned CCMASK_TM_ALL_1 = CCMASK_3;
80 const unsigned CCMASK_TM_SOME_0 = CCMASK_TM_ALL_1 ^ CCMASK_ANY;
81 const unsigned CCMASK_TM_SOME_1 = CCMASK_TM_ALL_0 ^ CCMASK_ANY;
82 const unsigned CCMASK_TM_MSB_0 = CCMASK_0 | CCMASK_1;
83 const unsigned CCMASK_TM_MSB_1 = CCMASK_2 | CCMASK_3;
84 const unsigned CCMASK_TM = CCMASK_ANY;
85 
86 // Condition-code mask assignments for TRANSACTION_BEGIN.
91 const unsigned CCMASK_TBEGIN = CCMASK_ANY;
92 
93 // Condition-code mask assignments for TRANSACTION_END.
94 const unsigned CCMASK_TEND_TX = CCMASK_0;
95 const unsigned CCMASK_TEND_NOTX = CCMASK_2;
96 const unsigned CCMASK_TEND = CCMASK_TEND_TX | CCMASK_TEND_NOTX;
97 
98 // Condition-code mask assignments for vector comparisons (and similar
99 // operations).
100 const unsigned CCMASK_VCMP_ALL = CCMASK_0;
101 const unsigned CCMASK_VCMP_MIXED = CCMASK_1;
102 const unsigned CCMASK_VCMP_NONE = CCMASK_3;
103 const unsigned CCMASK_VCMP = CCMASK_0 | CCMASK_1 | CCMASK_3;
104 
105 // Condition-code mask assignments for Test Data Class.
106 const unsigned CCMASK_TDC_NOMATCH = CCMASK_0;
107 const unsigned CCMASK_TDC_MATCH = CCMASK_1;
108 const unsigned CCMASK_TDC = CCMASK_TDC_NOMATCH | CCMASK_TDC_MATCH;
109 
110 // The position of the low CC bit in an IPM result.
111 const unsigned IPM_CC = 28;
112 
113 // Mask assignments for PFD.
114 const unsigned PFD_READ = 1;
115 const unsigned PFD_WRITE = 2;
116 
117 // Mask assignments for TDC
118 const unsigned TDCMASK_ZERO_PLUS = 0x800;
119 const unsigned TDCMASK_ZERO_MINUS = 0x400;
120 const unsigned TDCMASK_NORMAL_PLUS = 0x200;
121 const unsigned TDCMASK_NORMAL_MINUS = 0x100;
122 const unsigned TDCMASK_SUBNORMAL_PLUS = 0x080;
123 const unsigned TDCMASK_SUBNORMAL_MINUS = 0x040;
124 const unsigned TDCMASK_INFINITY_PLUS = 0x020;
125 const unsigned TDCMASK_INFINITY_MINUS = 0x010;
126 const unsigned TDCMASK_QNAN_PLUS = 0x008;
127 const unsigned TDCMASK_QNAN_MINUS = 0x004;
128 const unsigned TDCMASK_SNAN_PLUS = 0x002;
129 const unsigned TDCMASK_SNAN_MINUS = 0x001;
130 
131 const unsigned TDCMASK_ZERO = TDCMASK_ZERO_PLUS | TDCMASK_ZERO_MINUS;
132 const unsigned TDCMASK_POSITIVE = TDCMASK_NORMAL_PLUS |
133  TDCMASK_SUBNORMAL_PLUS |
135 const unsigned TDCMASK_NEGATIVE = TDCMASK_NORMAL_MINUS |
136  TDCMASK_SUBNORMAL_MINUS |
138 const unsigned TDCMASK_NAN = TDCMASK_QNAN_PLUS |
139  TDCMASK_QNAN_MINUS |
140  TDCMASK_SNAN_PLUS |
142 const unsigned TDCMASK_PLUS = TDCMASK_POSITIVE |
143  TDCMASK_ZERO_PLUS |
144  TDCMASK_QNAN_PLUS |
146 const unsigned TDCMASK_MINUS = TDCMASK_NEGATIVE |
147  TDCMASK_ZERO_MINUS |
148  TDCMASK_QNAN_MINUS |
150 const unsigned TDCMASK_ALL = TDCMASK_PLUS | TDCMASK_MINUS;
151 
152 // Number of bits in a vector register.
153 const unsigned VectorBits = 128;
154 
155 // Number of bytes in a vector register (and consequently the number of
156 // bytes in a general permute vector).
157 const unsigned VectorBytes = VectorBits / 8;
158 
159 // Return true if Val fits an LLILL operand.
160 static inline bool isImmLL(uint64_t Val) {
161  return (Val & ~0x000000000000ffffULL) == 0;
162 }
163 
164 // Return true if Val fits an LLILH operand.
165 static inline bool isImmLH(uint64_t Val) {
166  return (Val & ~0x00000000ffff0000ULL) == 0;
167 }
168 
169 // Return true if Val fits an LLIHL operand.
170 static inline bool isImmHL(uint64_t Val) {
171  return (Val & ~0x00000ffff00000000ULL) == 0;
172 }
173 
174 // Return true if Val fits an LLIHH operand.
175 static inline bool isImmHH(uint64_t Val) {
176  return (Val & ~0xffff000000000000ULL) == 0;
177 }
178 
179 // Return true if Val fits an LLILF operand.
180 static inline bool isImmLF(uint64_t Val) {
181  return (Val & ~0x00000000ffffffffULL) == 0;
182 }
183 
184 // Return true if Val fits an LLIHF operand.
185 static inline bool isImmHF(uint64_t Val) {
186  return (Val & ~0xffffffff00000000ULL) == 0;
187 }
188 } // end namespace SystemZ
189 
191  CodeGenOpt::Level OptLevel);
198 } // end namespace llvm
199 
200 #endif
static bool isImmHF(uint64_t Val)
Definition: SystemZ.h:185
const unsigned TDCMASK_SNAN_PLUS
Definition: SystemZ.h:128
const unsigned CCMASK_CMP_GT
Definition: SystemZ.h:36
const unsigned CCMASK_TBEGIN_TRANSIENT
Definition: SystemZ.h:89
const unsigned CCMASK_ARITH
Definition: SystemZ.h:54
const unsigned CCMASK_SRST_NOTFOUND
Definition: SystemZ.h:72
const unsigned PFD_READ
Definition: SystemZ.h:114
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const unsigned TDCMASK_ZERO
Definition: SystemZ.h:131
const unsigned CCMASK_FCMP
Definition: SystemZ.h:47
static bool isImmLF(uint64_t Val)
Definition: SystemZ.h:180
static bool isImmHH(uint64_t Val)
Definition: SystemZ.h:175
const unsigned TDCMASK_NEGATIVE
Definition: SystemZ.h:135
const unsigned CCMASK_CS_EQ
Definition: SystemZ.h:66
const unsigned CCMASK_LOGICAL_CARRY
Definition: SystemZ.h:59
const unsigned TDCMASK_POSITIVE
Definition: SystemZ.h:132
const unsigned CCMASK_ICMP
Definition: SystemZ.h:46
const unsigned PFD_WRITE
Definition: SystemZ.h:115
FunctionPass * createSystemZTDCPass()
const unsigned CCMASK_TM_MSB_0
Definition: SystemZ.h:82
FunctionPass * createSystemZISelDag(SystemZTargetMachine &TM, CodeGenOpt::Level OptLevel)
const unsigned CCMASK_2
Definition: SystemZ.h:28
const unsigned CCMASK_LOGICAL_NOCARRY
Definition: SystemZ.h:60
const unsigned CCMASK_TBEGIN
Definition: SystemZ.h:91
FunctionPass * createSystemZShortenInstPass(SystemZTargetMachine &TM)
const unsigned CCMASK_ANY
Definition: SystemZ.h:30
const unsigned VectorBits
Definition: SystemZ.h:153
const unsigned CCMASK_CS_NE
Definition: SystemZ.h:67
const unsigned CCMASK_TM_SOME_0
Definition: SystemZ.h:80
const unsigned CCMASK_CS
Definition: SystemZ.h:68
const unsigned TDCMASK_ZERO_MINUS
Definition: SystemZ.h:119
const unsigned CCMASK_TM_ALL_1
Definition: SystemZ.h:79
const unsigned CCMASK_TBEGIN_PERSISTENT
Definition: SystemZ.h:90
const unsigned CCMASK_LOGICAL
Definition: SystemZ.h:63
const unsigned CCMASK_LOGICAL_BORROW
Definition: SystemZ.h:61
const unsigned CCMASK_VCMP_NONE
Definition: SystemZ.h:102
const unsigned CCMASK_TBEGIN_INDETERMINATE
Definition: SystemZ.h:88
const unsigned TDCMASK_NORMAL_PLUS
Definition: SystemZ.h:120
const unsigned CCMASK_VCMP
Definition: SystemZ.h:103
const unsigned CCMASK_ARITH_LT
Definition: SystemZ.h:51
const unsigned CCMASK_TM
Definition: SystemZ.h:84
const unsigned CCMASK_CMP_LE
Definition: SystemZ.h:38
const unsigned TDCMASK_SNAN_MINUS
Definition: SystemZ.h:129
const unsigned TDCMASK_SUBNORMAL_MINUS
Definition: SystemZ.h:123
const unsigned CCMASK_TM_MSB_1
Definition: SystemZ.h:83
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:284
const unsigned CCMASK_CMP_LT
Definition: SystemZ.h:35
const unsigned CCMASK_3
Definition: SystemZ.h:29
const unsigned CCMASK_LOGICAL_ZERO
Definition: SystemZ.h:57
const unsigned CCMASK_LOGICAL_NONZERO
Definition: SystemZ.h:58
const unsigned CCMASK_TDC
Definition: SystemZ.h:108
const unsigned TDCMASK_NAN
Definition: SystemZ.h:138
const unsigned TDCMASK_INFINITY_PLUS
Definition: SystemZ.h:124
static bool isImmLH(uint64_t Val)
Definition: SystemZ.h:165
const unsigned CCMASK_TM_MIXED_MSB_0
Definition: SystemZ.h:77
const unsigned CCMASK_SRST_FOUND
Definition: SystemZ.h:71
FunctionPass * createSystemZExpandPseudoPass(SystemZTargetMachine &TM)
const unsigned CCMASK_ARITH_EQ
Definition: SystemZ.h:50
const unsigned TDCMASK_ALL
Definition: SystemZ.h:150
const unsigned CCMASK_CMP_EQ
Definition: SystemZ.h:34
const unsigned CCMASK_TEND_NOTX
Definition: SystemZ.h:95
const unsigned CCMASK_CMP_O
Definition: SystemZ.h:43
const unsigned CCMASK_TDC_MATCH
Definition: SystemZ.h:107
const unsigned CCMASK_CMP_NE
Definition: SystemZ.h:37
FunctionPass * createSystemZLongBranchPass(SystemZTargetMachine &TM)
const unsigned CCMASK_TM_MIXED_MSB_1
Definition: SystemZ.h:78
const unsigned CCMASK_SRST
Definition: SystemZ.h:73
const unsigned CCMASK_1
Definition: SystemZ.h:27
const unsigned VectorBytes
Definition: SystemZ.h:157
const unsigned CCMASK_0
Definition: SystemZ.h:26
const unsigned CCMASK_CMP_GE
Definition: SystemZ.h:39
const unsigned CCMASK_ARITH_GT
Definition: SystemZ.h:52
FunctionPass * createSystemZLDCleanupPass(SystemZTargetMachine &TM)
const unsigned TDCMASK_QNAN_PLUS
Definition: SystemZ.h:126
const unsigned CCMASK_TBEGIN_STARTED
Definition: SystemZ.h:87
FunctionPass * createSystemZElimComparePass(SystemZTargetMachine &TM)
const unsigned CCMASK_VCMP_ALL
Definition: SystemZ.h:100
const unsigned CCMASK_TEND_TX
Definition: SystemZ.h:94
const unsigned TDCMASK_ZERO_PLUS
Definition: SystemZ.h:118
const unsigned TDCMASK_INFINITY_MINUS
Definition: SystemZ.h:125
const unsigned CCMASK_ARITH_OVERFLOW
Definition: SystemZ.h:53
static bool isImmLL(uint64_t Val)
Definition: SystemZ.h:160
const unsigned TDCMASK_NORMAL_MINUS
Definition: SystemZ.h:121
const unsigned CCMASK_TDC_NOMATCH
Definition: SystemZ.h:106
const unsigned IPM_CC
Definition: SystemZ.h:111
const unsigned CCMASK_TM_ALL_0
Definition: SystemZ.h:76
const unsigned CCMASK_TEND
Definition: SystemZ.h:96
const unsigned TDCMASK_PLUS
Definition: SystemZ.h:142
const unsigned CCMASK_VCMP_MIXED
Definition: SystemZ.h:101
const unsigned TDCMASK_MINUS
Definition: SystemZ.h:146
const unsigned CCMASK_TM_SOME_1
Definition: SystemZ.h:81
const unsigned TDCMASK_QNAN_MINUS
Definition: SystemZ.h:127
const unsigned TDCMASK_SUBNORMAL_PLUS
Definition: SystemZ.h:122
const unsigned CCMASK_LOGICAL_NOBORROW
Definition: SystemZ.h:62
const unsigned CCMASK_CMP_UO
Definition: SystemZ.h:42
static bool isImmHL(uint64_t Val)
Definition: SystemZ.h:170