/src/capstonenext/arch/AArch64/AArch64AddressingModes.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* Capstone Disassembly Engine, http://www.capstone-engine.org */ |
2 | | /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */ |
3 | | /* Rot127 <unisono@quyllur.org> 2022-2023 */ |
4 | | /* Automatically translated source file from LLVM. */ |
5 | | |
6 | | /* LLVM-commit: 464bda7750a3ba9e23823fc707d7e7b6fc38438d */ |
7 | | /* LLVM-tag: llvmorg-16.0.2-5-g464bda7750a3 */ |
8 | | |
9 | | /* Only small edits allowed. */ |
10 | | /* For multiple similar edits, please create a Patch for the translator. */ |
11 | | |
12 | | /* Capstone's C++ file translator: */ |
13 | | /* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */ |
14 | | |
15 | | //===- AArch64AddressingModes.h - AArch64 Addressing Modes ------*- C++ -*-===// |
16 | | // |
17 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
18 | | // See https://llvm.org/LICENSE.txt for license information. |
19 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
20 | | // |
21 | | //===----------------------------------------------------------------------===// |
22 | | // |
23 | | // This file contains the AArch64 addressing mode implementation stuff. |
24 | | // |
25 | | //===----------------------------------------------------------------------===// |
26 | | |
27 | | #ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64ADDRESSINGMODES_H |
28 | | #define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64ADDRESSINGMODES_H |
29 | | |
30 | | #include <capstone/platform.h> |
31 | | #include <stdio.h> |
32 | | #include <stdlib.h> |
33 | | #include <string.h> |
34 | | |
35 | | #include "../../MathExtras.h" |
36 | | #include <assert.h> |
37 | | |
38 | 14.3k | #define CONCAT(a, b) CONCAT_(a, b) |
39 | 14.3k | #define CONCAT_(a, b) a##_##b |
40 | | |
41 | | /// AArch64_AM - AArch64 Addressing Mode Stuff |
42 | | //===----------------------------------------------------------------------===// |
43 | | // Shifts |
44 | | // |
45 | | typedef enum { |
46 | | AArch64_AM_InvalidShiftExtend = -1, |
47 | | AArch64_AM_LSL = 0, |
48 | | AArch64_AM_LSR, |
49 | | AArch64_AM_ASR, |
50 | | AArch64_AM_ROR, |
51 | | AArch64_AM_MSL, |
52 | | |
53 | | AArch64_AM_UXTB, |
54 | | AArch64_AM_UXTH, |
55 | | AArch64_AM_UXTW, |
56 | | AArch64_AM_UXTX, |
57 | | |
58 | | AArch64_AM_SXTB, |
59 | | AArch64_AM_SXTH, |
60 | | AArch64_AM_SXTW, |
61 | | AArch64_AM_SXTX, |
62 | | } AArch64_AM_ShiftExtendType ; |
63 | | |
64 | | /// getShiftName - Get the string encoding for the shift type. |
65 | | static inline const char * |
66 | | AArch64_AM_getShiftExtendName(AArch64_AM_ShiftExtendType ST) |
67 | 9.82k | { |
68 | 9.82k | switch (ST) { |
69 | 0 | default: |
70 | 0 | assert(0 && "unhandled shift type!"); |
71 | 5.02k | case AArch64_AM_LSL: |
72 | 5.02k | return "lsl"; |
73 | 1.35k | case AArch64_AM_LSR: |
74 | 1.35k | return "lsr"; |
75 | 1.09k | case AArch64_AM_ASR: |
76 | 1.09k | return "asr"; |
77 | 576 | case AArch64_AM_ROR: |
78 | 576 | return "ror"; |
79 | 63 | case AArch64_AM_MSL: |
80 | 63 | return "msl"; |
81 | 129 | case AArch64_AM_UXTB: |
82 | 129 | return "uxtb"; |
83 | 418 | case AArch64_AM_UXTH: |
84 | 418 | return "uxth"; |
85 | 299 | case AArch64_AM_UXTW: |
86 | 299 | return "uxtw"; |
87 | 271 | case AArch64_AM_UXTX: |
88 | 271 | return "uxtx"; |
89 | 178 | case AArch64_AM_SXTB: |
90 | 178 | return "sxtb"; |
91 | 191 | case AArch64_AM_SXTH: |
92 | 191 | return "sxth"; |
93 | 26 | case AArch64_AM_SXTW: |
94 | 26 | return "sxtw"; |
95 | 203 | case AArch64_AM_SXTX: |
96 | 203 | return "sxtx"; |
97 | 9.82k | } |
98 | 0 | return NULL; |
99 | 9.82k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getShiftExtendName Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getShiftExtendName Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getShiftExtendName AArch64InstPrinter.c:AArch64_AM_getShiftExtendName Line | Count | Source | 67 | 9.82k | { | 68 | 9.82k | switch (ST) { | 69 | 0 | default: | 70 | 0 | assert(0 && "unhandled shift type!"); | 71 | 5.02k | case AArch64_AM_LSL: | 72 | 5.02k | return "lsl"; | 73 | 1.35k | case AArch64_AM_LSR: | 74 | 1.35k | return "lsr"; | 75 | 1.09k | case AArch64_AM_ASR: | 76 | 1.09k | return "asr"; | 77 | 576 | case AArch64_AM_ROR: | 78 | 576 | return "ror"; | 79 | 63 | case AArch64_AM_MSL: | 80 | 63 | return "msl"; | 81 | 129 | case AArch64_AM_UXTB: | 82 | 129 | return "uxtb"; | 83 | 418 | case AArch64_AM_UXTH: | 84 | 418 | return "uxth"; | 85 | 299 | case AArch64_AM_UXTW: | 86 | 299 | return "uxtw"; | 87 | 271 | case AArch64_AM_UXTX: | 88 | 271 | return "uxtx"; | 89 | 178 | case AArch64_AM_SXTB: | 90 | 178 | return "sxtb"; | 91 | 191 | case AArch64_AM_SXTH: | 92 | 191 | return "sxth"; | 93 | 26 | case AArch64_AM_SXTW: | 94 | 26 | return "sxtw"; | 95 | 203 | case AArch64_AM_SXTX: | 96 | 203 | return "sxtx"; | 97 | 9.82k | } | 98 | 0 | return NULL; | 99 | 9.82k | } |
|
100 | | |
101 | | /// getShiftType - Extract the shift type. |
102 | | static inline AArch64_AM_ShiftExtendType AArch64_AM_getShiftType(unsigned Imm) |
103 | 25.1k | { |
104 | 25.1k | switch ((Imm >> 6) & 0x7) { |
105 | 0 | default: |
106 | 0 | return AArch64_AM_InvalidShiftExtend; |
107 | 15.9k | case 0: |
108 | 15.9k | return AArch64_AM_LSL; |
109 | 4.05k | case 1: |
110 | 4.05k | return AArch64_AM_LSR; |
111 | 3.27k | case 2: |
112 | 3.27k | return AArch64_AM_ASR; |
113 | 1.72k | case 3: |
114 | 1.72k | return AArch64_AM_ROR; |
115 | 189 | case 4: |
116 | 189 | return AArch64_AM_MSL; |
117 | 25.1k | } |
118 | 25.1k | } AArch64Mapping.c:AArch64_AM_getShiftType Line | Count | Source | 103 | 8.53k | { | 104 | 8.53k | switch ((Imm >> 6) & 0x7) { | 105 | 0 | default: | 106 | 0 | return AArch64_AM_InvalidShiftExtend; | 107 | 5.45k | case 0: | 108 | 5.45k | return AArch64_AM_LSL; | 109 | 1.35k | case 1: | 110 | 1.35k | return AArch64_AM_LSR; | 111 | 1.09k | case 2: | 112 | 1.09k | return AArch64_AM_ASR; | 113 | 576 | case 3: | 114 | 576 | return AArch64_AM_ROR; | 115 | 63 | case 4: | 116 | 63 | return AArch64_AM_MSL; | 117 | 8.53k | } | 118 | 8.53k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getShiftType Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getShiftType AArch64InstPrinter.c:AArch64_AM_getShiftType Line | Count | Source | 103 | 16.6k | { | 104 | 16.6k | switch ((Imm >> 6) & 0x7) { | 105 | 0 | default: | 106 | 0 | return AArch64_AM_InvalidShiftExtend; | 107 | 10.4k | case 0: | 108 | 10.4k | return AArch64_AM_LSL; | 109 | 2.70k | case 1: | 110 | 2.70k | return AArch64_AM_LSR; | 111 | 2.18k | case 2: | 112 | 2.18k | return AArch64_AM_ASR; | 113 | 1.15k | case 3: | 114 | 1.15k | return AArch64_AM_ROR; | 115 | 126 | case 4: | 116 | 126 | return AArch64_AM_MSL; | 117 | 16.6k | } | 118 | 16.6k | } |
|
119 | | |
120 | | /// getShiftValue - Extract the shift value. |
121 | | static inline unsigned AArch64_AM_getShiftValue(unsigned Imm) |
122 | 30.1k | { |
123 | 30.1k | return Imm & 0x3f; |
124 | 30.1k | } AArch64Mapping.c:AArch64_AM_getShiftValue Line | Count | Source | 122 | 12.2k | { | 123 | 12.2k | return Imm & 0x3f; | 124 | 12.2k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getShiftValue Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getShiftValue AArch64InstPrinter.c:AArch64_AM_getShiftValue Line | Count | Source | 122 | 17.9k | { | 123 | 17.9k | return Imm & 0x3f; | 124 | 17.9k | } |
|
125 | | |
126 | | /// getShifterImm - Encode the shift type and amount: |
127 | | /// imm: 6-bit shift amount |
128 | | /// shifter: 000 ==> lsl |
129 | | /// 001 ==> lsr |
130 | | /// 010 ==> asr |
131 | | /// 011 ==> ror |
132 | | /// 100 ==> msl |
133 | | /// {8-6} = shifter |
134 | | /// {5-0} = imm |
135 | | static inline unsigned AArch64_AM_getShifterImm(AArch64_AM_ShiftExtendType ST, |
136 | | unsigned Imm) |
137 | 0 | { |
138 | 0 |
|
139 | 0 | unsigned STEnc = 0; |
140 | 0 | switch (ST) { |
141 | 0 | default: |
142 | 0 | assert(0 && "Invalid shift requested"); |
143 | 0 | case AArch64_AM_LSL: |
144 | 0 | STEnc = 0; |
145 | 0 | break; |
146 | 0 | case AArch64_AM_LSR: |
147 | 0 | STEnc = 1; |
148 | 0 | break; |
149 | 0 | case AArch64_AM_ASR: |
150 | 0 | STEnc = 2; |
151 | 0 | break; |
152 | 0 | case AArch64_AM_ROR: |
153 | 0 | STEnc = 3; |
154 | 0 | break; |
155 | 0 | case AArch64_AM_MSL: |
156 | 0 | STEnc = 4; |
157 | 0 | break; |
158 | 0 | } |
159 | 0 | return (STEnc << 6) | (Imm & 0x3f); |
160 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getShifterImm Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getShifterImm Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getShifterImm Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_getShifterImm |
161 | | |
162 | | //===----------------------------------------------------------------------===// |
163 | | // Extends |
164 | | // |
165 | | /// getArithShiftValue - get the arithmetic shift value. |
166 | | static inline unsigned AArch64_AM_getArithShiftValue(unsigned Imm) |
167 | 3.97k | { |
168 | 3.97k | return Imm & 0x7; |
169 | 3.97k | } AArch64Mapping.c:AArch64_AM_getArithShiftValue Line | Count | Source | 167 | 1.98k | { | 168 | 1.98k | return Imm & 0x7; | 169 | 1.98k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getArithShiftValue Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getArithShiftValue AArch64InstPrinter.c:AArch64_AM_getArithShiftValue Line | Count | Source | 167 | 1.98k | { | 168 | 1.98k | return Imm & 0x7; | 169 | 1.98k | } |
|
170 | | |
171 | | /// getExtendType - Extract the extend type for operands of arithmetic ops. |
172 | | static inline AArch64_AM_ShiftExtendType AArch64_AM_getExtendType(unsigned Imm) |
173 | 3.97k | { |
174 | | |
175 | 3.97k | switch (Imm) { |
176 | 0 | default: |
177 | 0 | assert(0 && "Compiler bug!"); |
178 | 258 | case 0: |
179 | 258 | return AArch64_AM_UXTB; |
180 | 836 | case 1: |
181 | 836 | return AArch64_AM_UXTH; |
182 | 874 | case 2: |
183 | 874 | return AArch64_AM_UXTW; |
184 | 812 | case 3: |
185 | 812 | return AArch64_AM_UXTX; |
186 | 356 | case 4: |
187 | 356 | return AArch64_AM_SXTB; |
188 | 382 | case 5: |
189 | 382 | return AArch64_AM_SXTH; |
190 | 52 | case 6: |
191 | 52 | return AArch64_AM_SXTW; |
192 | 406 | case 7: |
193 | 406 | return AArch64_AM_SXTX; |
194 | 3.97k | } |
195 | 3.97k | } AArch64Mapping.c:AArch64_AM_getExtendType Line | Count | Source | 173 | 1.98k | { | 174 | | | 175 | 1.98k | switch (Imm) { | 176 | 0 | default: | 177 | 0 | assert(0 && "Compiler bug!"); | 178 | 129 | case 0: | 179 | 129 | return AArch64_AM_UXTB; | 180 | 418 | case 1: | 181 | 418 | return AArch64_AM_UXTH; | 182 | 437 | case 2: | 183 | 437 | return AArch64_AM_UXTW; | 184 | 406 | case 3: | 185 | 406 | return AArch64_AM_UXTX; | 186 | 178 | case 4: | 187 | 178 | return AArch64_AM_SXTB; | 188 | 191 | case 5: | 189 | 191 | return AArch64_AM_SXTH; | 190 | 26 | case 6: | 191 | 26 | return AArch64_AM_SXTW; | 192 | 203 | case 7: | 193 | 203 | return AArch64_AM_SXTX; | 194 | 1.98k | } | 195 | 1.98k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getExtendType Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getExtendType AArch64InstPrinter.c:AArch64_AM_getExtendType Line | Count | Source | 173 | 1.98k | { | 174 | | | 175 | 1.98k | switch (Imm) { | 176 | 0 | default: | 177 | 0 | assert(0 && "Compiler bug!"); | 178 | 129 | case 0: | 179 | 129 | return AArch64_AM_UXTB; | 180 | 418 | case 1: | 181 | 418 | return AArch64_AM_UXTH; | 182 | 437 | case 2: | 183 | 437 | return AArch64_AM_UXTW; | 184 | 406 | case 3: | 185 | 406 | return AArch64_AM_UXTX; | 186 | 178 | case 4: | 187 | 178 | return AArch64_AM_SXTB; | 188 | 191 | case 5: | 189 | 191 | return AArch64_AM_SXTH; | 190 | 26 | case 6: | 191 | 26 | return AArch64_AM_SXTW; | 192 | 203 | case 7: | 193 | 203 | return AArch64_AM_SXTX; | 194 | 1.98k | } | 195 | 1.98k | } |
|
196 | | |
197 | | static inline AArch64_AM_ShiftExtendType |
198 | | AArch64_AM_getArithExtendType(unsigned Imm) |
199 | 3.97k | { |
200 | 3.97k | return AArch64_AM_getExtendType((Imm >> 3) & 0x7); |
201 | 3.97k | } AArch64Mapping.c:AArch64_AM_getArithExtendType Line | Count | Source | 199 | 1.98k | { | 200 | 1.98k | return AArch64_AM_getExtendType((Imm >> 3) & 0x7); | 201 | 1.98k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getArithExtendType Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getArithExtendType AArch64InstPrinter.c:AArch64_AM_getArithExtendType Line | Count | Source | 199 | 1.98k | { | 200 | 1.98k | return AArch64_AM_getExtendType((Imm >> 3) & 0x7); | 201 | 1.98k | } |
|
202 | | |
203 | | /// Mapping from extend bits to required operation: |
204 | | /// shifter: 000 ==> uxtb |
205 | | /// 001 ==> uxth |
206 | | /// 010 ==> uxtw |
207 | | /// 011 ==> uxtx |
208 | | /// 100 ==> sxtb |
209 | | /// 101 ==> sxth |
210 | | /// 110 ==> sxtw |
211 | | /// 111 ==> sxtx |
212 | | static inline unsigned AArch64_AM_getExtendEncoding(AArch64_AM_ShiftExtendType ET) |
213 | 0 | { |
214 | 0 | switch (ET) { |
215 | 0 | default: |
216 | 0 | assert(0 && "Invalid extend type requested"); |
217 | 0 | case AArch64_AM_UXTB: |
218 | 0 | return 0; |
219 | 0 | break; |
220 | 0 | case AArch64_AM_UXTH: |
221 | 0 | return 1; |
222 | 0 | break; |
223 | 0 | case AArch64_AM_UXTW: |
224 | 0 | return 2; |
225 | 0 | break; |
226 | 0 | case AArch64_AM_UXTX: |
227 | 0 | return 3; |
228 | 0 | break; |
229 | 0 | case AArch64_AM_SXTB: |
230 | 0 | return 4; |
231 | 0 | break; |
232 | 0 | case AArch64_AM_SXTH: |
233 | 0 | return 5; |
234 | 0 | break; |
235 | 0 | case AArch64_AM_SXTW: |
236 | 0 | return 6; |
237 | 0 | break; |
238 | 0 | case AArch64_AM_SXTX: |
239 | 0 | return 7; |
240 | 0 | break; |
241 | 0 | } |
242 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getExtendEncoding Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getExtendEncoding Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getExtendEncoding Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_getExtendEncoding |
243 | | |
244 | | /// getArithExtendImm - Encode the extend type and shift amount for an |
245 | | /// arithmetic instruction: |
246 | | /// imm: 3-bit extend amount |
247 | | /// {5-3} = shifter |
248 | | /// {2-0} = imm3 |
249 | | static inline unsigned |
250 | | AArch64_AM_getArithExtendImm(AArch64_AM_ShiftExtendType ET, unsigned Imm) |
251 | 0 | { |
252 | 0 |
|
253 | 0 | return (AArch64_AM_getExtendEncoding(ET) << 3) | (Imm & 0x7); |
254 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getArithExtendImm Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getArithExtendImm Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getArithExtendImm Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_getArithExtendImm |
255 | | |
256 | | /// getMemDoShift - Extract the "do shift" flag value for load/store |
257 | | /// instructions. |
258 | | static inline bool AArch64_AM_getMemDoShift(unsigned Imm) |
259 | 0 | { |
260 | 0 | return (Imm & 0x1) != 0; |
261 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getMemDoShift Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getMemDoShift Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getMemDoShift Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_getMemDoShift |
262 | | |
263 | | /// getExtendType - Extract the extend type for the offset operand of |
264 | | /// loads/stores. |
265 | | static inline AArch64_AM_ShiftExtendType |
266 | | AArch64_AM_getMemExtendType(unsigned Imm) |
267 | 0 | { |
268 | 0 | return AArch64_AM_getExtendType((Imm >> 1) & 0x7); |
269 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getMemExtendType Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getMemExtendType Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getMemExtendType Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_getMemExtendType |
270 | | |
271 | | /// getExtendImm - Encode the extend type and amount for a load/store inst: |
272 | | /// doshift: should the offset be scaled by the access size |
273 | | /// shifter: 000 ==> uxtb |
274 | | /// 001 ==> uxth |
275 | | /// 010 ==> uxtw |
276 | | /// 011 ==> uxtx |
277 | | /// 100 ==> sxtb |
278 | | /// 101 ==> sxth |
279 | | /// 110 ==> sxtw |
280 | | /// 111 ==> sxtx |
281 | | /// {3-1} = shifter |
282 | | /// {0} = doshift |
283 | | static inline unsigned AArch64_AM_getMemExtendImm(AArch64_AM_ShiftExtendType ET, |
284 | | bool DoShift) |
285 | 0 | { |
286 | 0 | return (AArch64_AM_getExtendEncoding(ET) << 1) | (unsigned)DoShift; |
287 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_getMemExtendImm Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getMemExtendImm Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getMemExtendImm Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_getMemExtendImm |
288 | | |
289 | | static inline uint64_t AArch64_AM_ror(uint64_t elt, unsigned size) |
290 | 193k | { |
291 | 193k | return ((elt & 1) << (size - 1)) | (elt >> 1); |
292 | 193k | } AArch64Mapping.c:AArch64_AM_ror Line | Count | Source | 290 | 56.7k | { | 291 | 56.7k | return ((elt & 1) << (size - 1)) | (elt >> 1); | 292 | 56.7k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_ror Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_ror AArch64InstPrinter.c:AArch64_AM_ror Line | Count | Source | 290 | 136k | { | 291 | 136k | return ((elt & 1) << (size - 1)) | (elt >> 1); | 292 | 136k | } |
|
293 | | |
294 | | /// processLogicalImmediate - Determine if an immediate value can be encoded |
295 | | /// as the immediate operand of a logical instruction for the given register |
296 | | /// size. If so, return true with "encoding" set to the encoded value in |
297 | | /// the form N:immr:imms. |
298 | | static inline bool AArch64_AM_processLogicalImmediate(uint64_t Imm, |
299 | | unsigned RegSize, |
300 | | uint64_t *Encoding) |
301 | 3.02k | { |
302 | 3.02k | if (Imm == 0ULL || Imm == ~0ULL || |
303 | 3.02k | (RegSize != 64 && |
304 | 3.02k | (Imm >> RegSize != 0 || Imm == (~0ULL >> (64 - RegSize))))) |
305 | 0 | return false; |
306 | | |
307 | | // First, determine the element size. |
308 | 3.02k | unsigned Size = RegSize; |
309 | | |
310 | 7.57k | do { |
311 | 7.57k | Size /= 2; |
312 | 7.57k | uint64_t Mask = (1ULL << Size) - 1; |
313 | | |
314 | 7.57k | if ((Imm & Mask) != ((Imm >> Size) & Mask)) { |
315 | 3.02k | Size *= 2; |
316 | 3.02k | break; |
317 | 3.02k | } |
318 | 7.57k | } while (Size > 2); |
319 | | |
320 | | // Second, determine the rotation to make the element be: 0^m 1^n. |
321 | 0 | uint32_t CTO, I; |
322 | 3.02k | uint64_t Mask = ((uint64_t)-1LL) >> (64 - Size); |
323 | 3.02k | Imm &= Mask; |
324 | | |
325 | 3.02k | if (isShiftedMask_64(Imm)) { |
326 | 2.64k | I = CountTrailingZeros_64(Imm); |
327 | | |
328 | 2.64k | CTO = CountTrailingOnes_64(Imm >> I); |
329 | 2.64k | } else { |
330 | 377 | Imm |= ~Mask; |
331 | 377 | if (!isShiftedMask_64(~Imm)) |
332 | 0 | return false; |
333 | | |
334 | 377 | unsigned CLO = CountLeadingOnes_64(Imm); |
335 | 377 | I = 64 - CLO; |
336 | 377 | CTO = CLO + CountTrailingOnes_64(Imm) - (64 - Size); |
337 | 377 | } |
338 | | |
339 | | // Encode in Immr the number of RORs it would take to get *from* 0^m 1^n |
340 | | // to our target value, where I is the number of RORs to go the opposite |
341 | | // direction. |
342 | | |
343 | 3.02k | unsigned Immr = (Size - I) & (Size - 1); |
344 | | |
345 | | // If size has a 1 in the n'th bit, create a value that has zeroes in |
346 | | // bits [0, n] and ones above that. |
347 | 3.02k | uint64_t NImms = ~(Size - 1) << 1; |
348 | | |
349 | | // Or the CTO value into the low bits, which must be below the Nth bit |
350 | | // bit mentioned above. |
351 | 3.02k | NImms |= (CTO - 1); |
352 | | |
353 | | // Extract the seventh bit and toggle it to create the N field. |
354 | 3.02k | unsigned N = ((NImms >> 6) & 1) ^ 1; |
355 | | |
356 | 3.02k | *Encoding = (N << 12) | (Immr << 6) | (NImms & 0x3f); |
357 | 3.02k | return true; |
358 | 3.02k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_processLogicalImmediate Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_processLogicalImmediate Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_processLogicalImmediate AArch64InstPrinter.c:AArch64_AM_processLogicalImmediate Line | Count | Source | 301 | 3.02k | { | 302 | 3.02k | if (Imm == 0ULL || Imm == ~0ULL || | 303 | 3.02k | (RegSize != 64 && | 304 | 3.02k | (Imm >> RegSize != 0 || Imm == (~0ULL >> (64 - RegSize))))) | 305 | 0 | return false; | 306 | | | 307 | | // First, determine the element size. | 308 | 3.02k | unsigned Size = RegSize; | 309 | | | 310 | 7.57k | do { | 311 | 7.57k | Size /= 2; | 312 | 7.57k | uint64_t Mask = (1ULL << Size) - 1; | 313 | | | 314 | 7.57k | if ((Imm & Mask) != ((Imm >> Size) & Mask)) { | 315 | 3.02k | Size *= 2; | 316 | 3.02k | break; | 317 | 3.02k | } | 318 | 7.57k | } while (Size > 2); | 319 | | | 320 | | // Second, determine the rotation to make the element be: 0^m 1^n. | 321 | 0 | uint32_t CTO, I; | 322 | 3.02k | uint64_t Mask = ((uint64_t)-1LL) >> (64 - Size); | 323 | 3.02k | Imm &= Mask; | 324 | | | 325 | 3.02k | if (isShiftedMask_64(Imm)) { | 326 | 2.64k | I = CountTrailingZeros_64(Imm); | 327 | | | 328 | 2.64k | CTO = CountTrailingOnes_64(Imm >> I); | 329 | 2.64k | } else { | 330 | 377 | Imm |= ~Mask; | 331 | 377 | if (!isShiftedMask_64(~Imm)) | 332 | 0 | return false; | 333 | | | 334 | 377 | unsigned CLO = CountLeadingOnes_64(Imm); | 335 | 377 | I = 64 - CLO; | 336 | 377 | CTO = CLO + CountTrailingOnes_64(Imm) - (64 - Size); | 337 | 377 | } | 338 | | | 339 | | // Encode in Immr the number of RORs it would take to get *from* 0^m 1^n | 340 | | // to our target value, where I is the number of RORs to go the opposite | 341 | | // direction. | 342 | | | 343 | 3.02k | unsigned Immr = (Size - I) & (Size - 1); | 344 | | | 345 | | // If size has a 1 in the n'th bit, create a value that has zeroes in | 346 | | // bits [0, n] and ones above that. | 347 | 3.02k | uint64_t NImms = ~(Size - 1) << 1; | 348 | | | 349 | | // Or the CTO value into the low bits, which must be below the Nth bit | 350 | | // bit mentioned above. | 351 | 3.02k | NImms |= (CTO - 1); | 352 | | | 353 | | // Extract the seventh bit and toggle it to create the N field. | 354 | 3.02k | unsigned N = ((NImms >> 6) & 1) ^ 1; | 355 | | | 356 | 3.02k | *Encoding = (N << 12) | (Immr << 6) | (NImms & 0x3f); | 357 | 3.02k | return true; | 358 | 3.02k | } |
|
359 | | |
360 | | /// isLogicalImmediate - Return true if the immediate is valid for a logical |
361 | | /// immediate instruction of the given register size. Return false otherwise. |
362 | | static inline bool AArch64_AM_isLogicalImmediate(uint64_t imm, unsigned regSize) |
363 | 3.02k | { |
364 | 3.02k | uint64_t encoding = 0; |
365 | 3.02k | return AArch64_AM_processLogicalImmediate(imm, regSize, &encoding); |
366 | 3.02k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isLogicalImmediate Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isLogicalImmediate Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isLogicalImmediate AArch64InstPrinter.c:AArch64_AM_isLogicalImmediate Line | Count | Source | 363 | 3.02k | { | 364 | 3.02k | uint64_t encoding = 0; | 365 | 3.02k | return AArch64_AM_processLogicalImmediate(imm, regSize, &encoding); | 366 | 3.02k | } |
|
367 | | |
368 | | /// encodeLogicalImmediate - Return the encoded immediate value for a logical |
369 | | /// immediate instruction of the given register size. |
370 | | static inline uint64_t AArch64_AM_encodeLogicalImmediate(uint64_t imm, |
371 | | unsigned regSize) |
372 | 0 | { |
373 | 0 | uint64_t encoding = 0; |
374 | 0 | bool res = AArch64_AM_processLogicalImmediate(imm, regSize, &encoding); |
375 | 0 |
|
376 | 0 | (void)res; |
377 | 0 | return encoding; |
378 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeLogicalImmediate Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeLogicalImmediate Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeLogicalImmediate Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeLogicalImmediate |
379 | | |
380 | | /// decodeLogicalImmediate - Decode a logical immediate value in the form |
381 | | /// "N:immr:imms" (where the immr and imms fields are each 6 bits) into the |
382 | | /// integer value it represents with regSize bits. |
383 | | static inline uint64_t AArch64_AM_decodeLogicalImmediate(uint64_t val, |
384 | | unsigned regSize) |
385 | 26.3k | { |
386 | | // Extract the N, imms, and immr fields. |
387 | 26.3k | unsigned N = (val >> 12) & 1; |
388 | 26.3k | unsigned immr = (val >> 6) & 0x3f; |
389 | 26.3k | unsigned imms = val & 0x3f; |
390 | | |
391 | 26.3k | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); |
392 | | |
393 | 26.3k | unsigned size = (1 << len); |
394 | 26.3k | unsigned R = immr & (size - 1); |
395 | 26.3k | unsigned S = imms & (size - 1); |
396 | | |
397 | 26.3k | uint64_t pattern = (1ULL << (S + 1)) - 1; |
398 | 219k | for (unsigned i = 0; i < R; ++i) |
399 | 193k | pattern = AArch64_AM_ror(pattern, size); |
400 | | |
401 | | // Replicate the pattern to fill the regSize. |
402 | 56.1k | while (size != regSize) { |
403 | 29.7k | pattern |= (pattern << size); |
404 | 29.7k | size *= 2; |
405 | 29.7k | } |
406 | 26.3k | return pattern; |
407 | 26.3k | } AArch64Mapping.c:AArch64_AM_decodeLogicalImmediate Line | Count | Source | 385 | 7.45k | { | 386 | | // Extract the N, imms, and immr fields. | 387 | 7.45k | unsigned N = (val >> 12) & 1; | 388 | 7.45k | unsigned immr = (val >> 6) & 0x3f; | 389 | 7.45k | unsigned imms = val & 0x3f; | 390 | | | 391 | 7.45k | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); | 392 | | | 393 | 7.45k | unsigned size = (1 << len); | 394 | 7.45k | unsigned R = immr & (size - 1); | 395 | 7.45k | unsigned S = imms & (size - 1); | 396 | | | 397 | 7.45k | uint64_t pattern = (1ULL << (S + 1)) - 1; | 398 | 64.1k | for (unsigned i = 0; i < R; ++i) | 399 | 56.7k | pattern = AArch64_AM_ror(pattern, size); | 400 | | | 401 | | // Replicate the pattern to fill the regSize. | 402 | 13.9k | while (size != regSize) { | 403 | 6.50k | pattern |= (pattern << size); | 404 | 6.50k | size *= 2; | 405 | 6.50k | } | 406 | 7.45k | return pattern; | 407 | 7.45k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeLogicalImmediate Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeLogicalImmediate AArch64InstPrinter.c:AArch64_AM_decodeLogicalImmediate Line | Count | Source | 385 | 18.8k | { | 386 | | // Extract the N, imms, and immr fields. | 387 | 18.8k | unsigned N = (val >> 12) & 1; | 388 | 18.8k | unsigned immr = (val >> 6) & 0x3f; | 389 | 18.8k | unsigned imms = val & 0x3f; | 390 | | | 391 | 18.8k | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); | 392 | | | 393 | 18.8k | unsigned size = (1 << len); | 394 | 18.8k | unsigned R = immr & (size - 1); | 395 | 18.8k | unsigned S = imms & (size - 1); | 396 | | | 397 | 18.8k | uint64_t pattern = (1ULL << (S + 1)) - 1; | 398 | 155k | for (unsigned i = 0; i < R; ++i) | 399 | 136k | pattern = AArch64_AM_ror(pattern, size); | 400 | | | 401 | | // Replicate the pattern to fill the regSize. | 402 | 42.1k | while (size != regSize) { | 403 | 23.2k | pattern |= (pattern << size); | 404 | 23.2k | size *= 2; | 405 | 23.2k | } | 406 | 18.8k | return pattern; | 407 | 18.8k | } |
|
408 | | |
409 | | /// isValidDecodeLogicalImmediate - Check to see if the logical immediate value |
410 | | /// in the form "N:immr:imms" (where the immr and imms fields are each 6 bits) |
411 | | /// is a valid encoding for an integer value with regSize bits. |
412 | | static inline bool AArch64_AM_isValidDecodeLogicalImmediate(uint64_t val, |
413 | | unsigned regSize) |
414 | 7.87k | { |
415 | | // Extract the N and imms fields needed for checking. |
416 | 7.87k | unsigned N = (val >> 12) & 1; |
417 | 7.87k | unsigned imms = val & 0x3f; |
418 | | |
419 | 7.87k | if (regSize == 32 && N != 0) // undefined logical immediate encoding |
420 | 0 | return false; |
421 | 7.87k | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); |
422 | 7.87k | if (len < 0) // undefined logical immediate encoding |
423 | 4 | return false; |
424 | 7.87k | unsigned size = (1 << len); |
425 | 7.87k | unsigned S = imms & (size - 1); |
426 | 7.87k | if (S == size - 1) // undefined logical immediate encoding |
427 | 9 | return false; |
428 | | |
429 | 7.86k | return true; |
430 | 7.87k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isValidDecodeLogicalImmediate AArch64Disassembler.c:AArch64_AM_isValidDecodeLogicalImmediate Line | Count | Source | 414 | 7.87k | { | 415 | | // Extract the N and imms fields needed for checking. | 416 | 7.87k | unsigned N = (val >> 12) & 1; | 417 | 7.87k | unsigned imms = val & 0x3f; | 418 | | | 419 | 7.87k | if (regSize == 32 && N != 0) // undefined logical immediate encoding | 420 | 0 | return false; | 421 | 7.87k | int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f)); | 422 | 7.87k | if (len < 0) // undefined logical immediate encoding | 423 | 4 | return false; | 424 | 7.87k | unsigned size = (1 << len); | 425 | 7.87k | unsigned S = imms & (size - 1); | 426 | 7.87k | if (S == size - 1) // undefined logical immediate encoding | 427 | 9 | return false; | 428 | | | 429 | 7.86k | return true; | 430 | 7.87k | } |
Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isValidDecodeLogicalImmediate Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isValidDecodeLogicalImmediate |
431 | | |
432 | | //===----------------------------------------------------------------------===// |
433 | | // Floating-point Immediates |
434 | | // |
435 | | static inline float AArch64_AM_getFPImmFloat(unsigned Imm) |
436 | 2.76k | { |
437 | | // We expect an 8-bit binary encoding of a floating-point number here. |
438 | | |
439 | 2.76k | uint8_t Sign = (Imm >> 7) & 0x1; |
440 | 2.76k | uint8_t Exp = (Imm >> 4) & 0x7; |
441 | 2.76k | uint8_t Mantissa = Imm & 0xf; |
442 | | |
443 | | // 8-bit FP IEEE Float Encoding |
444 | | // abcd efgh aBbbbbbc defgh000 00000000 00000000 |
445 | | // |
446 | | // where B = NOT(b); |
447 | | |
448 | 2.76k | uint32_t I = 0; |
449 | 2.76k | I |= Sign << 31; |
450 | 2.76k | I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30; |
451 | 2.76k | I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25; |
452 | 2.76k | I |= (Exp & 0x3) << 23; |
453 | 2.76k | I |= Mantissa << 19; |
454 | 2.76k | return BitsToFloat(I); |
455 | 2.76k | } AArch64Mapping.c:AArch64_AM_getFPImmFloat Line | Count | Source | 436 | 1.38k | { | 437 | | // We expect an 8-bit binary encoding of a floating-point number here. | 438 | | | 439 | 1.38k | uint8_t Sign = (Imm >> 7) & 0x1; | 440 | 1.38k | uint8_t Exp = (Imm >> 4) & 0x7; | 441 | 1.38k | uint8_t Mantissa = Imm & 0xf; | 442 | | | 443 | | // 8-bit FP IEEE Float Encoding | 444 | | // abcd efgh aBbbbbbc defgh000 00000000 00000000 | 445 | | // | 446 | | // where B = NOT(b); | 447 | | | 448 | 1.38k | uint32_t I = 0; | 449 | 1.38k | I |= Sign << 31; | 450 | 1.38k | I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30; | 451 | 1.38k | I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25; | 452 | 1.38k | I |= (Exp & 0x3) << 23; | 453 | 1.38k | I |= Mantissa << 19; | 454 | 1.38k | return BitsToFloat(I); | 455 | 1.38k | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_getFPImmFloat Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_getFPImmFloat AArch64InstPrinter.c:AArch64_AM_getFPImmFloat Line | Count | Source | 436 | 1.38k | { | 437 | | // We expect an 8-bit binary encoding of a floating-point number here. | 438 | | | 439 | 1.38k | uint8_t Sign = (Imm >> 7) & 0x1; | 440 | 1.38k | uint8_t Exp = (Imm >> 4) & 0x7; | 441 | 1.38k | uint8_t Mantissa = Imm & 0xf; | 442 | | | 443 | | // 8-bit FP IEEE Float Encoding | 444 | | // abcd efgh aBbbbbbc defgh000 00000000 00000000 | 445 | | // | 446 | | // where B = NOT(b); | 447 | | | 448 | 1.38k | uint32_t I = 0; | 449 | 1.38k | I |= Sign << 31; | 450 | 1.38k | I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30; | 451 | 1.38k | I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25; | 452 | 1.38k | I |= (Exp & 0x3) << 23; | 453 | 1.38k | I |= Mantissa << 19; | 454 | 1.38k | return BitsToFloat(I); | 455 | 1.38k | } |
|
456 | | |
457 | | //===--------------------------------------------------------------------===// |
458 | | // AdvSIMD Modified Immediates |
459 | | //===--------------------------------------------------------------------===// |
460 | | // 0x00 0x00 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh |
461 | | static inline bool AArch64_AM_isAdvSIMDModImmType1(uint64_t Imm) |
462 | 0 | { |
463 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
464 | 0 | ((Imm & 0xffffff00ffffff00ULL) == 0); |
465 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType1 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType1 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType1 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType1 |
466 | | |
467 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType1(uint64_t Imm) |
468 | 0 | { |
469 | 0 | return (Imm & 0xffULL); |
470 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType1 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType1 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType1 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType1 |
471 | | |
472 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType1(uint8_t Imm) |
473 | 0 | { |
474 | 0 | uint64_t EncVal = Imm; |
475 | 0 | return (EncVal << 32) | EncVal; |
476 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType1 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType1 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType1 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType1 |
477 | | |
478 | | // 0x00 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 |
479 | | static inline bool AArch64_AM_isAdvSIMDModImmType2(uint64_t Imm) |
480 | 0 | { |
481 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
482 | 0 | ((Imm & 0xffff00ffffff00ffULL) == 0); |
483 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType2 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType2 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType2 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType2 |
484 | | |
485 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType2(uint64_t Imm) |
486 | 0 | { |
487 | 0 | return (Imm & 0xff00ULL) >> 8; |
488 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType2 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType2 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType2 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType2 |
489 | | |
490 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType2(uint8_t Imm) |
491 | 0 | { |
492 | 0 | uint64_t EncVal = Imm; |
493 | 0 | return (EncVal << 40) | (EncVal << 8); |
494 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType2 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType2 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType2 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType2 |
495 | | |
496 | | // 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 0x00 |
497 | | static inline bool AArch64_AM_isAdvSIMDModImmType3(uint64_t Imm) |
498 | 0 | { |
499 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
500 | 0 | ((Imm & 0xff00ffffff00ffffULL) == 0); |
501 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType3 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType3 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType3 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType3 |
502 | | |
503 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType3(uint64_t Imm) |
504 | 0 | { |
505 | 0 | return (Imm & 0xff0000ULL) >> 16; |
506 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType3 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType3 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType3 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType3 |
507 | | |
508 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType3(uint8_t Imm) |
509 | 0 | { |
510 | 0 | uint64_t EncVal = Imm; |
511 | 0 | return (EncVal << 48) | (EncVal << 16); |
512 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType3 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType3 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType3 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType3 |
513 | | |
514 | | // abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 0x00 0x00 |
515 | | static inline bool AArch64_AM_isAdvSIMDModImmType4(uint64_t Imm) |
516 | 0 | { |
517 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
518 | 0 | ((Imm & 0x00ffffff00ffffffULL) == 0); |
519 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType4 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType4 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType4 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType4 |
520 | | |
521 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType4(uint64_t Imm) |
522 | 0 | { |
523 | 0 | return (Imm & 0xff000000ULL) >> 24; |
524 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType4 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType4 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType4 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType4 |
525 | | |
526 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType4(uint8_t Imm) |
527 | 0 | { |
528 | 0 | uint64_t EncVal = Imm; |
529 | 0 | return (EncVal << 56) | (EncVal << 24); |
530 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType4 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType4 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType4 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType4 |
531 | | |
532 | | // 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh |
533 | | static inline bool AArch64_AM_isAdvSIMDModImmType5(uint64_t Imm) |
534 | 0 | { |
535 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
536 | 0 | (((Imm & 0x00ff0000ULL) >> 16) == (Imm & 0x000000ffULL)) && |
537 | 0 | ((Imm & 0xff00ff00ff00ff00ULL) == 0); |
538 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType5 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType5 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType5 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType5 |
539 | | |
540 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType5(uint64_t Imm) |
541 | 0 | { |
542 | 0 | return (Imm & 0xffULL); |
543 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType5 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType5 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType5 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType5 |
544 | | |
545 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType5(uint8_t Imm) |
546 | 0 | { |
547 | 0 | uint64_t EncVal = Imm; |
548 | 0 | return (EncVal << 48) | (EncVal << 32) | (EncVal << 16) | EncVal; |
549 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType5 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType5 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType5 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType5 |
550 | | |
551 | | // abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 |
552 | | static inline bool AArch64_AM_isAdvSIMDModImmType6(uint64_t Imm) |
553 | 0 | { |
554 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
555 | 0 | (((Imm & 0xff000000ULL) >> 16) == (Imm & 0x0000ff00ULL)) && |
556 | 0 | ((Imm & 0x00ff00ff00ff00ffULL) == 0); |
557 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType6 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType6 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType6 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType6 |
558 | | |
559 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType6(uint64_t Imm) |
560 | 0 | { |
561 | 0 | return (Imm & 0xff00ULL) >> 8; |
562 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType6 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType6 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType6 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType6 |
563 | | |
564 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType6(uint8_t Imm) |
565 | 0 | { |
566 | 0 | uint64_t EncVal = Imm; |
567 | 0 | return (EncVal << 56) | (EncVal << 40) | (EncVal << 24) | (EncVal << 8); |
568 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType6 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType6 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType6 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType6 |
569 | | |
570 | | // 0x00 0x00 abcdefgh 0xFF 0x00 0x00 abcdefgh 0xFF |
571 | | static inline bool AArch64_AM_isAdvSIMDModImmType7(uint64_t Imm) |
572 | 0 | { |
573 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
574 | 0 | ((Imm & 0xffff00ffffff00ffULL) == 0x000000ff000000ffULL); |
575 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType7 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType7 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType7 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType7 |
576 | | |
577 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType7(uint64_t Imm) |
578 | 0 | { |
579 | 0 | return (Imm & 0xff00ULL) >> 8; |
580 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType7 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType7 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType7 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType7 |
581 | | |
582 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType7(uint8_t Imm) |
583 | 0 | { |
584 | 0 | uint64_t EncVal = Imm; |
585 | 0 | return (EncVal << 40) | (EncVal << 8) | 0x000000ff000000ffULL; |
586 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType7 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType7 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType7 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType7 |
587 | | |
588 | | // 0x00 abcdefgh 0xFF 0xFF 0x00 abcdefgh 0xFF 0xFF |
589 | | static inline bool AArch64_AM_isAdvSIMDModImmType8(uint64_t Imm) |
590 | 0 | { |
591 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
592 | 0 | ((Imm & 0xff00ffffff00ffffULL) == 0x0000ffff0000ffffULL); |
593 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType8 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType8 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType8 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType8 |
594 | | |
595 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType8(uint8_t Imm) |
596 | 0 | { |
597 | 0 | uint64_t EncVal = Imm; |
598 | 0 | return (EncVal << 48) | (EncVal << 16) | 0x0000ffff0000ffffULL; |
599 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType8 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType8 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType8 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType8 |
600 | | |
601 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType8(uint64_t Imm) |
602 | 0 | { |
603 | 0 | return (Imm & 0x00ff0000ULL) >> 16; |
604 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType8 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType8 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType8 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType8 |
605 | | |
606 | | // abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh |
607 | | static inline bool AArch64_AM_isAdvSIMDModImmType9(uint64_t Imm) |
608 | 0 | { |
609 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
610 | 0 | ((Imm >> 48) == (Imm & 0x0000ffffULL)) && |
611 | 0 | ((Imm >> 56) == (Imm & 0x000000ffULL)); |
612 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType9 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType9 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType9 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType9 |
613 | | |
614 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType9(uint64_t Imm) |
615 | 0 | { |
616 | 0 | return (Imm & 0xffULL); |
617 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType9 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType9 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType9 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType9 |
618 | | |
619 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType9(uint8_t Imm) |
620 | 0 | { |
621 | 0 | uint64_t EncVal = Imm; |
622 | 0 | EncVal |= (EncVal << 8); |
623 | 0 | EncVal |= (EncVal << 16); |
624 | 0 | EncVal |= (EncVal << 32); |
625 | 0 | return EncVal; |
626 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType9 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType9 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType9 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType9 |
627 | | |
628 | | // aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh |
629 | | // cmode: 1110, op: 1 |
630 | | static inline bool AArch64_AM_isAdvSIMDModImmType10(uint64_t Imm) |
631 | 0 | { |
632 | 0 | uint64_t ByteA = Imm & 0xff00000000000000ULL; |
633 | 0 | uint64_t ByteB = Imm & 0x00ff000000000000ULL; |
634 | 0 | uint64_t ByteC = Imm & 0x0000ff0000000000ULL; |
635 | 0 | uint64_t ByteD = Imm & 0x000000ff00000000ULL; |
636 | 0 | uint64_t ByteE = Imm & 0x00000000ff000000ULL; |
637 | 0 | uint64_t ByteF = Imm & 0x0000000000ff0000ULL; |
638 | 0 | uint64_t ByteG = Imm & 0x000000000000ff00ULL; |
639 | 0 | uint64_t ByteH = Imm & 0x00000000000000ffULL; |
640 | 0 |
|
641 | 0 | return (ByteA == 0ULL || ByteA == 0xff00000000000000ULL) && |
642 | 0 | (ByteB == 0ULL || ByteB == 0x00ff000000000000ULL) && |
643 | 0 | (ByteC == 0ULL || ByteC == 0x0000ff0000000000ULL) && |
644 | 0 | (ByteD == 0ULL || ByteD == 0x000000ff00000000ULL) && |
645 | 0 | (ByteE == 0ULL || ByteE == 0x00000000ff000000ULL) && |
646 | 0 | (ByteF == 0ULL || ByteF == 0x0000000000ff0000ULL) && |
647 | 0 | (ByteG == 0ULL || ByteG == 0x000000000000ff00ULL) && |
648 | 0 | (ByteH == 0ULL || ByteH == 0x00000000000000ffULL); |
649 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType10 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType10 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType10 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType10 |
650 | | |
651 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType10(uint64_t Imm) |
652 | 0 | { |
653 | 0 | uint8_t BitA = (Imm & 0xff00000000000000ULL) != 0; |
654 | 0 | uint8_t BitB = (Imm & 0x00ff000000000000ULL) != 0; |
655 | 0 | uint8_t BitC = (Imm & 0x0000ff0000000000ULL) != 0; |
656 | 0 | uint8_t BitD = (Imm & 0x000000ff00000000ULL) != 0; |
657 | 0 | uint8_t BitE = (Imm & 0x00000000ff000000ULL) != 0; |
658 | 0 | uint8_t BitF = (Imm & 0x0000000000ff0000ULL) != 0; |
659 | 0 | uint8_t BitG = (Imm & 0x000000000000ff00ULL) != 0; |
660 | 0 | uint8_t BitH = (Imm & 0x00000000000000ffULL) != 0; |
661 | 0 |
|
662 | 0 | uint8_t EncVal = BitA; |
663 | 0 | EncVal <<= 1; |
664 | 0 | EncVal |= BitB; |
665 | 0 | EncVal <<= 1; |
666 | 0 | EncVal |= BitC; |
667 | 0 | EncVal <<= 1; |
668 | 0 | EncVal |= BitD; |
669 | 0 | EncVal <<= 1; |
670 | 0 | EncVal |= BitE; |
671 | 0 | EncVal <<= 1; |
672 | 0 | EncVal |= BitF; |
673 | 0 | EncVal <<= 1; |
674 | 0 | EncVal |= BitG; |
675 | 0 | EncVal <<= 1; |
676 | 0 | EncVal |= BitH; |
677 | 0 | return EncVal; |
678 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType10 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType10 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType10 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType10 |
679 | | |
680 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType10(uint8_t Imm) |
681 | 286 | { |
682 | 286 | uint64_t EncVal = 0; |
683 | 286 | if (Imm & 0x80) |
684 | 196 | EncVal |= 0xff00000000000000ULL; |
685 | 286 | if (Imm & 0x40) |
686 | 104 | EncVal |= 0x00ff000000000000ULL; |
687 | 286 | if (Imm & 0x20) |
688 | 200 | EncVal |= 0x0000ff0000000000ULL; |
689 | 286 | if (Imm & 0x10) |
690 | 20 | EncVal |= 0x000000ff00000000ULL; |
691 | 286 | if (Imm & 0x08) |
692 | 154 | EncVal |= 0x00000000ff000000ULL; |
693 | 286 | if (Imm & 0x04) |
694 | 72 | EncVal |= 0x0000000000ff0000ULL; |
695 | 286 | if (Imm & 0x02) |
696 | 118 | EncVal |= 0x000000000000ff00ULL; |
697 | 286 | if (Imm & 0x01) |
698 | 134 | EncVal |= 0x00000000000000ffULL; |
699 | 286 | return EncVal; |
700 | 286 | } AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType10 Line | Count | Source | 681 | 143 | { | 682 | 143 | uint64_t EncVal = 0; | 683 | 143 | if (Imm & 0x80) | 684 | 98 | EncVal |= 0xff00000000000000ULL; | 685 | 143 | if (Imm & 0x40) | 686 | 52 | EncVal |= 0x00ff000000000000ULL; | 687 | 143 | if (Imm & 0x20) | 688 | 100 | EncVal |= 0x0000ff0000000000ULL; | 689 | 143 | if (Imm & 0x10) | 690 | 10 | EncVal |= 0x000000ff00000000ULL; | 691 | 143 | if (Imm & 0x08) | 692 | 77 | EncVal |= 0x00000000ff000000ULL; | 693 | 143 | if (Imm & 0x04) | 694 | 36 | EncVal |= 0x0000000000ff0000ULL; | 695 | 143 | if (Imm & 0x02) | 696 | 59 | EncVal |= 0x000000000000ff00ULL; | 697 | 143 | if (Imm & 0x01) | 698 | 67 | EncVal |= 0x00000000000000ffULL; | 699 | 143 | return EncVal; | 700 | 143 | } |
Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType10 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType10 AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType10 Line | Count | Source | 681 | 143 | { | 682 | 143 | uint64_t EncVal = 0; | 683 | 143 | if (Imm & 0x80) | 684 | 98 | EncVal |= 0xff00000000000000ULL; | 685 | 143 | if (Imm & 0x40) | 686 | 52 | EncVal |= 0x00ff000000000000ULL; | 687 | 143 | if (Imm & 0x20) | 688 | 100 | EncVal |= 0x0000ff0000000000ULL; | 689 | 143 | if (Imm & 0x10) | 690 | 10 | EncVal |= 0x000000ff00000000ULL; | 691 | 143 | if (Imm & 0x08) | 692 | 77 | EncVal |= 0x00000000ff000000ULL; | 693 | 143 | if (Imm & 0x04) | 694 | 36 | EncVal |= 0x0000000000ff0000ULL; | 695 | 143 | if (Imm & 0x02) | 696 | 59 | EncVal |= 0x000000000000ff00ULL; | 697 | 143 | if (Imm & 0x01) | 698 | 67 | EncVal |= 0x00000000000000ffULL; | 699 | 143 | return EncVal; | 700 | 143 | } |
|
701 | | |
702 | | // aBbbbbbc defgh000 0x00 0x00 aBbbbbbc defgh000 0x00 0x00 |
703 | | static inline bool AArch64_AM_isAdvSIMDModImmType11(uint64_t Imm) |
704 | 0 | { |
705 | 0 | uint64_t BString = (Imm & 0x7E000000ULL) >> 25; |
706 | 0 | return ((Imm >> 32) == (Imm & 0xffffffffULL)) && |
707 | 0 | (BString == 0x1f || BString == 0x20) && |
708 | 0 | ((Imm & 0x0007ffff0007ffffULL) == 0); |
709 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType11 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType11 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType11 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType11 |
710 | | |
711 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType11(uint64_t Imm) |
712 | 0 | { |
713 | 0 | uint8_t BitA = (Imm & 0x80000000ULL) != 0; |
714 | 0 | uint8_t BitB = (Imm & 0x20000000ULL) != 0; |
715 | 0 | uint8_t BitC = (Imm & 0x01000000ULL) != 0; |
716 | 0 | uint8_t BitD = (Imm & 0x00800000ULL) != 0; |
717 | 0 | uint8_t BitE = (Imm & 0x00400000ULL) != 0; |
718 | 0 | uint8_t BitF = (Imm & 0x00200000ULL) != 0; |
719 | 0 | uint8_t BitG = (Imm & 0x00100000ULL) != 0; |
720 | 0 | uint8_t BitH = (Imm & 0x00080000ULL) != 0; |
721 | 0 |
|
722 | 0 | uint8_t EncVal = BitA; |
723 | 0 | EncVal <<= 1; |
724 | 0 | EncVal |= BitB; |
725 | 0 | EncVal <<= 1; |
726 | 0 | EncVal |= BitC; |
727 | 0 | EncVal <<= 1; |
728 | 0 | EncVal |= BitD; |
729 | 0 | EncVal <<= 1; |
730 | 0 | EncVal |= BitE; |
731 | 0 | EncVal <<= 1; |
732 | 0 | EncVal |= BitF; |
733 | 0 | EncVal <<= 1; |
734 | 0 | EncVal |= BitG; |
735 | 0 | EncVal <<= 1; |
736 | 0 | EncVal |= BitH; |
737 | 0 | return EncVal; |
738 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType11 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType11 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType11 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType11 |
739 | | |
740 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType11(uint8_t Imm) |
741 | 0 | { |
742 | 0 | uint64_t EncVal = 0; |
743 | 0 | if (Imm & 0x80) |
744 | 0 | EncVal |= 0x80000000ULL; |
745 | 0 | if (Imm & 0x40) |
746 | 0 | EncVal |= 0x3e000000ULL; |
747 | 0 | else |
748 | 0 | EncVal |= 0x40000000ULL; |
749 | 0 | if (Imm & 0x20) |
750 | 0 | EncVal |= 0x01000000ULL; |
751 | 0 | if (Imm & 0x10) |
752 | 0 | EncVal |= 0x00800000ULL; |
753 | 0 | if (Imm & 0x08) |
754 | 0 | EncVal |= 0x00400000ULL; |
755 | 0 | if (Imm & 0x04) |
756 | 0 | EncVal |= 0x00200000ULL; |
757 | 0 | if (Imm & 0x02) |
758 | 0 | EncVal |= 0x00100000ULL; |
759 | 0 | if (Imm & 0x01) |
760 | 0 | EncVal |= 0x00080000ULL; |
761 | 0 | return (EncVal << 32) | EncVal; |
762 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType11 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType11 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType11 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType11 |
763 | | |
764 | | // aBbbbbbb bbcdefgh 0x00 0x00 0x00 0x00 0x00 0x00 |
765 | | static inline bool AArch64_AM_isAdvSIMDModImmType12(uint64_t Imm) |
766 | 0 | { |
767 | 0 | uint64_t BString = (Imm & 0x7fc0000000000000ULL) >> 54; |
768 | 0 | return ((BString == 0xff || BString == 0x100) && |
769 | 0 | ((Imm & 0x0000ffffffffffffULL) == 0)); |
770 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAdvSIMDModImmType12 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAdvSIMDModImmType12 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAdvSIMDModImmType12 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isAdvSIMDModImmType12 |
771 | | |
772 | | static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType12(uint64_t Imm) |
773 | 0 | { |
774 | 0 | uint8_t BitA = (Imm & 0x8000000000000000ULL) != 0; |
775 | 0 | uint8_t BitB = (Imm & 0x0040000000000000ULL) != 0; |
776 | 0 | uint8_t BitC = (Imm & 0x0020000000000000ULL) != 0; |
777 | 0 | uint8_t BitD = (Imm & 0x0010000000000000ULL) != 0; |
778 | 0 | uint8_t BitE = (Imm & 0x0008000000000000ULL) != 0; |
779 | 0 | uint8_t BitF = (Imm & 0x0004000000000000ULL) != 0; |
780 | 0 | uint8_t BitG = (Imm & 0x0002000000000000ULL) != 0; |
781 | 0 | uint8_t BitH = (Imm & 0x0001000000000000ULL) != 0; |
782 | 0 |
|
783 | 0 | uint8_t EncVal = BitA; |
784 | 0 | EncVal <<= 1; |
785 | 0 | EncVal |= BitB; |
786 | 0 | EncVal <<= 1; |
787 | 0 | EncVal |= BitC; |
788 | 0 | EncVal <<= 1; |
789 | 0 | EncVal |= BitD; |
790 | 0 | EncVal <<= 1; |
791 | 0 | EncVal |= BitE; |
792 | 0 | EncVal <<= 1; |
793 | 0 | EncVal |= BitF; |
794 | 0 | EncVal <<= 1; |
795 | 0 | EncVal |= BitG; |
796 | 0 | EncVal <<= 1; |
797 | 0 | EncVal |= BitH; |
798 | 0 | return EncVal; |
799 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_encodeAdvSIMDModImmType12 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_encodeAdvSIMDModImmType12 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_encodeAdvSIMDModImmType12 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_encodeAdvSIMDModImmType12 |
800 | | |
801 | | static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType12(uint8_t Imm) |
802 | 0 | { |
803 | 0 | uint64_t EncVal = 0; |
804 | 0 | if (Imm & 0x80) |
805 | 0 | EncVal |= 0x8000000000000000ULL; |
806 | 0 | if (Imm & 0x40) |
807 | 0 | EncVal |= 0x3fc0000000000000ULL; |
808 | 0 | else |
809 | 0 | EncVal |= 0x4000000000000000ULL; |
810 | 0 | if (Imm & 0x20) |
811 | 0 | EncVal |= 0x0020000000000000ULL; |
812 | 0 | if (Imm & 0x10) |
813 | 0 | EncVal |= 0x0010000000000000ULL; |
814 | 0 | if (Imm & 0x08) |
815 | 0 | EncVal |= 0x0008000000000000ULL; |
816 | 0 | if (Imm & 0x04) |
817 | 0 | EncVal |= 0x0004000000000000ULL; |
818 | 0 | if (Imm & 0x02) |
819 | 0 | EncVal |= 0x0002000000000000ULL; |
820 | 0 | if (Imm & 0x01) |
821 | 0 | EncVal |= 0x0001000000000000ULL; |
822 | 0 | return (EncVal << 32) | EncVal; |
823 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_decodeAdvSIMDModImmType12 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_decodeAdvSIMDModImmType12 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_decodeAdvSIMDModImmType12 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_decodeAdvSIMDModImmType12 |
824 | | |
825 | | |
826 | | /// Returns true if Imm is the concatenation of a repeating pattern of type T. |
827 | | #define DEFINE_isSVEMaskOfIdenticalElements(T) \ |
828 | | static inline bool CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, T)(int64_t Imm) \ |
829 | 24.7k | { \ |
830 | 24.7k | T *Parts = (T *)(&(Imm)); \ |
831 | 88.4k | for (int i = 0; i < (sizeof(int64_t) / sizeof(T)); i++) { \ |
832 | 71.9k | if (Parts[i] != Parts[0]) \ |
833 | 71.9k | return false; \ |
834 | 71.9k | } \ |
835 | 24.7k | return true; \ |
836 | 24.7k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isSVEMaskOfIdenticalElements_int8_t Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isSVEMaskOfIdenticalElements_int16_t Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isSVEMaskOfIdenticalElements_int32_t Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isSVEMaskOfIdenticalElements_int64_t Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isSVEMaskOfIdenticalElements_int8_t Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isSVEMaskOfIdenticalElements_int16_t Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isSVEMaskOfIdenticalElements_int32_t Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isSVEMaskOfIdenticalElements_int64_t Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isSVEMaskOfIdenticalElements_int8_t Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isSVEMaskOfIdenticalElements_int16_t Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isSVEMaskOfIdenticalElements_int32_t Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isSVEMaskOfIdenticalElements_int64_t AArch64InstPrinter.c:AArch64_AM_isSVEMaskOfIdenticalElements_int8_t Line | Count | Source | 829 | 5.16k | { \ | 830 | 5.16k | T *Parts = (T *)(&(Imm)); \ | 831 | 19.8k | for (int i = 0; i < (sizeof(int64_t) / sizeof(T)); i++) { \ | 832 | 18.8k | if (Parts[i] != Parts[0]) \ | 833 | 18.8k | return false; \ | 834 | 18.8k | } \ | 835 | 5.16k | return true; \ | 836 | 5.16k | } |
AArch64InstPrinter.c:AArch64_AM_isSVEMaskOfIdenticalElements_int16_t Line | Count | Source | 829 | 10.3k | { \ | 830 | 10.3k | T *Parts = (T *)(&(Imm)); \ | 831 | 43.0k | for (int i = 0; i < (sizeof(int64_t) / sizeof(T)); i++) { \ | 832 | 35.7k | if (Parts[i] != Parts[0]) \ | 833 | 35.7k | return false; \ | 834 | 35.7k | } \ | 835 | 10.3k | return true; \ | 836 | 10.3k | } |
AArch64InstPrinter.c:AArch64_AM_isSVEMaskOfIdenticalElements_int32_t Line | Count | Source | 829 | 8.08k | { \ | 830 | 8.08k | T *Parts = (T *)(&(Imm)); \ | 831 | 23.5k | for (int i = 0; i < (sizeof(int64_t) / sizeof(T)); i++) { \ | 832 | 16.1k | if (Parts[i] != Parts[0]) \ | 833 | 16.1k | return false; \ | 834 | 16.1k | } \ | 835 | 8.08k | return true; \ | 836 | 8.08k | } |
AArch64InstPrinter.c:AArch64_AM_isSVEMaskOfIdenticalElements_int64_t Line | Count | Source | 829 | 1.07k | { \ | 830 | 1.07k | T *Parts = (T *)(&(Imm)); \ | 831 | 2.15k | for (int i = 0; i < (sizeof(int64_t) / sizeof(T)); i++) { \ | 832 | 1.07k | if (Parts[i] != Parts[0]) \ | 833 | 1.07k | return false; \ | 834 | 1.07k | } \ | 835 | 1.07k | return true; \ | 836 | 1.07k | } |
|
837 | | DEFINE_isSVEMaskOfIdenticalElements(int8_t); |
838 | | DEFINE_isSVEMaskOfIdenticalElements(int16_t); |
839 | | DEFINE_isSVEMaskOfIdenticalElements(int32_t); |
840 | | DEFINE_isSVEMaskOfIdenticalElements(int64_t); |
841 | | |
842 | | static inline bool AArch64_AM_isSVEMaskOfIdenticalElements64(int64_t Imm) |
843 | 0 | { |
844 | 0 | return true; |
845 | 0 | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isSVEMaskOfIdenticalElements64 Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isSVEMaskOfIdenticalElements64 Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isSVEMaskOfIdenticalElements64 Unexecuted instantiation: AArch64InstPrinter.c:AArch64_AM_isSVEMaskOfIdenticalElements64 |
846 | | |
847 | | static inline bool isSVECpyImm8(int64_t Imm) |
848 | 603 | { |
849 | 603 | bool IsImm8 = (int8_t)Imm == Imm; |
850 | | |
851 | 603 | return IsImm8 || (uint8_t)Imm == Imm; |
852 | 603 | } Unexecuted instantiation: AArch64Mapping.c:isSVECpyImm8 Unexecuted instantiation: AArch64Disassembler.c:isSVECpyImm8 Unexecuted instantiation: AArch64DisassemblerExtension.c:isSVECpyImm8 AArch64InstPrinter.c:isSVECpyImm8 Line | Count | Source | 848 | 603 | { | 849 | 603 | bool IsImm8 = (int8_t)Imm == Imm; | 850 | | | 851 | 603 | return IsImm8 || (uint8_t)Imm == Imm; | 852 | 603 | } |
|
853 | | |
854 | | static inline bool isSVECpyImm16(int64_t Imm) |
855 | 4.03k | { |
856 | 4.03k | bool IsImm8 = (int8_t)Imm == Imm; |
857 | 4.03k | bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm; |
858 | | |
859 | 4.03k | return IsImm8 || IsImm16 || (uint16_t)(Imm & ~0xff) == Imm; |
860 | 4.03k | } Unexecuted instantiation: AArch64Mapping.c:isSVECpyImm16 Unexecuted instantiation: AArch64Disassembler.c:isSVECpyImm16 Unexecuted instantiation: AArch64DisassemblerExtension.c:isSVECpyImm16 AArch64InstPrinter.c:isSVECpyImm16 Line | Count | Source | 855 | 4.03k | { | 856 | 4.03k | bool IsImm8 = (int8_t)Imm == Imm; | 857 | 4.03k | bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm; | 858 | | | 859 | 4.03k | return IsImm8 || IsImm16 || (uint16_t)(Imm & ~0xff) == Imm; | 860 | 4.03k | } |
|
861 | | |
862 | | static inline bool isSVECpyImm32(int64_t Imm) |
863 | 5.20k | { |
864 | 5.20k | bool IsImm8 = (int8_t)Imm == Imm; |
865 | 5.20k | bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm; |
866 | | |
867 | 5.20k | return IsImm8 || IsImm16; |
868 | 5.20k | } Unexecuted instantiation: AArch64Mapping.c:isSVECpyImm32 Unexecuted instantiation: AArch64Disassembler.c:isSVECpyImm32 Unexecuted instantiation: AArch64DisassemblerExtension.c:isSVECpyImm32 AArch64InstPrinter.c:isSVECpyImm32 Line | Count | Source | 863 | 5.20k | { | 864 | 5.20k | bool IsImm8 = (int8_t)Imm == Imm; | 865 | 5.20k | bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm; | 866 | | | 867 | 5.20k | return IsImm8 || IsImm16; | 868 | 5.20k | } |
|
869 | | |
870 | | static inline bool isSVECpyImm64(int64_t Imm) |
871 | 5.45k | { |
872 | 5.45k | bool IsImm8 = (int8_t)Imm == Imm; |
873 | 5.45k | bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm; |
874 | | |
875 | 5.45k | return IsImm8 || IsImm16; |
876 | 5.45k | } Unexecuted instantiation: AArch64Mapping.c:isSVECpyImm64 Unexecuted instantiation: AArch64Disassembler.c:isSVECpyImm64 Unexecuted instantiation: AArch64DisassemblerExtension.c:isSVECpyImm64 AArch64InstPrinter.c:isSVECpyImm64 Line | Count | Source | 871 | 5.45k | { | 872 | 5.45k | bool IsImm8 = (int8_t)Imm == Imm; | 873 | 5.45k | bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm; | 874 | | | 875 | 5.45k | return IsImm8 || IsImm16; | 876 | 5.45k | } |
|
877 | | |
878 | | /// Return true if Imm is valid for DUPM and has no single CPY/DUP equivalent. |
879 | | static inline bool |
880 | | AArch64_AM_isSVEMoveMaskPreferredLogicalImmediate(int64_t Imm) |
881 | 5.45k | { |
882 | 5.45k | if (isSVECpyImm64(Imm)) |
883 | 11 | return false; |
884 | | |
885 | 5.44k | int32_t *S = (int32_t *)(&(Imm)); // arr len = 2 |
886 | 5.44k | int16_t *H = (int16_t *)(&(Imm)); // arr len = 4 |
887 | 5.44k | int8_t *B = (int8_t *)(&(Imm)); // arr len = 8 |
888 | | |
889 | 5.44k | if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int32_t)(Imm) && |
890 | 5.44k | isSVECpyImm32(S[0])) |
891 | 146 | return false; |
892 | 5.29k | if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int16_t)(Imm) && |
893 | 5.29k | isSVECpyImm16(H[0])) |
894 | 1.66k | return false; |
895 | 3.62k | if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int8_t)(Imm) && |
896 | 3.62k | isSVECpyImm8(B[0])) |
897 | 603 | return false; |
898 | 3.02k | return AArch64_AM_isLogicalImmediate(Imm, 64); |
899 | 3.62k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isSVEMoveMaskPreferredLogicalImmediate Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isSVEMoveMaskPreferredLogicalImmediate Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isSVEMoveMaskPreferredLogicalImmediate AArch64InstPrinter.c:AArch64_AM_isSVEMoveMaskPreferredLogicalImmediate Line | Count | Source | 881 | 5.45k | { | 882 | 5.45k | if (isSVECpyImm64(Imm)) | 883 | 11 | return false; | 884 | | | 885 | 5.44k | int32_t *S = (int32_t *)(&(Imm)); // arr len = 2 | 886 | 5.44k | int16_t *H = (int16_t *)(&(Imm)); // arr len = 4 | 887 | 5.44k | int8_t *B = (int8_t *)(&(Imm)); // arr len = 8 | 888 | | | 889 | 5.44k | if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int32_t)(Imm) && | 890 | 5.44k | isSVECpyImm32(S[0])) | 891 | 146 | return false; | 892 | 5.29k | if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int16_t)(Imm) && | 893 | 5.29k | isSVECpyImm16(H[0])) | 894 | 1.66k | return false; | 895 | 3.62k | if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int8_t)(Imm) && | 896 | 3.62k | isSVECpyImm8(B[0])) | 897 | 603 | return false; | 898 | 3.02k | return AArch64_AM_isLogicalImmediate(Imm, 64); | 899 | 3.62k | } |
|
900 | | |
901 | | inline static bool AArch64_AM_isAnyMOVZMovAlias(uint64_t Value, int RegWidth) |
902 | 2.72k | { |
903 | 8.39k | for (int Shift = 0; Shift <= RegWidth - 16; Shift += 16) |
904 | 6.69k | if ((Value & ~(0xffffULL << Shift)) == 0) |
905 | 1.02k | return true; |
906 | | |
907 | 1.70k | return false; |
908 | 2.72k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAnyMOVZMovAlias Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAnyMOVZMovAlias Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAnyMOVZMovAlias AArch64InstPrinter.c:AArch64_AM_isAnyMOVZMovAlias Line | Count | Source | 902 | 2.72k | { | 903 | 8.39k | for (int Shift = 0; Shift <= RegWidth - 16; Shift += 16) | 904 | 6.69k | if ((Value & ~(0xffffULL << Shift)) == 0) | 905 | 1.02k | return true; | 906 | | | 907 | 1.70k | return false; | 908 | 2.72k | } |
|
909 | | |
910 | | inline static bool AArch64_AM_isMOVZMovAlias(uint64_t Value, int Shift, |
911 | | int RegWidth) |
912 | 1.62k | { |
913 | 1.62k | if (RegWidth == 32) |
914 | 730 | Value &= 0xffffffffULL; |
915 | | |
916 | | // "lsl #0" takes precedence: in practice this only affects "#0, lsl #0". |
917 | 1.62k | if (Value == 0 && Shift != 0) |
918 | 26 | return false; |
919 | | |
920 | 1.59k | return (Value & ~(0xffffULL << Shift)) == 0; |
921 | 1.62k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isMOVZMovAlias Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isMOVZMovAlias Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isMOVZMovAlias AArch64InstPrinter.c:AArch64_AM_isMOVZMovAlias Line | Count | Source | 912 | 1.62k | { | 913 | 1.62k | if (RegWidth == 32) | 914 | 730 | Value &= 0xffffffffULL; | 915 | | | 916 | | // "lsl #0" takes precedence: in practice this only affects "#0, lsl #0". | 917 | 1.62k | if (Value == 0 && Shift != 0) | 918 | 26 | return false; | 919 | | | 920 | 1.59k | return (Value & ~(0xffffULL << Shift)) == 0; | 921 | 1.62k | } |
|
922 | | |
923 | | inline static bool AArch64_AM_isMOVNMovAlias(uint64_t Value, int Shift, |
924 | | int RegWidth) |
925 | 1.19k | { |
926 | | // MOVZ takes precedence over MOVN. |
927 | 1.19k | if (AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth)) |
928 | 354 | return false; |
929 | | |
930 | 842 | Value = ~Value; |
931 | 842 | if (RegWidth == 32) |
932 | 278 | Value &= 0xffffffffULL; |
933 | | |
934 | 842 | return AArch64_AM_isMOVZMovAlias(Value, Shift, RegWidth); |
935 | 1.19k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isMOVNMovAlias Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isMOVNMovAlias Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isMOVNMovAlias AArch64InstPrinter.c:AArch64_AM_isMOVNMovAlias Line | Count | Source | 925 | 1.19k | { | 926 | | // MOVZ takes precedence over MOVN. | 927 | 1.19k | if (AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth)) | 928 | 354 | return false; | 929 | | | 930 | 842 | Value = ~Value; | 931 | 842 | if (RegWidth == 32) | 932 | 278 | Value &= 0xffffffffULL; | 933 | | | 934 | 842 | return AArch64_AM_isMOVZMovAlias(Value, Shift, RegWidth); | 935 | 1.19k | } |
|
936 | | |
937 | | inline static bool AArch64_AM_isAnyMOVWMovAlias(uint64_t Value, int RegWidth) |
938 | 1.07k | { |
939 | 1.07k | if (AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth)) |
940 | 624 | return true; |
941 | | |
942 | | // It's not a MOVZ, but it might be a MOVN. |
943 | 454 | Value = ~Value; |
944 | 454 | if (RegWidth == 32) |
945 | 241 | Value &= 0xffffffffULL; |
946 | | |
947 | 454 | return AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth); |
948 | 1.07k | } Unexecuted instantiation: AArch64Mapping.c:AArch64_AM_isAnyMOVWMovAlias Unexecuted instantiation: AArch64Disassembler.c:AArch64_AM_isAnyMOVWMovAlias Unexecuted instantiation: AArch64DisassemblerExtension.c:AArch64_AM_isAnyMOVWMovAlias AArch64InstPrinter.c:AArch64_AM_isAnyMOVWMovAlias Line | Count | Source | 938 | 1.07k | { | 939 | 1.07k | if (AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth)) | 940 | 624 | return true; | 941 | | | 942 | | // It's not a MOVZ, but it might be a MOVN. | 943 | 454 | Value = ~Value; | 944 | 454 | if (RegWidth == 32) | 945 | 241 | Value &= 0xffffffffULL; | 946 | | | 947 | 454 | return AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth); | 948 | 1.07k | } |
|
949 | | |
950 | | // end namespace AArch64_AM |
951 | | |
952 | | // end namespace llvm |
953 | | |
954 | | #endif |