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