1 //==- X86InstrAsmAlias.td - Assembler Instruction Aliases --*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file describes the assembler mnemonic/instruction aliases in the X86
12 //===----------------------------------------------------------------------===//
14 // Reversed version with ".s" suffix for GAS compatibility.
15 def : InstAlias<"mov{b}.s\t{$src, $dst|$dst, $src}",
16 (MOV8rr_REV GR8:$dst, GR8:$src), 0>;
17 def : InstAlias<"mov{w}.s\t{$src, $dst|$dst, $src}",
18 (MOV16rr_REV GR16:$dst, GR16:$src), 0>;
19 def : InstAlias<"mov{l}.s\t{$src, $dst|$dst, $src}",
20 (MOV32rr_REV GR32:$dst, GR32:$src), 0>;
21 def : InstAlias<"mov{q}.s\t{$src, $dst|$dst, $src}",
22 (MOV64rr_REV GR64:$dst, GR64:$src), 0>;
23 def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
24 (MOV8rr_REV GR8:$dst, GR8:$src), 0, "att">;
25 def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
26 (MOV16rr_REV GR16:$dst, GR16:$src), 0, "att">;
27 def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
28 (MOV32rr_REV GR32:$dst, GR32:$src), 0, "att">;
29 def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
30 (MOV64rr_REV GR64:$dst, GR64:$src), 0, "att">;
32 // MONITORX/MWAITX Instructions Alias
33 def : InstAlias<"mwaitx\t{%eax, %ecx, %ebx|ebx, ecx, eax}", (MWAITXrrr)>,
34 Requires<[ Not64BitMode ]>;
35 def : InstAlias<"mwaitx\t{%rax, %rcx, %rbx|rbx, rcx, rax}", (MWAITXrrr)>,
36 Requires<[ In64BitMode ]>;
38 // MONITORX/MWAITX Instructions Alias
39 def : InstAlias<"monitorx\t{%eax, %ecx, %edx|edx, ecx, eax}", (MONITORX32rrr)>,
40 Requires<[ Not64BitMode ]>;
41 def : InstAlias<"monitorx\t{%rax, %rcx, %rdx|rdx, rcx, rax}", (MONITORX64rrr)>,
42 Requires<[ In64BitMode ]>;
44 // CLZERO Instruction Alias
45 def : InstAlias<"clzero\t{%eax|eax}", (CLZERO32r)>, Requires<[Not64BitMode]>;
46 def : InstAlias<"clzero\t{%rax|rax}", (CLZERO64r)>, Requires<[In64BitMode]>;
48 // INVLPGB Instruction Alias
49 def : InstAlias<"invlpgb\t{%eax, %edx|eax, edx}", (INVLPGB32)>, Requires<[Not64BitMode]>;
50 def : InstAlias<"invlpgb\t{%rax, %edx|rax, edx}", (INVLPGB64)>, Requires<[In64BitMode]>;
52 // CMPCCXADD Instructions Alias
53 multiclass CMPCCXADD_Aliases<string Cond, int CC> {
54 let Predicates = [In64BitMode] in {
55 def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
56 (CMPCCXADDmr32 GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
57 def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
58 (CMPCCXADDmr64 GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
60 def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
61 (CMPCCXADDmr32_EVEX GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
62 def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
63 (CMPCCXADDmr64_EVEX GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
67 // CCMP Instructions Alias
68 multiclass CCMP_Aliases<string Cond, int CC> {
69 let Predicates = [In64BitMode] in {
70 def : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
71 (CCMP8rr GR8:$src1, GR8:$src2, cflags:$dcf, CC), 0>;
72 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
73 (CCMP16rr GR16:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
74 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
75 (CCMP32rr GR32:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
76 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
77 (CCMP64rr GR64:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
78 def : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
79 (CCMP8rm GR8:$src1, i8mem:$src2, cflags:$dcf, CC), 0>;
80 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
81 (CCMP16rm GR16:$src1, i16mem:$src2, cflags:$dcf, CC), 0>;
82 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
83 (CCMP32rm GR32:$src1, i32mem:$src2, cflags:$dcf, CC), 0>;
84 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
85 (CCMP64rm GR64:$src1, i64mem:$src2, cflags:$dcf, CC), 0>;
86 def : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
87 (CCMP8mr i8mem:$src1, GR8:$src2, cflags:$dcf, CC), 0>;
88 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
89 (CCMP16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
90 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
91 (CCMP32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
92 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
93 (CCMP64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
94 def : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
95 (CCMP8ri GR8:$src1, i8imm:$src2, cflags:$dcf, CC), 0>;
96 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
97 (CCMP16ri GR16:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
98 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
99 (CCMP32ri GR32:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
100 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
101 (CCMP64ri32 GR64:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
102 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
103 (CCMP16ri8 GR16:$src1, i16i8imm:$src2, cflags:$dcf, CC), 0>;
104 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
105 (CCMP32ri8 GR32:$src1, i32i8imm:$src2, cflags:$dcf, CC), 0>;
106 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
107 (CCMP64ri8 GR64:$src1, i64i8imm:$src2, cflags:$dcf, CC), 0>;
108 def : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
109 (CCMP8mi i8mem:$src1, i8imm:$src2, cflags:$dcf, CC), 0>;
110 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
111 (CCMP16mi i16mem:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
112 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
113 (CCMP32mi i32mem:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
114 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
115 (CCMP64mi32 i64mem:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
116 def : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
117 (CCMP16mi8 i16mem:$src1, i16i8imm:$src2, cflags:$dcf, CC), 0>;
118 def : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
119 (CCMP32mi8 i32mem:$src1, i32i8imm:$src2, cflags:$dcf, CC), 0>;
120 def : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
121 (CCMP64mi8 i64mem:$src1, i64i8imm:$src2, cflags:$dcf, CC), 0>;
124 defm : CCMP_Aliases<"o" , 0>;
125 defm : CCMP_Aliases<"no", 1>;
126 defm : CCMP_Aliases<"b" , 2>;
127 defm : CCMP_Aliases<"c" , 2>;
128 defm : CCMP_Aliases<"nae", 2>;
129 defm : CCMP_Aliases<"nb", 3>;
130 defm : CCMP_Aliases<"nc", 3>;
131 defm : CCMP_Aliases<"ae", 3>;
132 defm : CCMP_Aliases<"e" , 4>;
133 defm : CCMP_Aliases<"z" , 4>;
134 defm : CCMP_Aliases<"ne", 5>;
135 defm : CCMP_Aliases<"nz", 5>;
136 defm : CCMP_Aliases<"be", 6>;
137 defm : CCMP_Aliases<"na", 6>;
138 defm : CCMP_Aliases<"nbe", 7>;
139 defm : CCMP_Aliases<"a" , 7>;
140 defm : CCMP_Aliases<"s" , 8>;
141 defm : CCMP_Aliases<"ns", 9>;
142 defm : CCMP_Aliases<"t" , 10>;
143 defm : CCMP_Aliases<"f", 11>;
144 defm : CCMP_Aliases<"l" , 12>;
145 defm : CCMP_Aliases<"nge",12>;
146 defm : CCMP_Aliases<"nl", 13>;
147 defm : CCMP_Aliases<"ge", 13>;
148 defm : CCMP_Aliases<"le", 14>;
149 defm : CCMP_Aliases<"ng", 14>;
150 defm : CCMP_Aliases<"g" , 15>;
151 defm : CCMP_Aliases<"nle",15>;
153 // CTEST Instructions Alias
154 multiclass CTEST_Aliases<string Cond, int CC> {
155 let Predicates = [In64BitMode] in {
156 def : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
157 (CTEST8rr GR8:$src1, GR8:$src2, cflags:$dcf, CC), 0>;
158 def : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
159 (CTEST16rr GR16:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
160 def : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
161 (CTEST32rr GR32:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
162 def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
163 (CTEST64rr GR64:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
164 def : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
165 (CTEST8mr i8mem:$src1, GR8:$src2, cflags:$dcf, CC), 0>;
166 def : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
167 (CTEST16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
168 def : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
169 (CTEST32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
170 def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
171 (CTEST64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
172 def : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src1, $src2|$src2, $src1}",
173 (CTEST8mr i8mem:$src1, GR8:$src2, cflags:$dcf, CC), 0>;
174 def : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src1, $src2|$src2, $src1}",
175 (CTEST16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
176 def : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src1, $src2|$src2, $src1}",
177 (CTEST32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
178 def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src1, $src2|$src2, $src1}",
179 (CTEST64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
180 def : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
181 (CTEST8ri GR8:$src1, i8imm:$src2, cflags:$dcf, CC), 0>;
182 def : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
183 (CTEST16ri GR16:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
184 def : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
185 (CTEST32ri GR32:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
186 def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
187 (CTEST64ri32 GR64:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
188 def : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
189 (CTEST8mi i8mem:$src1, i8imm:$src2, cflags:$dcf, CC), 0>;
190 def : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
191 (CTEST16mi i16mem:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
192 def : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
193 (CTEST32mi i32mem:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
194 def : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
195 (CTEST64mi32 i64mem:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
198 defm : CTEST_Aliases<"o" , 0>;
199 defm : CTEST_Aliases<"no", 1>;
200 defm : CTEST_Aliases<"b" , 2>;
201 defm : CTEST_Aliases<"c" , 2>;
202 defm : CTEST_Aliases<"nae", 2>;
203 defm : CTEST_Aliases<"nb", 3>;
204 defm : CTEST_Aliases<"nc", 3>;
205 defm : CTEST_Aliases<"ae", 3>;
206 defm : CTEST_Aliases<"e" , 4>;
207 defm : CTEST_Aliases<"z" , 4>;
208 defm : CTEST_Aliases<"ne", 5>;
209 defm : CTEST_Aliases<"nz", 5>;
210 defm : CTEST_Aliases<"be", 6>;
211 defm : CTEST_Aliases<"na", 6>;
212 defm : CTEST_Aliases<"nbe", 7>;
213 defm : CTEST_Aliases<"a" , 7>;
214 defm : CTEST_Aliases<"s" , 8>;
215 defm : CTEST_Aliases<"ns", 9>;
216 defm : CTEST_Aliases<"t" , 10>;
217 defm : CTEST_Aliases<"f", 11>;
218 defm : CTEST_Aliases<"l" , 12>;
219 defm : CTEST_Aliases<"nge",12>;
220 defm : CTEST_Aliases<"nl", 13>;
221 defm : CTEST_Aliases<"ge", 13>;
222 defm : CTEST_Aliases<"le", 14>;
223 defm : CTEST_Aliases<"ng", 14>;
224 defm : CTEST_Aliases<"g" , 15>;
225 defm : CTEST_Aliases<"nle",15>;
227 //===----------------------------------------------------------------------===//
228 // Assembler Mnemonic Aliases
229 //===----------------------------------------------------------------------===//
231 defm : CMPCCXADD_Aliases<"o" , 0>;
232 defm : CMPCCXADD_Aliases<"no", 1>;
233 defm : CMPCCXADD_Aliases<"b" , 2>;
234 defm : CMPCCXADD_Aliases<"ae", 3>;
235 defm : CMPCCXADD_Aliases<"e" , 4>;
236 defm : CMPCCXADD_Aliases<"ne", 5>;
237 defm : CMPCCXADD_Aliases<"be", 6>;
238 defm : CMPCCXADD_Aliases<"a", 7>;
239 defm : CMPCCXADD_Aliases<"s" , 8>;
240 defm : CMPCCXADD_Aliases<"ns", 9>;
241 defm : CMPCCXADD_Aliases<"p" , 10>;
242 defm : CMPCCXADD_Aliases<"np", 11>;
243 defm : CMPCCXADD_Aliases<"l" , 12>;
244 defm : CMPCCXADD_Aliases<"ge", 13>;
245 defm : CMPCCXADD_Aliases<"le", 14>;
246 defm : CMPCCXADD_Aliases<"g", 15>;
249 def : MnemonicAlias<"call", "callw", "att">, Requires<[In16BitMode]>;
250 def : MnemonicAlias<"call", "calll", "att">, Requires<[In32BitMode]>;
251 def : MnemonicAlias<"call", "callq", "att">, Requires<[In64BitMode]>;
253 def : MnemonicAlias<"cbw", "cbtw", "att">;
254 def : MnemonicAlias<"cwde", "cwtl", "att">;
255 def : MnemonicAlias<"cwd", "cwtd", "att">;
256 def : MnemonicAlias<"cdq", "cltd", "att">;
257 def : MnemonicAlias<"cdqe", "cltq", "att">;
258 def : MnemonicAlias<"cqo", "cqto", "att">;
260 // In 64-bit mode lret maps to lretl; it is not ambiguous with lretq.
261 def : MnemonicAlias<"lret", "lretw", "att">, Requires<[In16BitMode]>;
262 def : MnemonicAlias<"lret", "lretl", "att">, Requires<[Not16BitMode]>;
264 def : MnemonicAlias<"leavel", "leave", "att">, Requires<[Not64BitMode]>;
265 def : MnemonicAlias<"leaveq", "leave", "att">, Requires<[In64BitMode]>;
267 def : MnemonicAlias<"loopz", "loope">;
268 def : MnemonicAlias<"loopnz", "loopne">;
270 def : MnemonicAlias<"pop", "popw", "att">, Requires<[In16BitMode]>;
271 def : MnemonicAlias<"pop", "popl", "att">, Requires<[In32BitMode]>;
272 def : MnemonicAlias<"pop", "popq", "att">, Requires<[In64BitMode]>;
273 def : MnemonicAlias<"popf", "popfw", "att">, Requires<[In16BitMode]>;
274 def : MnemonicAlias<"popf", "popfl", "att">, Requires<[In32BitMode]>;
275 def : MnemonicAlias<"popf", "popfq", "att">, Requires<[In64BitMode]>;
276 def : MnemonicAlias<"popf", "popfq", "intel">, Requires<[In64BitMode]>;
277 def : MnemonicAlias<"popfd", "popfl", "att">;
278 def : MnemonicAlias<"popfw", "popf", "intel">, Requires<[In32BitMode]>;
279 def : MnemonicAlias<"popfw", "popf", "intel">, Requires<[In64BitMode]>;
281 // FIXME: This is wrong for "push reg". "push %bx" should turn into pushw in
282 // all modes. However: "push (addr)" and "push $42" should default to
283 // pushl/pushq depending on the current mode. Similar for "pop %bx"
284 def : MnemonicAlias<"push", "pushw", "att">, Requires<[In16BitMode]>;
285 def : MnemonicAlias<"push", "pushl", "att">, Requires<[In32BitMode]>;
286 def : MnemonicAlias<"push", "pushq", "att">, Requires<[In64BitMode]>;
287 def : MnemonicAlias<"pushf", "pushfw", "att">, Requires<[In16BitMode]>;
288 def : MnemonicAlias<"pushf", "pushfl", "att">, Requires<[In32BitMode]>;
289 def : MnemonicAlias<"pushf", "pushfq", "att">, Requires<[In64BitMode]>;
290 def : MnemonicAlias<"pushf", "pushfq", "intel">, Requires<[In64BitMode]>;
291 def : MnemonicAlias<"pushfd", "pushfl", "att">;
292 def : MnemonicAlias<"pushfw", "pushf", "intel">, Requires<[In32BitMode]>;
293 def : MnemonicAlias<"pushfw", "pushf", "intel">, Requires<[In64BitMode]>;
295 def : MnemonicAlias<"popad", "popal", "intel">, Requires<[Not64BitMode]>;
296 def : MnemonicAlias<"pushad", "pushal", "intel">, Requires<[Not64BitMode]>;
297 def : MnemonicAlias<"popa", "popaw", "intel">, Requires<[In16BitMode]>;
298 def : MnemonicAlias<"pusha", "pushaw", "intel">, Requires<[In16BitMode]>;
299 def : MnemonicAlias<"popa", "popal", "intel">, Requires<[In32BitMode]>;
300 def : MnemonicAlias<"pusha", "pushal", "intel">, Requires<[In32BitMode]>;
302 def : MnemonicAlias<"popa", "popaw", "att">, Requires<[In16BitMode]>;
303 def : MnemonicAlias<"pusha", "pushaw", "att">, Requires<[In16BitMode]>;
304 def : MnemonicAlias<"popa", "popal", "att">, Requires<[In32BitMode]>;
305 def : MnemonicAlias<"pusha", "pushal", "att">, Requires<[In32BitMode]>;
307 def : MnemonicAlias<"repe", "rep">;
308 def : MnemonicAlias<"repz", "rep">;
309 def : MnemonicAlias<"repnz", "repne">;
311 def : MnemonicAlias<"ret", "retw", "att">, Requires<[In16BitMode]>;
312 def : MnemonicAlias<"ret", "retl", "att">, Requires<[In32BitMode]>;
313 def : MnemonicAlias<"ret", "retq", "att">, Requires<[In64BitMode]>;
315 // Apply 'ret' behavior to 'retn'
316 def : MnemonicAlias<"retn", "retw", "att">, Requires<[In16BitMode]>;
317 def : MnemonicAlias<"retn", "retl", "att">, Requires<[In32BitMode]>;
318 def : MnemonicAlias<"retn", "retq", "att">, Requires<[In64BitMode]>;
319 def : MnemonicAlias<"retn", "ret", "intel">;
321 def : MnemonicAlias<"sal", "shl", "intel">;
322 def : MnemonicAlias<"salb", "shlb", "att">;
323 def : MnemonicAlias<"salw", "shlw", "att">;
324 def : MnemonicAlias<"sall", "shll", "att">;
325 def : MnemonicAlias<"salq", "shlq", "att">;
327 def : MnemonicAlias<"smovb", "movsb", "att">;
328 def : MnemonicAlias<"smovw", "movsw", "att">;
329 def : MnemonicAlias<"smovl", "movsl", "att">;
330 def : MnemonicAlias<"smovq", "movsq", "att">;
332 def : MnemonicAlias<"ud2a", "ud2", "att">;
333 def : MnemonicAlias<"ud2bw", "ud1w", "att">;
334 def : MnemonicAlias<"ud2bl", "ud1l", "att">;
335 def : MnemonicAlias<"ud2bq", "ud1q", "att">;
336 def : MnemonicAlias<"verrw", "verr", "att">;
338 // MS recognizes 'xacquire'/'xrelease' as 'acquire'/'release'
339 def : MnemonicAlias<"acquire", "xacquire", "intel">;
340 def : MnemonicAlias<"release", "xrelease", "intel">;
342 // System instruction aliases.
343 def : MnemonicAlias<"iret", "iretw", "att">, Requires<[In16BitMode]>;
344 def : MnemonicAlias<"iret", "iretl", "att">, Requires<[Not16BitMode]>;
345 def : MnemonicAlias<"sysret", "sysretl", "att">;
346 def : MnemonicAlias<"sysexit", "sysexitl", "att">;
348 def : MnemonicAlias<"lgdt", "lgdtw", "att">, Requires<[In16BitMode]>;
349 def : MnemonicAlias<"lgdt", "lgdtl", "att">, Requires<[In32BitMode]>;
350 def : MnemonicAlias<"lgdt", "lgdtq", "att">, Requires<[In64BitMode]>;
351 def : MnemonicAlias<"lidt", "lidtw", "att">, Requires<[In16BitMode]>;
352 def : MnemonicAlias<"lidt", "lidtl", "att">, Requires<[In32BitMode]>;
353 def : MnemonicAlias<"lidt", "lidtq", "att">, Requires<[In64BitMode]>;
354 def : MnemonicAlias<"sgdt", "sgdtw", "att">, Requires<[In16BitMode]>;
355 def : MnemonicAlias<"sgdt", "sgdtl", "att">, Requires<[In32BitMode]>;
356 def : MnemonicAlias<"sgdt", "sgdtq", "att">, Requires<[In64BitMode]>;
357 def : MnemonicAlias<"sidt", "sidtw", "att">, Requires<[In16BitMode]>;
358 def : MnemonicAlias<"sidt", "sidtl", "att">, Requires<[In32BitMode]>;
359 def : MnemonicAlias<"sidt", "sidtq", "att">, Requires<[In64BitMode]>;
360 def : MnemonicAlias<"lgdt", "lgdtw", "intel">, Requires<[In16BitMode]>;
361 def : MnemonicAlias<"lgdt", "lgdtd", "intel">, Requires<[In32BitMode]>;
362 def : MnemonicAlias<"lidt", "lidtw", "intel">, Requires<[In16BitMode]>;
363 def : MnemonicAlias<"lidt", "lidtd", "intel">, Requires<[In32BitMode]>;
364 def : MnemonicAlias<"sgdt", "sgdtw", "intel">, Requires<[In16BitMode]>;
365 def : MnemonicAlias<"sgdt", "sgdtd", "intel">, Requires<[In32BitMode]>;
366 def : MnemonicAlias<"sidt", "sidtw", "intel">, Requires<[In16BitMode]>;
367 def : MnemonicAlias<"sidt", "sidtd", "intel">, Requires<[In32BitMode]>;
370 // Floating point stack aliases.
371 def : MnemonicAlias<"fcmovz", "fcmove", "att">;
372 def : MnemonicAlias<"fcmova", "fcmovnbe", "att">;
373 def : MnemonicAlias<"fcmovnae", "fcmovb", "att">;
374 def : MnemonicAlias<"fcmovna", "fcmovbe", "att">;
375 def : MnemonicAlias<"fcmovae", "fcmovnb", "att">;
376 def : MnemonicAlias<"fcomip", "fcompi">;
377 def : MnemonicAlias<"fildq", "fildll", "att">;
378 def : MnemonicAlias<"fistpq", "fistpll", "att">;
379 def : MnemonicAlias<"fisttpq", "fisttpll", "att">;
380 def : MnemonicAlias<"fldcww", "fldcw", "att">;
381 def : MnemonicAlias<"fnstcww", "fnstcw", "att">;
382 def : MnemonicAlias<"fnstsww", "fnstsw", "att">;
383 def : MnemonicAlias<"fucomip", "fucompi">;
384 def : MnemonicAlias<"fwait", "wait">;
386 def : MnemonicAlias<"fxsaveq", "fxsave64", "att">;
387 def : MnemonicAlias<"fxrstorq", "fxrstor64", "att">;
388 def : MnemonicAlias<"xsaveq", "xsave64", "att">;
389 def : MnemonicAlias<"xrstorq", "xrstor64", "att">;
390 def : MnemonicAlias<"xsaveoptq", "xsaveopt64", "att">;
391 def : MnemonicAlias<"xrstorsq", "xrstors64", "att">;
392 def : MnemonicAlias<"xsavecq", "xsavec64", "att">;
393 def : MnemonicAlias<"xsavesq", "xsaves64", "att">;
395 class CondCodeAlias<string Prefix,string Suffix, string OldCond, string NewCond,
397 : MnemonicAlias<!strconcat(Prefix, OldCond, Suffix),
398 !strconcat(Prefix, NewCond, Suffix), VariantName>;
400 /// IntegerCondCodeMnemonicAlias - This multiclass defines a bunch of
401 /// MnemonicAlias's that canonicalize the condition code in a mnemonic, for
402 /// example "setz" -> "sete".
403 multiclass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix,
405 def C : CondCodeAlias<Prefix, Suffix, "c", "b", V>; // setc -> setb
406 def Z : CondCodeAlias<Prefix, Suffix, "z" , "e", V>; // setz -> sete
407 def NA : CondCodeAlias<Prefix, Suffix, "na", "be", V>; // setna -> setbe
408 def NB : CondCodeAlias<Prefix, Suffix, "nb", "ae", V>; // setnb -> setae
409 def NC : CondCodeAlias<Prefix, Suffix, "nc", "ae", V>; // setnc -> setae
410 def NG : CondCodeAlias<Prefix, Suffix, "ng", "le", V>; // setng -> setle
411 def NL : CondCodeAlias<Prefix, Suffix, "nl", "ge", V>; // setnl -> setge
412 def NZ : CondCodeAlias<Prefix, Suffix, "nz", "ne", V>; // setnz -> setne
413 def PE : CondCodeAlias<Prefix, Suffix, "pe", "p", V>; // setpe -> setp
414 def PO : CondCodeAlias<Prefix, Suffix, "po", "np", V>; // setpo -> setnp
416 def NAE : CondCodeAlias<Prefix, Suffix, "nae", "b", V>; // setnae -> setb
417 def NBE : CondCodeAlias<Prefix, Suffix, "nbe", "a", V>; // setnbe -> seta
418 def NGE : CondCodeAlias<Prefix, Suffix, "nge", "l", V>; // setnge -> setl
419 def NLE : CondCodeAlias<Prefix, Suffix, "nle", "g", V>; // setnle -> setg
422 // Aliases for set<CC>
423 defm : IntegerCondCodeMnemonicAlias<"set", "">;
424 defm : IntegerCondCodeMnemonicAlias<"setzu", "">;
426 defm : IntegerCondCodeMnemonicAlias<"j", "">;
427 // Aliases for cmov<CC>{w,l,q}
428 defm : IntegerCondCodeMnemonicAlias<"cmov", "w", "att">;
429 defm : IntegerCondCodeMnemonicAlias<"cmov", "l", "att">;
430 defm : IntegerCondCodeMnemonicAlias<"cmov", "q", "att">;
431 // No size suffix for intel-style asm.
432 defm : IntegerCondCodeMnemonicAlias<"cmov", "", "intel">;
434 // Aliases for cfcmov<CC>{w,l,q}
435 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "w", "att">;
436 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "l", "att">;
437 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "q", "att">;
438 // No size suffix for intel-style asm.
439 defm : IntegerCondCodeMnemonicAlias<"cfcmov", "", "intel">;
441 // Aliases for cmp<CC>xadd
442 defm : IntegerCondCodeMnemonicAlias<"cmp", "xadd", "">;
443 //===----------------------------------------------------------------------===//
444 // Assembler Instruction Aliases
445 //===----------------------------------------------------------------------===//
447 // aad/aam default to base 10 if no operand is specified.
448 def : InstAlias<"aad", (AAD8i8 10)>, Requires<[Not64BitMode]>;
449 def : InstAlias<"aam", (AAM8i8 10)>, Requires<[Not64BitMode]>;
451 // Disambiguate the mem/imm form of bt-without-a-suffix as btl.
452 // Likewise for btc/btr/bts.
453 def : InstAlias<"bt\t{$imm, $mem|$mem, $imm}",
454 (BT32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
455 def : InstAlias<"btc\t{$imm, $mem|$mem, $imm}",
456 (BTC32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
457 def : InstAlias<"btr\t{$imm, $mem|$mem, $imm}",
458 (BTR32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
459 def : InstAlias<"bts\t{$imm, $mem|$mem, $imm}",
460 (BTS32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
463 def : InstAlias<"clr{b}\t$reg", (XOR8rr GR8 :$reg, GR8 :$reg), 0>;
464 def : InstAlias<"clr{w}\t$reg", (XOR16rr GR16:$reg, GR16:$reg), 0>;
465 def : InstAlias<"clr{l}\t$reg", (XOR32rr GR32:$reg, GR32:$reg), 0>;
466 def : InstAlias<"clr{q}\t$reg", (XOR64rr GR64:$reg, GR64:$reg), 0>;
468 // lods aliases. Accept the destination being omitted because it's implicit
469 // in the mnemonic, or the mnemonic suffix being omitted because it's implicit
470 // in the destination.
471 def : InstAlias<"lodsb\t$src", (LODSB srcidx8:$src), 0>;
472 def : InstAlias<"lodsw\t$src", (LODSW srcidx16:$src), 0>;
473 def : InstAlias<"lods{l|d}\t$src", (LODSL srcidx32:$src), 0>;
474 def : InstAlias<"lodsq\t$src", (LODSQ srcidx64:$src), 0>, Requires<[In64BitMode]>;
475 def : InstAlias<"lods\t{$src, %al|al, $src}", (LODSB srcidx8:$src), 0>;
476 def : InstAlias<"lods\t{$src, %ax|ax, $src}", (LODSW srcidx16:$src), 0>;
477 def : InstAlias<"lods\t{$src, %eax|eax, $src}", (LODSL srcidx32:$src), 0>;
478 def : InstAlias<"lods\t{$src, %rax|rax, $src}", (LODSQ srcidx64:$src), 0>, Requires<[In64BitMode]>;
479 def : InstAlias<"lods\t$src", (LODSB srcidx8:$src), 0, "intel">;
480 def : InstAlias<"lods\t$src", (LODSW srcidx16:$src), 0, "intel">;
481 def : InstAlias<"lods\t$src", (LODSL srcidx32:$src), 0, "intel">;
482 def : InstAlias<"lods\t$src", (LODSQ srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
485 // stos aliases. Accept the source being omitted because it's implicit in
486 // the mnemonic, or the mnemonic suffix being omitted because it's implicit
488 def : InstAlias<"stosb\t$dst", (STOSB dstidx8:$dst), 0>;
489 def : InstAlias<"stosw\t$dst", (STOSW dstidx16:$dst), 0>;
490 def : InstAlias<"stos{l|d}\t$dst", (STOSL dstidx32:$dst), 0>;
491 def : InstAlias<"stosq\t$dst", (STOSQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
492 def : InstAlias<"stos\t{%al, $dst|$dst, al}", (STOSB dstidx8:$dst), 0>;
493 def : InstAlias<"stos\t{%ax, $dst|$dst, ax}", (STOSW dstidx16:$dst), 0>;
494 def : InstAlias<"stos\t{%eax, $dst|$dst, eax}", (STOSL dstidx32:$dst), 0>;
495 def : InstAlias<"stos\t{%rax, $dst|$dst, rax}", (STOSQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
496 def : InstAlias<"stos\t$dst", (STOSB dstidx8:$dst), 0, "intel">;
497 def : InstAlias<"stos\t$dst", (STOSW dstidx16:$dst), 0, "intel">;
498 def : InstAlias<"stos\t$dst", (STOSL dstidx32:$dst), 0, "intel">;
499 def : InstAlias<"stos\t$dst", (STOSQ dstidx64:$dst), 0, "intel">, Requires<[In64BitMode]>;
502 // scas aliases. Accept the destination being omitted because it's implicit
503 // in the mnemonic, or the mnemonic suffix being omitted because it's implicit
504 // in the destination.
505 def : InstAlias<"scasb\t$dst", (SCASB dstidx8:$dst), 0>;
506 def : InstAlias<"scasw\t$dst", (SCASW dstidx16:$dst), 0>;
507 def : InstAlias<"scas{l|d}\t$dst", (SCASL dstidx32:$dst), 0>;
508 def : InstAlias<"scasq\t$dst", (SCASQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
509 def : InstAlias<"scas\t{$dst, %al|al, $dst}", (SCASB dstidx8:$dst), 0>;
510 def : InstAlias<"scas\t{$dst, %ax|ax, $dst}", (SCASW dstidx16:$dst), 0>;
511 def : InstAlias<"scas\t{$dst, %eax|eax, $dst}", (SCASL dstidx32:$dst), 0>;
512 def : InstAlias<"scas\t{$dst, %rax|rax, $dst}", (SCASQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
513 def : InstAlias<"scas\t$dst", (SCASB dstidx8:$dst), 0, "intel">;
514 def : InstAlias<"scas\t$dst", (SCASW dstidx16:$dst), 0, "intel">;
515 def : InstAlias<"scas\t$dst", (SCASL dstidx32:$dst), 0, "intel">;
516 def : InstAlias<"scas\t$dst", (SCASQ dstidx64:$dst), 0, "intel">, Requires<[In64BitMode]>;
518 // cmps aliases. Mnemonic suffix being omitted because it's implicit
519 // in the destination.
520 def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSB dstidx8:$dst, srcidx8:$src), 0, "intel">;
521 def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSW dstidx16:$dst, srcidx16:$src), 0, "intel">;
522 def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSL dstidx32:$dst, srcidx32:$src), 0, "intel">;
523 def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSQ dstidx64:$dst, srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
525 // movs aliases. Mnemonic suffix being omitted because it's implicit
526 // in the destination.
527 def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSB dstidx8:$dst, srcidx8:$src), 0, "intel">;
528 def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSW dstidx16:$dst, srcidx16:$src), 0, "intel">;
529 def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSL dstidx32:$dst, srcidx32:$src), 0, "intel">;
530 def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSQ dstidx64:$dst, srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
532 // div and idiv aliases for explicit A register.
533 def : InstAlias<"div{b}\t{$src, %al|al, $src}", (DIV8r GR8 :$src)>;
534 def : InstAlias<"div{w}\t{$src, %ax|ax, $src}", (DIV16r GR16:$src)>;
535 def : InstAlias<"div{l}\t{$src, %eax|eax, $src}", (DIV32r GR32:$src)>;
536 def : InstAlias<"div{q}\t{$src, %rax|rax, $src}", (DIV64r GR64:$src)>;
537 def : InstAlias<"div{b}\t{$src, %al|al, $src}", (DIV8m i8mem :$src)>;
538 def : InstAlias<"div{w}\t{$src, %ax|ax, $src}", (DIV16m i16mem:$src)>;
539 def : InstAlias<"div{l}\t{$src, %eax|eax, $src}", (DIV32m i32mem:$src)>;
540 def : InstAlias<"div{q}\t{$src, %rax|rax, $src}", (DIV64m i64mem:$src)>;
541 def : InstAlias<"idiv{b}\t{$src, %al|al, $src}", (IDIV8r GR8 :$src)>;
542 def : InstAlias<"idiv{w}\t{$src, %ax|ax, $src}", (IDIV16r GR16:$src)>;
543 def : InstAlias<"idiv{l}\t{$src, %eax|eax, $src}", (IDIV32r GR32:$src)>;
544 def : InstAlias<"idiv{q}\t{$src, %rax|rax, $src}", (IDIV64r GR64:$src)>;
545 def : InstAlias<"idiv{b}\t{$src, %al|al, $src}", (IDIV8m i8mem :$src)>;
546 def : InstAlias<"idiv{w}\t{$src, %ax|ax, $src}", (IDIV16m i16mem:$src)>;
547 def : InstAlias<"idiv{l}\t{$src, %eax|eax, $src}", (IDIV32m i32mem:$src)>;
548 def : InstAlias<"idiv{q}\t{$src, %rax|rax, $src}", (IDIV64m i64mem:$src)>;
552 // Various unary fpstack operations default to operating on ST1.
553 // For example, "fxch" -> "fxch %st(1)"
554 def : InstAlias<"faddp", (ADD_FPrST0 ST1), 0>;
555 def: InstAlias<"fadd", (ADD_FPrST0 ST1), 0>;
556 def : InstAlias<"fsub{|r}p", (SUBR_FPrST0 ST1), 0>;
557 def : InstAlias<"fsub{r|}p", (SUB_FPrST0 ST1), 0>;
558 def : InstAlias<"fmul", (MUL_FPrST0 ST1), 0>;
559 def : InstAlias<"fmulp", (MUL_FPrST0 ST1), 0>;
560 def : InstAlias<"fdiv{|r}p", (DIVR_FPrST0 ST1), 0>;
561 def : InstAlias<"fdiv{r|}p", (DIV_FPrST0 ST1), 0>;
562 def : InstAlias<"fxch", (XCH_F ST1), 0>;
563 def : InstAlias<"fcom", (COM_FST0r ST1), 0>;
564 def : InstAlias<"fcomp", (COMP_FST0r ST1), 0>;
565 def : InstAlias<"fcomi", (COM_FIr ST1), 0>;
566 def : InstAlias<"fcompi", (COM_FIPr ST1), 0>;
567 def : InstAlias<"fucom", (UCOM_Fr ST1), 0>;
568 def : InstAlias<"fucomp", (UCOM_FPr ST1), 0>;
569 def : InstAlias<"fucomi", (UCOM_FIr ST1), 0>;
570 def : InstAlias<"fucompi", (UCOM_FIPr ST1), 0>;
572 // Handle fmul/fadd/fsub/fdiv instructions with explicitly written st(0) op.
573 // For example, "fadd %st(4), %st(0)" -> "fadd %st(4)". We also disambiguate
574 // instructions like "fadd %st(0), %st(0)" as "fadd %st(0)" for consistency with
576 multiclass FpUnaryAlias<string Mnemonic, Instruction Inst, bit EmitAlias = 1> {
577 def : InstAlias<!strconcat(Mnemonic, "\t$op"),
578 (Inst RSTi:$op), EmitAlias>;
579 def : InstAlias<!strconcat(Mnemonic, "\t{%st, %st|st, st}"),
580 (Inst ST0), EmitAlias>;
583 defm : FpUnaryAlias<"fadd", ADD_FST0r, 0>;
584 defm : FpUnaryAlias<"faddp", ADD_FPrST0, 0>;
585 defm : FpUnaryAlias<"fsub", SUB_FST0r, 0>;
586 defm : FpUnaryAlias<"fsub{|r}p", SUBR_FPrST0, 0>;
587 defm : FpUnaryAlias<"fsubr", SUBR_FST0r, 0>;
588 defm : FpUnaryAlias<"fsub{r|}p", SUB_FPrST0, 0>;
589 defm : FpUnaryAlias<"fmul", MUL_FST0r, 0>;
590 defm : FpUnaryAlias<"fmulp", MUL_FPrST0, 0>;
591 defm : FpUnaryAlias<"fdiv", DIV_FST0r, 0>;
592 defm : FpUnaryAlias<"fdiv{|r}p", DIVR_FPrST0, 0>;
593 defm : FpUnaryAlias<"fdivr", DIVR_FST0r, 0>;
594 defm : FpUnaryAlias<"fdiv{r|}p", DIV_FPrST0, 0>;
595 defm : FpUnaryAlias<"fcomi", COM_FIr, 0>;
596 defm : FpUnaryAlias<"fucomi", UCOM_FIr, 0>;
597 defm : FpUnaryAlias<"fcompi", COM_FIPr, 0>;
598 defm : FpUnaryAlias<"fucompi", UCOM_FIPr, 0>;
601 // Handle "f{mulp,addp} $op, %st(0)" the same as "f{mulp,addp} $op", since they
602 // commute. We also allow fdiv[r]p/fsubrp even though they don't commute,
603 // solely because gas supports it.
604 def : InstAlias<"faddp\t{$op, %st|st, $op}", (ADD_FPrST0 RSTi:$op), 0>;
605 def : InstAlias<"fmulp\t{$op, %st|st, $op}", (MUL_FPrST0 RSTi:$op), 0>;
606 def : InstAlias<"fsub{|r}p\t{$op, %st|st, $op}", (SUBR_FPrST0 RSTi:$op), 0>;
607 def : InstAlias<"fsub{r|}p\t{$op, %st|st, $op}", (SUB_FPrST0 RSTi:$op), 0>;
608 def : InstAlias<"fdiv{|r}p\t{$op, %st|st, $op}", (DIVR_FPrST0 RSTi:$op), 0>;
609 def : InstAlias<"fdiv{r|}p\t{$op, %st|st, $op}", (DIV_FPrST0 RSTi:$op), 0>;
611 def : InstAlias<"fnstsw" , (FNSTSW16r), 0>;
613 // lcall and ljmp aliases. This seems to be an odd mapping in 64-bit mode, but
614 // this is compatible with what GAS does.
615 def : InstAlias<"lcall\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg), 0>, Requires<[In32BitMode]>;
616 def : InstAlias<"ljmp\t$seg, $off", (FARJMP32i i32imm:$off, i16imm:$seg), 0>, Requires<[In32BitMode]>;
617 def : InstAlias<"lcall\t{*}$dst", (FARCALL32m opaquemem:$dst), 0>, Requires<[Not16BitMode]>;
618 def : InstAlias<"ljmp\t{*}$dst", (FARJMP32m opaquemem:$dst), 0>, Requires<[Not16BitMode]>;
619 def : InstAlias<"lcall\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg), 0>, Requires<[In16BitMode]>;
620 def : InstAlias<"ljmp\t$seg, $off", (FARJMP16i i16imm:$off, i16imm:$seg), 0>, Requires<[In16BitMode]>;
621 def : InstAlias<"lcall\t{*}$dst", (FARCALL16m opaquemem:$dst), 0>, Requires<[In16BitMode]>;
622 def : InstAlias<"ljmp\t{*}$dst", (FARJMP16m opaquemem:$dst), 0>, Requires<[In16BitMode]>;
624 def : InstAlias<"jmp\t{*}$dst", (JMP64m i64mem:$dst), 0, "att">, Requires<[In64BitMode]>;
625 def : InstAlias<"jmp\t{*}$dst", (JMP32m i32mem:$dst), 0, "att">, Requires<[In32BitMode]>;
626 def : InstAlias<"jmp\t{*}$dst", (JMP16m i16mem:$dst), 0, "att">, Requires<[In16BitMode]>;
629 // "imul <imm>, B" is an alias for "imul <imm>, B, B".
630 def : InstAlias<"imul{w}\t{$imm, $r|$r, $imm}", (IMUL16rri GR16:$r, GR16:$r, i16imm:$imm), 0>;
631 def : InstAlias<"imul{w}\t{$imm, $r|$r, $imm}", (IMUL16rri8 GR16:$r, GR16:$r, i16i8imm:$imm), 0>;
632 def : InstAlias<"imul{l}\t{$imm, $r|$r, $imm}", (IMUL32rri GR32:$r, GR32:$r, i32imm:$imm), 0>;
633 def : InstAlias<"imul{l}\t{$imm, $r|$r, $imm}", (IMUL32rri8 GR32:$r, GR32:$r, i32i8imm:$imm), 0>;
634 def : InstAlias<"imul{q}\t{$imm, $r|$r, $imm}", (IMUL64rri32 GR64:$r, GR64:$r, i64i32imm:$imm), 0>;
635 def : InstAlias<"imul{q}\t{$imm, $r|$r, $imm}", (IMUL64rri8 GR64:$r, GR64:$r, i64i8imm:$imm), 0>;
637 // ins aliases. Accept the mnemonic suffix being omitted because it's implicit
638 // in the destination.
639 def : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSB dstidx8:$dst), 0, "intel">;
640 def : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSW dstidx16:$dst), 0, "intel">;
641 def : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSL dstidx32:$dst), 0, "intel">;
643 // outs aliases. Accept the mnemonic suffix being omitted because it's implicit
645 def : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSB srcidx8:$src), 0, "intel">;
646 def : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSW srcidx16:$src), 0, "intel">;
647 def : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSL srcidx32:$src), 0, "intel">;
649 // inb %dx -> inb %al, %dx
650 def : InstAlias<"inb\t{%dx|dx}", (IN8rr), 0>;
651 def : InstAlias<"inw\t{%dx|dx}", (IN16rr), 0>;
652 def : InstAlias<"inl\t{%dx|dx}", (IN32rr), 0>;
653 def : InstAlias<"inb\t$port", (IN8ri u8imm:$port), 0>;
654 def : InstAlias<"inw\t$port", (IN16ri u8imm:$port), 0>;
655 def : InstAlias<"inl\t$port", (IN32ri u8imm:$port), 0>;
658 // jmp and call aliases for lcall and ljmp. jmp $42,$5 -> ljmp
659 def : InstAlias<"call\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg)>, Requires<[In16BitMode]>;
660 def : InstAlias<"jmp\t$seg, $off", (FARJMP16i i16imm:$off, i16imm:$seg)>, Requires<[In16BitMode]>;
661 def : InstAlias<"call\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>, Requires<[In32BitMode]>;
662 def : InstAlias<"jmp\t$seg, $off", (FARJMP32i i32imm:$off, i16imm:$seg)>, Requires<[In32BitMode]>;
663 def : InstAlias<"callw\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
664 def : InstAlias<"jmpw\t$seg, $off", (FARJMP16i i16imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
665 def : InstAlias<"calll\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
666 def : InstAlias<"jmpl\t$seg, $off", (FARJMP32i i32imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
668 // Match 'movq <largeimm>, <reg>' as an alias for movabsq.
669 def : InstAlias<"mov{q}\t{$imm, $reg|$reg, $imm}", (MOV64ri GR64:$reg, i64imm:$imm), 0>;
671 // Match 'movd GR64, MMX' as an alias for movq to be compatible with gas,
672 // which supports this due to an old AMD documentation bug when 64-bit mode was
674 def : InstAlias<"movd\t{$src, $dst|$dst, $src}",
675 (MMX_MOVD64to64rr VR64:$dst, GR64:$src), 0>;
676 def : InstAlias<"movd\t{$src, $dst|$dst, $src}",
677 (MMX_MOVD64from64rr GR64:$dst, VR64:$src), 0>;
680 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX16rr8 GR16:$dst, GR8:$src), 0, "att">;
681 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX16rm8 GR16:$dst, i8mem:$src), 0, "att">;
682 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX32rr8 GR32:$dst, GR8:$src), 0, "att">;
683 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX32rr16 GR32:$dst, GR16:$src), 0, "att">;
684 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr8 GR64:$dst, GR8:$src), 0, "att">;
685 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr16 GR64:$dst, GR16:$src), 0, "att">;
686 def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr32 GR64:$dst, GR32:$src), 0, "att">;
689 def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX16rr8 GR16:$dst, GR8:$src), 0, "att">;
690 def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX16rm8 GR16:$dst, i8mem:$src), 0, "att">;
691 def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX32rr8 GR32:$dst, GR8:$src), 0, "att">;
692 def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX32rr16 GR32:$dst, GR16:$src), 0, "att">;
693 def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX64rr8 GR64:$dst, GR8:$src), 0, "att">;
694 def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX64rr16 GR64:$dst, GR16:$src), 0, "att">;
695 // Note: No GR32->GR64 movzx form.
697 // outb %dx -> outb %al, %dx
698 def : InstAlias<"outb\t{%dx|dx}", (OUT8rr), 0>;
699 def : InstAlias<"outw\t{%dx|dx}", (OUT16rr), 0>;
700 def : InstAlias<"outl\t{%dx|dx}", (OUT32rr), 0>;
701 def : InstAlias<"outb\t$port", (OUT8ir u8imm:$port), 0>;
702 def : InstAlias<"outw\t$port", (OUT16ir u8imm:$port), 0>;
703 def : InstAlias<"outl\t$port", (OUT32ir u8imm:$port), 0>;
705 // 'sldt <mem>' can be encoded with either sldtw or sldtq with the same
706 // effect (both store to a 16-bit mem). Force to sldtw to avoid ambiguity
707 // errors, since its encoding is the most compact.
708 def : InstAlias<"sldt $mem", (SLDT16m i16mem:$mem), 0>;
710 // shld/shrd op,op -> shld op, op, CL
711 def : InstAlias<"shld{w}\t{$r2, $r1|$r1, $r2}", (SHLD16rrCL GR16:$r1, GR16:$r2), 0>;
712 def : InstAlias<"shld{l}\t{$r2, $r1|$r1, $r2}", (SHLD32rrCL GR32:$r1, GR32:$r2), 0>;
713 def : InstAlias<"shld{q}\t{$r2, $r1|$r1, $r2}", (SHLD64rrCL GR64:$r1, GR64:$r2), 0>;
714 def : InstAlias<"shrd{w}\t{$r2, $r1|$r1, $r2}", (SHRD16rrCL GR16:$r1, GR16:$r2), 0>;
715 def : InstAlias<"shrd{l}\t{$r2, $r1|$r1, $r2}", (SHRD32rrCL GR32:$r1, GR32:$r2), 0>;
716 def : InstAlias<"shrd{q}\t{$r2, $r1|$r1, $r2}", (SHRD64rrCL GR64:$r1, GR64:$r2), 0>;
718 def : InstAlias<"shld{w}\t{$reg, $mem|$mem, $reg}", (SHLD16mrCL i16mem:$mem, GR16:$reg), 0>;
719 def : InstAlias<"shld{l}\t{$reg, $mem|$mem, $reg}", (SHLD32mrCL i32mem:$mem, GR32:$reg), 0>;
720 def : InstAlias<"shld{q}\t{$reg, $mem|$mem, $reg}", (SHLD64mrCL i64mem:$mem, GR64:$reg), 0>;
721 def : InstAlias<"shrd{w}\t{$reg, $mem|$mem, $reg}", (SHRD16mrCL i16mem:$mem, GR16:$reg), 0>;
722 def : InstAlias<"shrd{l}\t{$reg, $mem|$mem, $reg}", (SHRD32mrCL i32mem:$mem, GR32:$reg), 0>;
723 def : InstAlias<"shrd{q}\t{$reg, $mem|$mem, $reg}", (SHRD64mrCL i64mem:$mem, GR64:$reg), 0>;
725 // test: We accept "testX <reg>, <mem>" and "testX <mem>, <reg>" as synonyms.
726 def : InstAlias<"test{b}\t{$mem, $val|$val, $mem}",
727 (TEST8mr i8mem :$mem, GR8 :$val), 0>;
728 def : InstAlias<"test{w}\t{$mem, $val|$val, $mem}",
729 (TEST16mr i16mem:$mem, GR16:$val), 0>;
730 def : InstAlias<"test{l}\t{$mem, $val|$val, $mem}",
731 (TEST32mr i32mem:$mem, GR32:$val), 0>;
732 def : InstAlias<"test{q}\t{$mem, $val|$val, $mem}",
733 (TEST64mr i64mem:$mem, GR64:$val), 0>;
735 // xchg: We accept "xchgX <reg>, <mem>" and "xchgX <mem>, <reg>" as synonyms.
736 def : InstAlias<"xchg{b}\t{$mem, $val|$val, $mem}",
737 (XCHG8rm GR8 :$val, i8mem :$mem), 0>;
738 def : InstAlias<"xchg{w}\t{$mem, $val|$val, $mem}",
739 (XCHG16rm GR16:$val, i16mem:$mem), 0>;
740 def : InstAlias<"xchg{l}\t{$mem, $val|$val, $mem}",
741 (XCHG32rm GR32:$val, i32mem:$mem), 0>;
742 def : InstAlias<"xchg{q}\t{$mem, $val|$val, $mem}",
743 (XCHG64rm GR64:$val, i64mem:$mem), 0>;
745 // xchg: We accept "xchgX <reg>, %eax" and "xchgX %eax, <reg>" as synonyms.
746 def : InstAlias<"xchg{w}\t{%ax, $src|$src, ax}", (XCHG16ar GR16:$src), 0>;
747 def : InstAlias<"xchg{l}\t{%eax, $src|$src, eax}", (XCHG32ar GR32:$src), 0>;
748 def : InstAlias<"xchg{q}\t{%rax, $src|$src, rax}", (XCHG64ar GR64:$src), 0>;
750 // In 64-bit mode, xchg %eax, %eax can't be encoded with the 0x90 opcode we
751 // would get by default because it's defined as NOP. But xchg %eax, %eax implies
752 // implicit zeroing of the upper 32 bits. So alias to the longer encoding.
753 def : InstAlias<"xchg{l}\t{%eax, %eax|eax, eax}",
754 (XCHG32rr EAX, EAX), 0>, Requires<[In64BitMode]>;
756 // xchg %rax, %rax is a nop in x86-64 and can be encoded as such. Without this
757 // we emit an unneeded REX.w prefix.
758 def : InstAlias<"xchg{q}\t{%rax, %rax|rax, rax}", (NOOP), 0>;
760 // These aliases exist to get the parser to prioritize matching 8-bit
761 // immediate encodings over matching the implicit ax/eax/rax encodings. By
762 // explicitly mentioning the A register here, these entries will be ordered
763 // first due to the more explicit immediate type.
764 def : InstAlias<"adc{w}\t{$imm, %ax|ax, $imm}", (ADC16ri8 AX, i16i8imm:$imm), 0>;
765 def : InstAlias<"add{w}\t{$imm, %ax|ax, $imm}", (ADD16ri8 AX, i16i8imm:$imm), 0>;
766 def : InstAlias<"and{w}\t{$imm, %ax|ax, $imm}", (AND16ri8 AX, i16i8imm:$imm), 0>;
767 def : InstAlias<"cmp{w}\t{$imm, %ax|ax, $imm}", (CMP16ri8 AX, i16i8imm:$imm), 0>;
768 def : InstAlias<"or{w}\t{$imm, %ax|ax, $imm}", (OR16ri8 AX, i16i8imm:$imm), 0>;
769 def : InstAlias<"sbb{w}\t{$imm, %ax|ax, $imm}", (SBB16ri8 AX, i16i8imm:$imm), 0>;
770 def : InstAlias<"sub{w}\t{$imm, %ax|ax, $imm}", (SUB16ri8 AX, i16i8imm:$imm), 0>;
771 def : InstAlias<"xor{w}\t{$imm, %ax|ax, $imm}", (XOR16ri8 AX, i16i8imm:$imm), 0>;
773 def : InstAlias<"adc{l}\t{$imm, %eax|eax, $imm}", (ADC32ri8 EAX, i32i8imm:$imm), 0>;
774 def : InstAlias<"add{l}\t{$imm, %eax|eax, $imm}", (ADD32ri8 EAX, i32i8imm:$imm), 0>;
775 def : InstAlias<"and{l}\t{$imm, %eax|eax, $imm}", (AND32ri8 EAX, i32i8imm:$imm), 0>;
776 def : InstAlias<"cmp{l}\t{$imm, %eax|eax, $imm}", (CMP32ri8 EAX, i32i8imm:$imm), 0>;
777 def : InstAlias<"or{l}\t{$imm, %eax|eax, $imm}", (OR32ri8 EAX, i32i8imm:$imm), 0>;
778 def : InstAlias<"sbb{l}\t{$imm, %eax|eax, $imm}", (SBB32ri8 EAX, i32i8imm:$imm), 0>;
779 def : InstAlias<"sub{l}\t{$imm, %eax|eax, $imm}", (SUB32ri8 EAX, i32i8imm:$imm), 0>;
780 def : InstAlias<"xor{l}\t{$imm, %eax|eax, $imm}", (XOR32ri8 EAX, i32i8imm:$imm), 0>;
782 def : InstAlias<"adc{q}\t{$imm, %rax|rax, $imm}", (ADC64ri8 RAX, i64i8imm:$imm), 0>;
783 def : InstAlias<"add{q}\t{$imm, %rax|rax, $imm}", (ADD64ri8 RAX, i64i8imm:$imm), 0>;
784 def : InstAlias<"and{q}\t{$imm, %rax|rax, $imm}", (AND64ri8 RAX, i64i8imm:$imm), 0>;
785 def : InstAlias<"cmp{q}\t{$imm, %rax|rax, $imm}", (CMP64ri8 RAX, i64i8imm:$imm), 0>;
786 def : InstAlias<"or{q}\t{$imm, %rax|rax, $imm}", (OR64ri8 RAX, i64i8imm:$imm), 0>;
787 def : InstAlias<"sbb{q}\t{$imm, %rax|rax, $imm}", (SBB64ri8 RAX, i64i8imm:$imm), 0>;
788 def : InstAlias<"sub{q}\t{$imm, %rax|rax, $imm}", (SUB64ri8 RAX, i64i8imm:$imm), 0>;
789 def : InstAlias<"xor{q}\t{$imm, %rax|rax, $imm}", (XOR64ri8 RAX, i64i8imm:$imm), 0>;
792 def : InstAlias<"movq.s\t{$src, $dst|$dst, $src}",
793 (MMX_MOVQ64rr_REV VR64:$dst, VR64:$src), 0>;
795 // CMOV SETCC SETZUCC Aliases
796 multiclass CMOV_SETCC_Aliases<string Cond, int CC> {
797 def : InstAlias<"cmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
798 (CMOV16rr GR16:$dst, GR16:$src, CC), 0>;
799 def : InstAlias<"cmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
800 (CMOV16rm GR16:$dst, i16mem:$src, CC), 0>;
801 def : InstAlias<"cmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
802 (CMOV32rr GR32:$dst, GR32:$src, CC), 0>;
803 def : InstAlias<"cmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
804 (CMOV32rm GR32:$dst, i32mem:$src, CC), 0>;
805 def : InstAlias<"cmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
806 (CMOV64rr GR64:$dst, GR64:$src, CC), 0>;
807 def : InstAlias<"cmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
808 (CMOV64rm GR64:$dst, i64mem:$src, CC), 0>;
809 let Predicates = [In64BitMode] in {
810 def : InstAlias<"cmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
811 (CMOV16rr_ND GR16:$dst, GR16:$src1, GR16:$src2, CC), 0>;
812 def : InstAlias<"cmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
813 (CMOV16rm_ND GR16:$dst, GR16:$src1, i16mem:$src2, CC), 0>;
814 def : InstAlias<"cmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
815 (CMOV32rr_ND GR32:$dst, GR32:$src1, GR32:$src2, CC), 0>;
816 def : InstAlias<"cmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
817 (CMOV32rm_ND GR32:$dst, GR32:$src1, i32mem:$src2, CC), 0>;
818 def : InstAlias<"cmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
819 (CMOV64rr_ND GR64:$dst, GR64:$src1, GR64:$src2, CC), 0>;
820 def : InstAlias<"cmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
821 (CMOV64rm_ND GR64:$dst, GR64:$src1, i64mem:$src2, CC), 0>;
823 def : InstAlias<"setzu"#Cond#"\t$dst", (SETZUCCr GR8:$dst, CC), 0>;
824 def : InstAlias<"setzu"#Cond#"\t$dst", (SETZUCCm i8mem:$dst, CC), 0>;
825 def : InstAlias<"set"#Cond#"\t$dst", (SETCCr_EVEX GR8:$dst, CC), 0>;
826 def : InstAlias<"set"#Cond#"\t$dst", (SETCCm_EVEX i8mem:$dst, CC), 0>;
828 def : InstAlias<"set"#Cond#"\t$dst", (SETCCr GR8:$dst, CC), 0>;
829 def : InstAlias<"set"#Cond#"\t$dst", (SETCCm i8mem:$dst, CC), 0>;
832 defm : CMOV_SETCC_Aliases<"o" , 0>;
833 defm : CMOV_SETCC_Aliases<"no", 1>;
834 defm : CMOV_SETCC_Aliases<"b" , 2>;
835 defm : CMOV_SETCC_Aliases<"ae", 3>;
836 defm : CMOV_SETCC_Aliases<"e" , 4>;
837 defm : CMOV_SETCC_Aliases<"ne", 5>;
838 defm : CMOV_SETCC_Aliases<"be", 6>;
839 defm : CMOV_SETCC_Aliases<"a" , 7>;
840 defm : CMOV_SETCC_Aliases<"s" , 8>;
841 defm : CMOV_SETCC_Aliases<"ns", 9>;
842 defm : CMOV_SETCC_Aliases<"p" , 10>;
843 defm : CMOV_SETCC_Aliases<"np", 11>;
844 defm : CMOV_SETCC_Aliases<"l" , 12>;
845 defm : CMOV_SETCC_Aliases<"ge", 13>;
846 defm : CMOV_SETCC_Aliases<"le", 14>;
847 defm : CMOV_SETCC_Aliases<"g" , 15>;
849 multiclass CFCMOV_Aliases<string Cond, int CC> {
850 let Predicates = [In64BitMode] in {
851 def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
852 (CFCMOV16rr GR16:$dst, GR16:$src, CC), 0>;
853 def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
854 (CFCMOV32rr GR32:$dst, GR32:$src, CC), 0>;
855 def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
856 (CFCMOV64rr GR64:$dst, GR64:$src, CC), 0>;
857 def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
858 (CFCMOV16rm GR16:$dst, i16mem:$src, CC), 0>;
859 def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
860 (CFCMOV32rm GR32:$dst, i32mem:$src, CC), 0>;
861 def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
862 (CFCMOV64rm GR64:$dst, i64mem:$src, CC), 0>;
863 def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
864 (CFCMOV16mr i16mem:$dst, GR16:$src, CC), 0>;
865 def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
866 (CFCMOV32mr i32mem:$dst, GR32:$src, CC), 0>;
867 def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
868 (CFCMOV64mr i64mem:$dst, GR64:$src, CC), 0>;
869 def : InstAlias<"cfcmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
870 (CFCMOV16rr_ND GR16:$dst, GR16:$src1, GR16:$src2, CC), 0>;
871 def : InstAlias<"cfcmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
872 (CFCMOV32rr_ND GR32:$dst, GR32:$src1, GR32:$src2, CC), 0>;
873 def : InstAlias<"cfcmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
874 (CFCMOV64rr_ND GR64:$dst, GR64:$src1, GR64:$src2, CC), 0>;
875 def : InstAlias<"cfcmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
876 (CFCMOV16rm_ND GR16:$dst, GR16:$src1, i16mem:$src2, CC), 0>;
877 def : InstAlias<"cfcmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
878 (CFCMOV32rm_ND GR32:$dst, GR32:$src1, i32mem:$src2, CC), 0>;
879 def : InstAlias<"cfcmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
880 (CFCMOV64rm_ND GR64:$dst, GR64:$src1, i64mem:$src2, CC), 0>;
883 defm : CFCMOV_Aliases<"o" , 0>;
884 defm : CFCMOV_Aliases<"no", 1>;
885 defm : CFCMOV_Aliases<"b" , 2>;
886 defm : CFCMOV_Aliases<"ae", 3>;
887 defm : CFCMOV_Aliases<"e" , 4>;
888 defm : CFCMOV_Aliases<"ne", 5>;
889 defm : CFCMOV_Aliases<"be", 6>;
890 defm : CFCMOV_Aliases<"a" , 7>;
891 defm : CFCMOV_Aliases<"s" , 8>;
892 defm : CFCMOV_Aliases<"ns", 9>;
893 defm : CFCMOV_Aliases<"p" , 10>;
894 defm : CFCMOV_Aliases<"np", 11>;
895 defm : CFCMOV_Aliases<"l" , 12>;
896 defm : CFCMOV_Aliases<"ge", 13>;
897 defm : CFCMOV_Aliases<"le", 14>;
898 defm : CFCMOV_Aliases<"g" , 15>;
900 // Condition dump instructions Alias
901 def : InstAlias<"jo\t$dst", (JCC_1 brtarget8:$dst, 0), 0>;
902 def : InstAlias<"jno\t$dst", (JCC_1 brtarget8:$dst, 1), 0>;
903 def : InstAlias<"jb\t$dst", (JCC_1 brtarget8:$dst, 2), 0>;
904 def : InstAlias<"jae\t$dst", (JCC_1 brtarget8:$dst, 3), 0>;
905 def : InstAlias<"je\t$dst", (JCC_1 brtarget8:$dst, 4), 0>;
906 def : InstAlias<"jne\t$dst", (JCC_1 brtarget8:$dst, 5), 0>;
907 def : InstAlias<"jbe\t$dst", (JCC_1 brtarget8:$dst, 6), 0>;
908 def : InstAlias<"ja\t$dst", (JCC_1 brtarget8:$dst, 7), 0>;
909 def : InstAlias<"js\t$dst", (JCC_1 brtarget8:$dst, 8), 0>;
910 def : InstAlias<"jns\t$dst", (JCC_1 brtarget8:$dst, 9), 0>;
911 def : InstAlias<"jp\t$dst", (JCC_1 brtarget8:$dst, 10), 0>;
912 def : InstAlias<"jnp\t$dst", (JCC_1 brtarget8:$dst, 11), 0>;
913 def : InstAlias<"jl\t$dst", (JCC_1 brtarget8:$dst, 12), 0>;
914 def : InstAlias<"jge\t$dst", (JCC_1 brtarget8:$dst, 13), 0>;
915 def : InstAlias<"jle\t$dst", (JCC_1 brtarget8:$dst, 14), 0>;
916 def : InstAlias<"jg\t$dst", (JCC_1 brtarget8:$dst, 15), 0>;
918 // SVM instructions Alias
919 def : InstAlias<"skinit\t{%eax|eax}", (SKINIT), 0>;
920 def : InstAlias<"vmrun\t{%eax|eax}", (VMRUN32), 0>, Requires<[Not64BitMode]>;
921 def : InstAlias<"vmrun\t{%rax|rax}", (VMRUN64), 0>, Requires<[In64BitMode]>;
922 def : InstAlias<"vmload\t{%eax|eax}", (VMLOAD32), 0>, Requires<[Not64BitMode]>;
923 def : InstAlias<"vmload\t{%rax|rax}", (VMLOAD64), 0>, Requires<[In64BitMode]>;
924 def : InstAlias<"vmsave\t{%eax|eax}", (VMSAVE32), 0>, Requires<[Not64BitMode]>;
925 def : InstAlias<"vmsave\t{%rax|rax}", (VMSAVE64), 0>, Requires<[In64BitMode]>;
926 def : InstAlias<"invlpga\t{%eax, %ecx|eax, ecx}", (INVLPGA32), 0>, Requires<[Not64BitMode]>;
927 def : InstAlias<"invlpga\t{%rax, %ecx|rax, ecx}", (INVLPGA64), 0>, Requires<[In64BitMode]>;
929 // Aliases with explicit %xmm0
930 def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
931 (SHA256RNDS2rr VR128:$dst, VR128:$src2), 0>;
932 def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
933 (SHA256RNDS2rm VR128:$dst, i128mem:$src2), 0>;