/src/keystone/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- AArch64AddressingModes.h - AArch64 Addressing Modes ------*- C++ -*-===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file contains the AArch64 addressing mode implementation stuff. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64ADDRESSINGMODES_H |
15 | | #define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64ADDRESSINGMODES_H |
16 | | |
17 | | #include "llvm/ADT/APFloat.h" |
18 | | #include "llvm/ADT/APInt.h" |
19 | | #include "llvm/Support/ErrorHandling.h" |
20 | | #include "llvm/Support/MathExtras.h" |
21 | | #include <cassert> |
22 | | |
23 | | namespace llvm_ks { |
24 | | |
25 | | /// AArch64_AM - AArch64 Addressing Mode Stuff |
26 | | namespace AArch64_AM { |
27 | | |
28 | | //===----------------------------------------------------------------------===// |
29 | | // Shifts |
30 | | // |
31 | | |
32 | | enum ShiftExtendType { |
33 | | InvalidShiftExtend = -1, |
34 | | LSL = 0, |
35 | | LSR, |
36 | | ASR, |
37 | | ROR, |
38 | | MSL, |
39 | | |
40 | | UXTB, |
41 | | UXTH, |
42 | | UXTW, |
43 | | UXTX, |
44 | | |
45 | | SXTB, |
46 | | SXTH, |
47 | | SXTW, |
48 | | SXTX, |
49 | | }; |
50 | | |
51 | | /// getShiftName - Get the string encoding for the shift type. |
52 | 0 | static inline const char *getShiftExtendName(AArch64_AM::ShiftExtendType ST) { |
53 | 0 | switch (ST) { |
54 | 0 | default: llvm_unreachable("unhandled shift type!"); |
55 | 0 | case AArch64_AM::LSL: return "lsl"; |
56 | 0 | case AArch64_AM::LSR: return "lsr"; |
57 | 0 | case AArch64_AM::ASR: return "asr"; |
58 | 0 | case AArch64_AM::ROR: return "ror"; |
59 | 0 | case AArch64_AM::MSL: return "msl"; |
60 | 0 | case AArch64_AM::UXTB: return "uxtb"; |
61 | 0 | case AArch64_AM::UXTH: return "uxth"; |
62 | 0 | case AArch64_AM::UXTW: return "uxtw"; |
63 | 0 | case AArch64_AM::UXTX: return "uxtx"; |
64 | 0 | case AArch64_AM::SXTB: return "sxtb"; |
65 | 0 | case AArch64_AM::SXTH: return "sxth"; |
66 | 0 | case AArch64_AM::SXTW: return "sxtw"; |
67 | 0 | case AArch64_AM::SXTX: return "sxtx"; |
68 | 0 | } |
69 | 0 | return nullptr; |
70 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getShiftExtendName(llvm_ks::AArch64_AM::ShiftExtendType) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getShiftExtendName(llvm_ks::AArch64_AM::ShiftExtendType) |
71 | | |
72 | | /// getShiftType - Extract the shift type. |
73 | 0 | static inline AArch64_AM::ShiftExtendType getShiftType(unsigned Imm) { |
74 | 0 | switch ((Imm >> 6) & 0x7) { |
75 | 0 | default: return AArch64_AM::InvalidShiftExtend; |
76 | 0 | case 0: return AArch64_AM::LSL; |
77 | 0 | case 1: return AArch64_AM::LSR; |
78 | 0 | case 2: return AArch64_AM::ASR; |
79 | 0 | case 3: return AArch64_AM::ROR; |
80 | 0 | case 4: return AArch64_AM::MSL; |
81 | 0 | } |
82 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getShiftType(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getShiftType(unsigned int) |
83 | | |
84 | | /// getShiftValue - Extract the shift value. |
85 | 0 | static inline unsigned getShiftValue(unsigned Imm) { |
86 | 0 | return Imm & 0x3f; |
87 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getShiftValue(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getShiftValue(unsigned int) |
88 | | |
89 | | /// getShifterImm - Encode the shift type and amount: |
90 | | /// imm: 6-bit shift amount |
91 | | /// shifter: 000 ==> lsl |
92 | | /// 001 ==> lsr |
93 | | /// 010 ==> asr |
94 | | /// 011 ==> ror |
95 | | /// 100 ==> msl |
96 | | /// {8-6} = shifter |
97 | | /// {5-0} = imm |
98 | | static inline unsigned getShifterImm(AArch64_AM::ShiftExtendType ST, |
99 | 0 | unsigned Imm) { |
100 | 0 | assert((Imm & 0x3f) == Imm && "Illegal shifted immedate value!"); |
101 | 0 | unsigned STEnc = 0; |
102 | 0 | switch (ST) { |
103 | 0 | default: llvm_unreachable("Invalid shift requested"); |
104 | 0 | case AArch64_AM::LSL: STEnc = 0; break; |
105 | 0 | case AArch64_AM::LSR: STEnc = 1; break; |
106 | 0 | case AArch64_AM::ASR: STEnc = 2; break; |
107 | 0 | case AArch64_AM::ROR: STEnc = 3; break; |
108 | 0 | case AArch64_AM::MSL: STEnc = 4; break; |
109 | 0 | } |
110 | 0 | return (STEnc << 6) | (Imm & 0x3f); |
111 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getShifterImm(llvm_ks::AArch64_AM::ShiftExtendType, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getShifterImm(llvm_ks::AArch64_AM::ShiftExtendType, unsigned int) |
112 | | |
113 | | //===----------------------------------------------------------------------===// |
114 | | // Extends |
115 | | // |
116 | | |
117 | | /// getArithShiftValue - get the arithmetic shift value. |
118 | 0 | static inline unsigned getArithShiftValue(unsigned Imm) { |
119 | 0 | return Imm & 0x7; |
120 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getArithShiftValue(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getArithShiftValue(unsigned int) |
121 | | |
122 | | /// getExtendType - Extract the extend type for operands of arithmetic ops. |
123 | 0 | static inline AArch64_AM::ShiftExtendType getExtendType(unsigned Imm) { |
124 | 0 | assert((Imm & 0x7) == Imm && "invalid immediate!"); |
125 | 0 | switch (Imm) { |
126 | 0 | default: llvm_unreachable("Compiler bug!"); |
127 | 0 | case 0: return AArch64_AM::UXTB; |
128 | 0 | case 1: return AArch64_AM::UXTH; |
129 | 0 | case 2: return AArch64_AM::UXTW; |
130 | 0 | case 3: return AArch64_AM::UXTX; |
131 | 0 | case 4: return AArch64_AM::SXTB; |
132 | 0 | case 5: return AArch64_AM::SXTH; |
133 | 0 | case 6: return AArch64_AM::SXTW; |
134 | 0 | case 7: return AArch64_AM::SXTX; |
135 | 0 | } |
136 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getExtendType(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getExtendType(unsigned int) |
137 | | |
138 | 0 | static inline AArch64_AM::ShiftExtendType getArithExtendType(unsigned Imm) { |
139 | 0 | return getExtendType((Imm >> 3) & 0x7); |
140 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getArithExtendType(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getArithExtendType(unsigned int) |
141 | | |
142 | | /// Mapping from extend bits to required operation: |
143 | | /// shifter: 000 ==> uxtb |
144 | | /// 001 ==> uxth |
145 | | /// 010 ==> uxtw |
146 | | /// 011 ==> uxtx |
147 | | /// 100 ==> sxtb |
148 | | /// 101 ==> sxth |
149 | | /// 110 ==> sxtw |
150 | | /// 111 ==> sxtx |
151 | 0 | inline unsigned getExtendEncoding(AArch64_AM::ShiftExtendType ET) { |
152 | 0 | switch (ET) { |
153 | 0 | default: llvm_unreachable("Invalid extend type requested"); |
154 | 0 | case AArch64_AM::UXTB: return 0; break; |
155 | 0 | case AArch64_AM::UXTH: return 1; break; |
156 | 0 | case AArch64_AM::UXTW: return 2; break; |
157 | 0 | case AArch64_AM::UXTX: return 3; break; |
158 | 0 | case AArch64_AM::SXTB: return 4; break; |
159 | 0 | case AArch64_AM::SXTH: return 5; break; |
160 | 0 | case AArch64_AM::SXTW: return 6; break; |
161 | 0 | case AArch64_AM::SXTX: return 7; break; |
162 | 0 | } |
163 | 0 | } |
164 | | |
165 | | /// getArithExtendImm - Encode the extend type and shift amount for an |
166 | | /// arithmetic instruction: |
167 | | /// imm: 3-bit extend amount |
168 | | /// {5-3} = shifter |
169 | | /// {2-0} = imm3 |
170 | | static inline unsigned getArithExtendImm(AArch64_AM::ShiftExtendType ET, |
171 | 0 | unsigned Imm) { |
172 | 0 | assert((Imm & 0x7) == Imm && "Illegal shifted immedate value!"); |
173 | 0 | return (getExtendEncoding(ET) << 3) | (Imm & 0x7); |
174 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getArithExtendImm(llvm_ks::AArch64_AM::ShiftExtendType, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getArithExtendImm(llvm_ks::AArch64_AM::ShiftExtendType, unsigned int) |
175 | | |
176 | | /// getMemDoShift - Extract the "do shift" flag value for load/store |
177 | | /// instructions. |
178 | 0 | static inline bool getMemDoShift(unsigned Imm) { |
179 | 0 | return (Imm & 0x1) != 0; |
180 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getMemDoShift(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getMemDoShift(unsigned int) |
181 | | |
182 | | /// getExtendType - Extract the extend type for the offset operand of |
183 | | /// loads/stores. |
184 | 0 | static inline AArch64_AM::ShiftExtendType getMemExtendType(unsigned Imm) { |
185 | 0 | return getExtendType((Imm >> 1) & 0x7); |
186 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getMemExtendType(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getMemExtendType(unsigned int) |
187 | | |
188 | | /// getExtendImm - Encode the extend type and amount for a load/store inst: |
189 | | /// doshift: should the offset be scaled by the access size |
190 | | /// shifter: 000 ==> uxtb |
191 | | /// 001 ==> uxth |
192 | | /// 010 ==> uxtw |
193 | | /// 011 ==> uxtx |
194 | | /// 100 ==> sxtb |
195 | | /// 101 ==> sxth |
196 | | /// 110 ==> sxtw |
197 | | /// 111 ==> sxtx |
198 | | /// {3-1} = shifter |
199 | | /// {0} = doshift |
200 | | static inline unsigned getMemExtendImm(AArch64_AM::ShiftExtendType ET, |
201 | 0 | bool DoShift) { |
202 | 0 | return (getExtendEncoding(ET) << 1) | unsigned(DoShift); |
203 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getMemExtendImm(llvm_ks::AArch64_AM::ShiftExtendType, bool) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getMemExtendImm(llvm_ks::AArch64_AM::ShiftExtendType, bool) |
204 | | |
205 | 0 | static inline uint64_t ror(uint64_t elt, unsigned size) { |
206 | 0 | return ((elt & 1) << (size-1)) | (elt >> 1); |
207 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::ror(unsigned long, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::ror(unsigned long, unsigned int) |
208 | | |
209 | | /// processLogicalImmediate - Determine if an immediate value can be encoded |
210 | | /// as the immediate operand of a logical instruction for the given register |
211 | | /// size. If so, return true with "encoding" set to the encoded value in |
212 | | /// the form N:immr:imms. |
213 | | static inline bool processLogicalImmediate(uint64_t Imm, unsigned RegSize, |
214 | 0 | uint64_t &Encoding) { |
215 | 0 | if (Imm == 0ULL || Imm == ~0ULL || |
216 | 0 | (RegSize != 64 && (Imm >> RegSize != 0 || Imm == ~0U))) |
217 | 0 | return false; |
218 | | |
219 | | // First, determine the element size. |
220 | 0 | unsigned Size = RegSize; |
221 | |
|
222 | 0 | do { |
223 | 0 | Size /= 2; |
224 | 0 | uint64_t Mask = (1ULL << Size) - 1; |
225 | |
|
226 | 0 | if ((Imm & Mask) != ((Imm >> Size) & Mask)) { |
227 | 0 | Size *= 2; |
228 | 0 | break; |
229 | 0 | } |
230 | 0 | } while (Size > 2); |
231 | | |
232 | | // Second, determine the rotation to make the element be: 0^m 1^n. |
233 | 0 | uint32_t CTO, I; |
234 | 0 | uint64_t Mask = ((uint64_t)-1LL) >> (64 - Size); |
235 | 0 | Imm &= Mask; |
236 | |
|
237 | 0 | if (isShiftedMask_64(Imm)) { |
238 | 0 | I = countTrailingZeros(Imm); |
239 | 0 | assert(I < 64 && "undefined behavior"); |
240 | 0 | CTO = countTrailingOnes(Imm >> I); |
241 | 0 | } else { |
242 | 0 | Imm |= ~Mask; |
243 | 0 | if (!isShiftedMask_64(~Imm)) |
244 | 0 | return false; |
245 | | |
246 | 0 | unsigned CLO = countLeadingOnes(Imm); |
247 | 0 | I = 64 - CLO; |
248 | 0 | CTO = CLO + countTrailingOnes(Imm) - (64 - Size); |
249 | 0 | } |
250 | | |
251 | | // Encode in Immr the number of RORs it would take to get *from* 0^m 1^n |
252 | | // to our target value, where I is the number of RORs to go the opposite |
253 | | // direction. |
254 | 0 | assert(Size > I && "I should be smaller than element size"); |
255 | 0 | unsigned Immr = (Size - I) & (Size - 1); |
256 | | |
257 | | // If size has a 1 in the n'th bit, create a value that has zeroes in |
258 | | // bits [0, n] and ones above that. |
259 | 0 | uint64_t NImms = ~(Size-1) << 1; |
260 | | |
261 | | // Or the CTO value into the low bits, which must be below the Nth bit |
262 | | // bit mentioned above. |
263 | 0 | NImms |= (CTO-1); |
264 | | |
265 | | // Extract the seventh bit and toggle it to create the N field. |
266 | 0 | unsigned N = ((NImms >> 6) & 1) ^ 1; |
267 | |
|
268 | 0 | Encoding = (N << 12) | (Immr << 6) | (NImms & 0x3f); |
269 | 0 | return true; |
270 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::processLogicalImmediate(unsigned long, unsigned int, unsigned long&) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::processLogicalImmediate(unsigned long, unsigned int, unsigned long&) |
271 | | |
272 | | /// isLogicalImmediate - Return true if the immediate is valid for a logical |
273 | | /// immediate instruction of the given register size. Return false otherwise. |
274 | 0 | static inline bool isLogicalImmediate(uint64_t imm, unsigned regSize) { |
275 | 0 | uint64_t encoding; |
276 | 0 | return processLogicalImmediate(imm, regSize, encoding); |
277 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isLogicalImmediate(unsigned long, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isLogicalImmediate(unsigned long, unsigned int) |
278 | | |
279 | | /// encodeLogicalImmediate - Return the encoded immediate value for a logical |
280 | | /// immediate instruction of the given register size. |
281 | 0 | static inline uint64_t encodeLogicalImmediate(uint64_t imm, unsigned regSize) { |
282 | 0 | uint64_t encoding = 0; |
283 | 0 | bool res = processLogicalImmediate(imm, regSize, encoding); |
284 | 0 | assert(res && "invalid logical immediate"); |
285 | 0 | (void)res; |
286 | 0 | return encoding; |
287 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeLogicalImmediate(unsigned long, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeLogicalImmediate(unsigned long, unsigned int) |
288 | | |
289 | | /// decodeLogicalImmediate - Decode a logical immediate value in the form |
290 | | /// "N:immr:imms" (where the immr and imms fields are each 6 bits) into the |
291 | | /// integer value it represents with regSize bits. |
292 | 0 | static inline uint64_t decodeLogicalImmediate(uint64_t val, unsigned regSize) { |
293 | 0 | // Extract the N, imms, and immr fields. |
294 | 0 | unsigned N = (val >> 12) & 1; |
295 | 0 | unsigned immr = (val >> 6) & 0x3f; |
296 | 0 | unsigned imms = val & 0x3f; |
297 | 0 |
|
298 | 0 | assert((regSize == 64 || N == 0) && "undefined logical immediate encoding"); |
299 | 0 | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); |
300 | 0 | assert(len >= 0 && "undefined logical immediate encoding"); |
301 | 0 | unsigned size = (1 << len); |
302 | 0 | unsigned R = immr & (size - 1); |
303 | 0 | unsigned S = imms & (size - 1); |
304 | 0 | assert(S != size - 1 && "undefined logical immediate encoding"); |
305 | 0 | uint64_t pattern = (1ULL << (S + 1)) - 1; |
306 | 0 | for (unsigned i = 0; i < R; ++i) |
307 | 0 | pattern = ror(pattern, size); |
308 | 0 |
|
309 | 0 | // Replicate the pattern to fill the regSize. |
310 | 0 | while (size != regSize) { |
311 | 0 | pattern |= (pattern << size); |
312 | 0 | size *= 2; |
313 | 0 | } |
314 | 0 | return pattern; |
315 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeLogicalImmediate(unsigned long, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeLogicalImmediate(unsigned long, unsigned int) |
316 | | |
317 | | /// isValidDecodeLogicalImmediate - Check to see if the logical immediate value |
318 | | /// in the form "N:immr:imms" (where the immr and imms fields are each 6 bits) |
319 | | /// is a valid encoding for an integer value with regSize bits. |
320 | | static inline bool isValidDecodeLogicalImmediate(uint64_t val, |
321 | 0 | unsigned regSize) { |
322 | 0 | // Extract the N and imms fields needed for checking. |
323 | 0 | unsigned N = (val >> 12) & 1; |
324 | 0 | unsigned imms = val & 0x3f; |
325 | 0 |
|
326 | 0 | if (regSize == 32 && N != 0) // undefined logical immediate encoding |
327 | 0 | return false; |
328 | 0 | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); |
329 | 0 | if (len < 0) // undefined logical immediate encoding |
330 | 0 | return false; |
331 | 0 | unsigned size = (1 << len); |
332 | 0 | unsigned S = imms & (size - 1); |
333 | 0 | if (S == size - 1) // undefined logical immediate encoding |
334 | 0 | return false; |
335 | 0 |
|
336 | 0 | return true; |
337 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isValidDecodeLogicalImmediate(unsigned long, unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isValidDecodeLogicalImmediate(unsigned long, unsigned int) |
338 | | |
339 | | //===----------------------------------------------------------------------===// |
340 | | // Floating-point Immediates |
341 | | // |
342 | 0 | static inline float getFPImmFloat(unsigned Imm) { |
343 | | // We expect an 8-bit binary encoding of a floating-point number here. |
344 | 0 | union { |
345 | 0 | uint32_t I; |
346 | 0 | float F; |
347 | 0 | } FPUnion; |
348 | |
|
349 | 0 | uint8_t Sign = (Imm >> 7) & 0x1; |
350 | 0 | uint8_t Exp = (Imm >> 4) & 0x7; |
351 | 0 | uint8_t Mantissa = Imm & 0xf; |
352 | | |
353 | | // 8-bit FP iEEEE Float Encoding |
354 | | // abcd efgh aBbbbbbc defgh000 00000000 00000000 |
355 | | // |
356 | | // where B = NOT(b); |
357 | |
|
358 | 0 | FPUnion.I = 0; |
359 | 0 | FPUnion.I |= Sign << 31; |
360 | 0 | FPUnion.I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30; |
361 | 0 | FPUnion.I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25; |
362 | 0 | FPUnion.I |= (Exp & 0x3) << 23; |
363 | 0 | FPUnion.I |= Mantissa << 19; |
364 | 0 | return FPUnion.F; |
365 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFPImmFloat(unsigned int) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFPImmFloat(unsigned int) |
366 | | |
367 | | /// getFP16Imm - Return an 8-bit floating-point version of the 16-bit |
368 | | /// floating-point value. If the value cannot be represented as an 8-bit |
369 | | /// floating-point value, then return -1. |
370 | 0 | static inline int getFP16Imm(const APInt &Imm) { |
371 | 0 | uint32_t Sign = Imm.lshr(15).getZExtValue() & 1; |
372 | 0 | int32_t Exp = (Imm.lshr(10).getSExtValue() & 0x1f) - 15; // -14 to 15 |
373 | 0 | int32_t Mantissa = Imm.getZExtValue() & 0x3ff; // 10 bits |
374 | 0 |
|
375 | 0 | // We can handle 4 bits of mantissa. |
376 | 0 | // mantissa = (16+UInt(e:f:g:h))/16. |
377 | 0 | if (Mantissa & 0x3f) |
378 | 0 | return -1; |
379 | 0 | Mantissa >>= 6; |
380 | 0 |
|
381 | 0 | // We can handle 3 bits of exponent: exp == UInt(NOT(b):c:d)-3 |
382 | 0 | if (Exp < -3 || Exp > 4) |
383 | 0 | return -1; |
384 | 0 | Exp = ((Exp+3) & 0x7) ^ 4; |
385 | 0 |
|
386 | 0 | return ((int)Sign << 7) | (Exp << 4) | Mantissa; |
387 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFP16Imm(llvm_ks::APInt const&) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFP16Imm(llvm_ks::APInt const&) |
388 | | |
389 | 0 | static inline int getFP16Imm(const APFloat &FPImm) { |
390 | 0 | return getFP16Imm(FPImm.bitcastToAPInt()); |
391 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFP16Imm(llvm_ks::APFloat const&) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFP16Imm(llvm_ks::APFloat const&) |
392 | | |
393 | | /// getFP32Imm - Return an 8-bit floating-point version of the 32-bit |
394 | | /// floating-point value. If the value cannot be represented as an 8-bit |
395 | | /// floating-point value, then return -1. |
396 | 0 | static inline int getFP32Imm(const APInt &Imm) { |
397 | 0 | uint32_t Sign = Imm.lshr(31).getZExtValue() & 1; |
398 | 0 | int32_t Exp = (Imm.lshr(23).getSExtValue() & 0xff) - 127; // -126 to 127 |
399 | 0 | int64_t Mantissa = Imm.getZExtValue() & 0x7fffff; // 23 bits |
400 | 0 |
|
401 | 0 | // We can handle 4 bits of mantissa. |
402 | 0 | // mantissa = (16+UInt(e:f:g:h))/16. |
403 | 0 | if (Mantissa & 0x7ffff) |
404 | 0 | return -1; |
405 | 0 | Mantissa >>= 19; |
406 | 0 | if ((Mantissa & 0xf) != Mantissa) |
407 | 0 | return -1; |
408 | 0 |
|
409 | 0 | // We can handle 3 bits of exponent: exp == UInt(NOT(b):c:d)-3 |
410 | 0 | if (Exp < -3 || Exp > 4) |
411 | 0 | return -1; |
412 | 0 | Exp = ((Exp+3) & 0x7) ^ 4; |
413 | 0 |
|
414 | 0 | return ((int)Sign << 7) | (Exp << 4) | Mantissa; |
415 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFP32Imm(llvm_ks::APInt const&) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFP32Imm(llvm_ks::APInt const&) |
416 | | |
417 | 0 | static inline int getFP32Imm(const APFloat &FPImm) { |
418 | 0 | return getFP32Imm(FPImm.bitcastToAPInt()); |
419 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFP32Imm(llvm_ks::APFloat const&) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFP32Imm(llvm_ks::APFloat const&) |
420 | | |
421 | | /// getFP64Imm - Return an 8-bit floating-point version of the 64-bit |
422 | | /// floating-point value. If the value cannot be represented as an 8-bit |
423 | | /// floating-point value, then return -1. |
424 | 6 | static inline int getFP64Imm(const APInt &Imm) { |
425 | 6 | uint64_t Sign = Imm.lshr(63).getZExtValue() & 1; |
426 | 6 | int64_t Exp = (Imm.lshr(52).getSExtValue() & 0x7ff) - 1023; // -1022 to 1023 |
427 | 6 | uint64_t Mantissa = Imm.getZExtValue() & 0xfffffffffffffULL; |
428 | | |
429 | | // We can handle 4 bits of mantissa. |
430 | | // mantissa = (16+UInt(e:f:g:h))/16. |
431 | 6 | if (Mantissa & 0xffffffffffffULL) |
432 | 0 | return -1; |
433 | 6 | Mantissa >>= 48; |
434 | 6 | if ((Mantissa & 0xf) != Mantissa) |
435 | 0 | return -1; |
436 | | |
437 | | // We can handle 3 bits of exponent: exp == UInt(NOT(b):c:d)-3 |
438 | 6 | if (Exp < -3 || Exp > 4) |
439 | 1 | return -1; |
440 | 5 | Exp = ((Exp+3) & 0x7) ^ 4; |
441 | | |
442 | 5 | return ((int)Sign << 7) | (Exp << 4) | Mantissa; |
443 | 6 | } AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFP64Imm(llvm_ks::APInt const&) Line | Count | Source | 424 | 6 | static inline int getFP64Imm(const APInt &Imm) { | 425 | 6 | uint64_t Sign = Imm.lshr(63).getZExtValue() & 1; | 426 | 6 | int64_t Exp = (Imm.lshr(52).getSExtValue() & 0x7ff) - 1023; // -1022 to 1023 | 427 | 6 | uint64_t Mantissa = Imm.getZExtValue() & 0xfffffffffffffULL; | 428 | | | 429 | | // We can handle 4 bits of mantissa. | 430 | | // mantissa = (16+UInt(e:f:g:h))/16. | 431 | 6 | if (Mantissa & 0xffffffffffffULL) | 432 | 0 | return -1; | 433 | 6 | Mantissa >>= 48; | 434 | 6 | if ((Mantissa & 0xf) != Mantissa) | 435 | 0 | return -1; | 436 | | | 437 | | // We can handle 3 bits of exponent: exp == UInt(NOT(b):c:d)-3 | 438 | 6 | if (Exp < -3 || Exp > 4) | 439 | 1 | return -1; | 440 | 5 | Exp = ((Exp+3) & 0x7) ^ 4; | 441 | | | 442 | 5 | return ((int)Sign << 7) | (Exp << 4) | Mantissa; | 443 | 6 | } |
Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFP64Imm(llvm_ks::APInt const&) |
444 | | |
445 | 0 | static inline int getFP64Imm(const APFloat &FPImm) { |
446 | 0 | return getFP64Imm(FPImm.bitcastToAPInt()); |
447 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::getFP64Imm(llvm_ks::APFloat const&) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::getFP64Imm(llvm_ks::APFloat const&) |
448 | | |
449 | | //===--------------------------------------------------------------------===// |
450 | | // AdvSIMD Modified Immediates |
451 | | //===--------------------------------------------------------------------===// |
452 | | |
453 | | // 0x00 0x00 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh |
454 | 0 | static inline bool isAdvSIMDModImmType1(uint64_t Imm) { |
455 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
456 | 0 | ((Imm & 0xffffff00ffffff00ULL) == 0); |
457 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType1(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType1(unsigned long) |
458 | | |
459 | 0 | static inline uint8_t encodeAdvSIMDModImmType1(uint64_t Imm) { |
460 | 0 | return (Imm & 0xffULL); |
461 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType1(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType1(unsigned long) |
462 | | |
463 | 0 | static inline uint64_t decodeAdvSIMDModImmType1(uint8_t Imm) { |
464 | 0 | uint64_t EncVal = Imm; |
465 | 0 | return (EncVal << 32) | EncVal; |
466 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType1(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType1(unsigned char) |
467 | | |
468 | | // 0x00 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 |
469 | 0 | static inline bool isAdvSIMDModImmType2(uint64_t Imm) { |
470 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
471 | 0 | ((Imm & 0xffff00ffffff00ffULL) == 0); |
472 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType2(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType2(unsigned long) |
473 | | |
474 | 0 | static inline uint8_t encodeAdvSIMDModImmType2(uint64_t Imm) { |
475 | 0 | return (Imm & 0xff00ULL) >> 8; |
476 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType2(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType2(unsigned long) |
477 | | |
478 | 0 | static inline uint64_t decodeAdvSIMDModImmType2(uint8_t Imm) { |
479 | 0 | uint64_t EncVal = Imm; |
480 | 0 | return (EncVal << 40) | (EncVal << 8); |
481 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType2(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType2(unsigned char) |
482 | | |
483 | | // 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 0x00 |
484 | 0 | static inline bool isAdvSIMDModImmType3(uint64_t Imm) { |
485 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
486 | 0 | ((Imm & 0xff00ffffff00ffffULL) == 0); |
487 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType3(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType3(unsigned long) |
488 | | |
489 | 0 | static inline uint8_t encodeAdvSIMDModImmType3(uint64_t Imm) { |
490 | 0 | return (Imm & 0xff0000ULL) >> 16; |
491 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType3(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType3(unsigned long) |
492 | | |
493 | 0 | static inline uint64_t decodeAdvSIMDModImmType3(uint8_t Imm) { |
494 | 0 | uint64_t EncVal = Imm; |
495 | 0 | return (EncVal << 48) | (EncVal << 16); |
496 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType3(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType3(unsigned char) |
497 | | |
498 | | // abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 0x00 0x00 |
499 | 0 | static inline bool isAdvSIMDModImmType4(uint64_t Imm) { |
500 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
501 | 0 | ((Imm & 0x00ffffff00ffffffULL) == 0); |
502 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType4(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType4(unsigned long) |
503 | | |
504 | 0 | static inline uint8_t encodeAdvSIMDModImmType4(uint64_t Imm) { |
505 | 0 | return (Imm & 0xff000000ULL) >> 24; |
506 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType4(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType4(unsigned long) |
507 | | |
508 | 0 | static inline uint64_t decodeAdvSIMDModImmType4(uint8_t Imm) { |
509 | 0 | uint64_t EncVal = Imm; |
510 | 0 | return (EncVal << 56) | (EncVal << 24); |
511 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType4(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType4(unsigned char) |
512 | | |
513 | | // 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh |
514 | 0 | static inline bool isAdvSIMDModImmType5(uint64_t Imm) { |
515 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
516 | 0 | (((Imm & 0x00ff0000ULL) >> 16) == (Imm & 0x000000ffULL)) && |
517 | 0 | ((Imm & 0xff00ff00ff00ff00ULL) == 0); |
518 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType5(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType5(unsigned long) |
519 | | |
520 | 0 | static inline uint8_t encodeAdvSIMDModImmType5(uint64_t Imm) { |
521 | 0 | return (Imm & 0xffULL); |
522 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType5(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType5(unsigned long) |
523 | | |
524 | 0 | static inline uint64_t decodeAdvSIMDModImmType5(uint8_t Imm) { |
525 | 0 | uint64_t EncVal = Imm; |
526 | 0 | return (EncVal << 48) | (EncVal << 32) | (EncVal << 16) | EncVal; |
527 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType5(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType5(unsigned char) |
528 | | |
529 | | // abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 |
530 | 0 | static inline bool isAdvSIMDModImmType6(uint64_t Imm) { |
531 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
532 | 0 | (((Imm & 0xff000000ULL) >> 16) == (Imm & 0x0000ff00ULL)) && |
533 | 0 | ((Imm & 0x00ff00ff00ff00ffULL) == 0); |
534 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType6(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType6(unsigned long) |
535 | | |
536 | 0 | static inline uint8_t encodeAdvSIMDModImmType6(uint64_t Imm) { |
537 | 0 | return (Imm & 0xff00ULL) >> 8; |
538 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType6(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType6(unsigned long) |
539 | | |
540 | 0 | static inline uint64_t decodeAdvSIMDModImmType6(uint8_t Imm) { |
541 | 0 | uint64_t EncVal = Imm; |
542 | 0 | return (EncVal << 56) | (EncVal << 40) | (EncVal << 24) | (EncVal << 8); |
543 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType6(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType6(unsigned char) |
544 | | |
545 | | // 0x00 0x00 abcdefgh 0xFF 0x00 0x00 abcdefgh 0xFF |
546 | 0 | static inline bool isAdvSIMDModImmType7(uint64_t Imm) { |
547 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
548 | 0 | ((Imm & 0xffff00ffffff00ffULL) == 0x000000ff000000ffULL); |
549 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType7(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType7(unsigned long) |
550 | | |
551 | 0 | static inline uint8_t encodeAdvSIMDModImmType7(uint64_t Imm) { |
552 | 0 | return (Imm & 0xff00ULL) >> 8; |
553 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType7(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType7(unsigned long) |
554 | | |
555 | 0 | static inline uint64_t decodeAdvSIMDModImmType7(uint8_t Imm) { |
556 | 0 | uint64_t EncVal = Imm; |
557 | 0 | return (EncVal << 40) | (EncVal << 8) | 0x000000ff000000ffULL; |
558 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType7(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType7(unsigned char) |
559 | | |
560 | | // 0x00 abcdefgh 0xFF 0xFF 0x00 abcdefgh 0xFF 0xFF |
561 | 0 | static inline bool isAdvSIMDModImmType8(uint64_t Imm) { |
562 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
563 | 0 | ((Imm & 0xff00ffffff00ffffULL) == 0x0000ffff0000ffffULL); |
564 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType8(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType8(unsigned long) |
565 | | |
566 | 0 | static inline uint64_t decodeAdvSIMDModImmType8(uint8_t Imm) { |
567 | 0 | uint64_t EncVal = Imm; |
568 | 0 | return (EncVal << 48) | (EncVal << 16) | 0x0000ffff0000ffffULL; |
569 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType8(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType8(unsigned char) |
570 | | |
571 | 0 | static inline uint8_t encodeAdvSIMDModImmType8(uint64_t Imm) { |
572 | 0 | return (Imm & 0x00ff0000ULL) >> 16; |
573 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType8(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType8(unsigned long) |
574 | | |
575 | | // abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh |
576 | 0 | static inline bool isAdvSIMDModImmType9(uint64_t Imm) { |
577 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
578 | 0 | ((Imm >> 48) == (Imm & 0x0000ffffULL)) && |
579 | 0 | ((Imm >> 56) == (Imm & 0x000000ffULL)); |
580 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType9(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType9(unsigned long) |
581 | | |
582 | 0 | static inline uint8_t encodeAdvSIMDModImmType9(uint64_t Imm) { |
583 | 0 | return (Imm & 0xffULL); |
584 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType9(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType9(unsigned long) |
585 | | |
586 | 0 | static inline uint64_t decodeAdvSIMDModImmType9(uint8_t Imm) { |
587 | 0 | uint64_t EncVal = Imm; |
588 | 0 | EncVal |= (EncVal << 8); |
589 | 0 | EncVal |= (EncVal << 16); |
590 | 0 | EncVal |= (EncVal << 32); |
591 | 0 | return EncVal; |
592 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType9(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType9(unsigned char) |
593 | | |
594 | | // aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh |
595 | | // cmode: 1110, op: 1 |
596 | 0 | static inline bool isAdvSIMDModImmType10(uint64_t Imm) { |
597 | 0 | uint64_t ByteA = Imm & 0xff00000000000000ULL; |
598 | 0 | uint64_t ByteB = Imm & 0x00ff000000000000ULL; |
599 | 0 | uint64_t ByteC = Imm & 0x0000ff0000000000ULL; |
600 | 0 | uint64_t ByteD = Imm & 0x000000ff00000000ULL; |
601 | 0 | uint64_t ByteE = Imm & 0x00000000ff000000ULL; |
602 | 0 | uint64_t ByteF = Imm & 0x0000000000ff0000ULL; |
603 | 0 | uint64_t ByteG = Imm & 0x000000000000ff00ULL; |
604 | 0 | uint64_t ByteH = Imm & 0x00000000000000ffULL; |
605 | |
|
606 | 0 | return (ByteA == 0ULL || ByteA == 0xff00000000000000ULL) && |
607 | 0 | (ByteB == 0ULL || ByteB == 0x00ff000000000000ULL) && |
608 | 0 | (ByteC == 0ULL || ByteC == 0x0000ff0000000000ULL) && |
609 | 0 | (ByteD == 0ULL || ByteD == 0x000000ff00000000ULL) && |
610 | 0 | (ByteE == 0ULL || ByteE == 0x00000000ff000000ULL) && |
611 | 0 | (ByteF == 0ULL || ByteF == 0x0000000000ff0000ULL) && |
612 | 0 | (ByteG == 0ULL || ByteG == 0x000000000000ff00ULL) && |
613 | 0 | (ByteH == 0ULL || ByteH == 0x00000000000000ffULL); |
614 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType10(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType10(unsigned long) |
615 | | |
616 | 0 | static inline uint8_t encodeAdvSIMDModImmType10(uint64_t Imm) { |
617 | 0 | uint8_t BitA = (Imm & 0xff00000000000000ULL) != 0; |
618 | 0 | uint8_t BitB = (Imm & 0x00ff000000000000ULL) != 0; |
619 | 0 | uint8_t BitC = (Imm & 0x0000ff0000000000ULL) != 0; |
620 | 0 | uint8_t BitD = (Imm & 0x000000ff00000000ULL) != 0; |
621 | 0 | uint8_t BitE = (Imm & 0x00000000ff000000ULL) != 0; |
622 | 0 | uint8_t BitF = (Imm & 0x0000000000ff0000ULL) != 0; |
623 | 0 | uint8_t BitG = (Imm & 0x000000000000ff00ULL) != 0; |
624 | 0 | uint8_t BitH = (Imm & 0x00000000000000ffULL) != 0; |
625 | |
|
626 | 0 | uint8_t EncVal = BitA; |
627 | 0 | EncVal <<= 1; |
628 | 0 | EncVal |= BitB; |
629 | 0 | EncVal <<= 1; |
630 | 0 | EncVal |= BitC; |
631 | 0 | EncVal <<= 1; |
632 | 0 | EncVal |= BitD; |
633 | 0 | EncVal <<= 1; |
634 | 0 | EncVal |= BitE; |
635 | 0 | EncVal <<= 1; |
636 | 0 | EncVal |= BitF; |
637 | 0 | EncVal <<= 1; |
638 | 0 | EncVal |= BitG; |
639 | 0 | EncVal <<= 1; |
640 | 0 | EncVal |= BitH; |
641 | 0 | return EncVal; |
642 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType10(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType10(unsigned long) |
643 | | |
644 | 0 | static inline uint64_t decodeAdvSIMDModImmType10(uint8_t Imm) { |
645 | 0 | uint64_t EncVal = 0; |
646 | 0 | if (Imm & 0x80) EncVal |= 0xff00000000000000ULL; |
647 | 0 | if (Imm & 0x40) EncVal |= 0x00ff000000000000ULL; |
648 | 0 | if (Imm & 0x20) EncVal |= 0x0000ff0000000000ULL; |
649 | 0 | if (Imm & 0x10) EncVal |= 0x000000ff00000000ULL; |
650 | 0 | if (Imm & 0x08) EncVal |= 0x00000000ff000000ULL; |
651 | 0 | if (Imm & 0x04) EncVal |= 0x0000000000ff0000ULL; |
652 | 0 | if (Imm & 0x02) EncVal |= 0x000000000000ff00ULL; |
653 | 0 | if (Imm & 0x01) EncVal |= 0x00000000000000ffULL; |
654 | 0 | return EncVal; |
655 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType10(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType10(unsigned char) |
656 | | |
657 | | // aBbbbbbc defgh000 0x00 0x00 aBbbbbbc defgh000 0x00 0x00 |
658 | 0 | static inline bool isAdvSIMDModImmType11(uint64_t Imm) { |
659 | 0 | uint64_t BString = (Imm & 0x7E000000ULL) >> 25; |
660 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
661 | 0 | (BString == 0x1f || BString == 0x20) && |
662 | 0 | ((Imm & 0x0007ffff0007ffffULL) == 0); |
663 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType11(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType11(unsigned long) |
664 | | |
665 | 0 | static inline uint8_t encodeAdvSIMDModImmType11(uint64_t Imm) { |
666 | 0 | uint8_t BitA = (Imm & 0x80000000ULL) != 0; |
667 | 0 | uint8_t BitB = (Imm & 0x20000000ULL) != 0; |
668 | 0 | uint8_t BitC = (Imm & 0x01000000ULL) != 0; |
669 | 0 | uint8_t BitD = (Imm & 0x00800000ULL) != 0; |
670 | 0 | uint8_t BitE = (Imm & 0x00400000ULL) != 0; |
671 | 0 | uint8_t BitF = (Imm & 0x00200000ULL) != 0; |
672 | 0 | uint8_t BitG = (Imm & 0x00100000ULL) != 0; |
673 | 0 | uint8_t BitH = (Imm & 0x00080000ULL) != 0; |
674 | 0 |
|
675 | 0 | uint8_t EncVal = BitA; |
676 | 0 | EncVal <<= 1; |
677 | 0 | EncVal |= BitB; |
678 | 0 | EncVal <<= 1; |
679 | 0 | EncVal |= BitC; |
680 | 0 | EncVal <<= 1; |
681 | 0 | EncVal |= BitD; |
682 | 0 | EncVal <<= 1; |
683 | 0 | EncVal |= BitE; |
684 | 0 | EncVal <<= 1; |
685 | 0 | EncVal |= BitF; |
686 | 0 | EncVal <<= 1; |
687 | 0 | EncVal |= BitG; |
688 | 0 | EncVal <<= 1; |
689 | 0 | EncVal |= BitH; |
690 | 0 | return EncVal; |
691 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType11(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType11(unsigned long) |
692 | | |
693 | 0 | static inline uint64_t decodeAdvSIMDModImmType11(uint8_t Imm) { |
694 | 0 | uint64_t EncVal = 0; |
695 | 0 | if (Imm & 0x80) EncVal |= 0x80000000ULL; |
696 | 0 | if (Imm & 0x40) EncVal |= 0x3e000000ULL; |
697 | 0 | else EncVal |= 0x40000000ULL; |
698 | 0 | if (Imm & 0x20) EncVal |= 0x01000000ULL; |
699 | 0 | if (Imm & 0x10) EncVal |= 0x00800000ULL; |
700 | 0 | if (Imm & 0x08) EncVal |= 0x00400000ULL; |
701 | 0 | if (Imm & 0x04) EncVal |= 0x00200000ULL; |
702 | 0 | if (Imm & 0x02) EncVal |= 0x00100000ULL; |
703 | 0 | if (Imm & 0x01) EncVal |= 0x00080000ULL; |
704 | 0 | return (EncVal << 32) | EncVal; |
705 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType11(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType11(unsigned char) |
706 | | |
707 | | // aBbbbbbb bbcdefgh 0x00 0x00 0x00 0x00 0x00 0x00 |
708 | 0 | static inline bool isAdvSIMDModImmType12(uint64_t Imm) { |
709 | 0 | uint64_t BString = (Imm & 0x7fc0000000000000ULL) >> 54; |
710 | 0 | return ((BString == 0xff || BString == 0x100) && |
711 | 0 | ((Imm & 0x0000ffffffffffffULL) == 0)); |
712 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType12(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::isAdvSIMDModImmType12(unsigned long) |
713 | | |
714 | 0 | static inline uint8_t encodeAdvSIMDModImmType12(uint64_t Imm) { |
715 | 0 | uint8_t BitA = (Imm & 0x8000000000000000ULL) != 0; |
716 | 0 | uint8_t BitB = (Imm & 0x0040000000000000ULL) != 0; |
717 | 0 | uint8_t BitC = (Imm & 0x0020000000000000ULL) != 0; |
718 | 0 | uint8_t BitD = (Imm & 0x0010000000000000ULL) != 0; |
719 | 0 | uint8_t BitE = (Imm & 0x0008000000000000ULL) != 0; |
720 | 0 | uint8_t BitF = (Imm & 0x0004000000000000ULL) != 0; |
721 | 0 | uint8_t BitG = (Imm & 0x0002000000000000ULL) != 0; |
722 | 0 | uint8_t BitH = (Imm & 0x0001000000000000ULL) != 0; |
723 | 0 |
|
724 | 0 | uint8_t EncVal = BitA; |
725 | 0 | EncVal <<= 1; |
726 | 0 | EncVal |= BitB; |
727 | 0 | EncVal <<= 1; |
728 | 0 | EncVal |= BitC; |
729 | 0 | EncVal <<= 1; |
730 | 0 | EncVal |= BitD; |
731 | 0 | EncVal <<= 1; |
732 | 0 | EncVal |= BitE; |
733 | 0 | EncVal <<= 1; |
734 | 0 | EncVal |= BitF; |
735 | 0 | EncVal <<= 1; |
736 | 0 | EncVal |= BitG; |
737 | 0 | EncVal <<= 1; |
738 | 0 | EncVal |= BitH; |
739 | 0 | return EncVal; |
740 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType12(unsigned long) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::encodeAdvSIMDModImmType12(unsigned long) |
741 | | |
742 | 0 | static inline uint64_t decodeAdvSIMDModImmType12(uint8_t Imm) { |
743 | 0 | uint64_t EncVal = 0; |
744 | 0 | if (Imm & 0x80) EncVal |= 0x8000000000000000ULL; |
745 | 0 | if (Imm & 0x40) EncVal |= 0x3fc0000000000000ULL; |
746 | 0 | else EncVal |= 0x4000000000000000ULL; |
747 | 0 | if (Imm & 0x20) EncVal |= 0x0020000000000000ULL; |
748 | 0 | if (Imm & 0x10) EncVal |= 0x0010000000000000ULL; |
749 | 0 | if (Imm & 0x08) EncVal |= 0x0008000000000000ULL; |
750 | 0 | if (Imm & 0x04) EncVal |= 0x0004000000000000ULL; |
751 | 0 | if (Imm & 0x02) EncVal |= 0x0002000000000000ULL; |
752 | 0 | if (Imm & 0x01) EncVal |= 0x0001000000000000ULL; |
753 | 0 | return (EncVal << 32) | EncVal; |
754 | 0 | } Unexecuted instantiation: AArch64AsmParser.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType12(unsigned char) Unexecuted instantiation: AArch64MCCodeEmitter.cpp:llvm_ks::AArch64_AM::decodeAdvSIMDModImmType12(unsigned char) |
755 | | |
756 | | } // end namespace AArch64_AM |
757 | | |
758 | | } // end namespace llvm_ks |
759 | | |
760 | | #endif |