xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
106c3fb27SDimitry Andric//==- X86InstrAsmAlias.td - Assembler Instruction Aliases --*- tablegen -*-===//
206c3fb27SDimitry Andric//
306c3fb27SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
406c3fb27SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
506c3fb27SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
606c3fb27SDimitry Andric//
706c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
806c3fb27SDimitry Andric//
906c3fb27SDimitry Andric// This file describes the assembler mnemonic/instruction aliases in the X86
1006c3fb27SDimitry Andric// architecture.
1106c3fb27SDimitry Andric//
1206c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
1306c3fb27SDimitry Andric
1406c3fb27SDimitry Andric// Reversed version with ".s" suffix for GAS compatibility.
1506c3fb27SDimitry Andricdef : InstAlias<"mov{b}.s\t{$src, $dst|$dst, $src}",
1606c3fb27SDimitry Andric                (MOV8rr_REV GR8:$dst, GR8:$src), 0>;
1706c3fb27SDimitry Andricdef : InstAlias<"mov{w}.s\t{$src, $dst|$dst, $src}",
1806c3fb27SDimitry Andric                (MOV16rr_REV GR16:$dst, GR16:$src), 0>;
1906c3fb27SDimitry Andricdef : InstAlias<"mov{l}.s\t{$src, $dst|$dst, $src}",
2006c3fb27SDimitry Andric                (MOV32rr_REV GR32:$dst, GR32:$src), 0>;
2106c3fb27SDimitry Andricdef : InstAlias<"mov{q}.s\t{$src, $dst|$dst, $src}",
2206c3fb27SDimitry Andric                (MOV64rr_REV GR64:$dst, GR64:$src), 0>;
2306c3fb27SDimitry Andricdef : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
2406c3fb27SDimitry Andric                (MOV8rr_REV GR8:$dst, GR8:$src), 0, "att">;
2506c3fb27SDimitry Andricdef : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
2606c3fb27SDimitry Andric                (MOV16rr_REV GR16:$dst, GR16:$src), 0, "att">;
2706c3fb27SDimitry Andricdef : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
2806c3fb27SDimitry Andric                (MOV32rr_REV GR32:$dst, GR32:$src), 0, "att">;
2906c3fb27SDimitry Andricdef : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
3006c3fb27SDimitry Andric                (MOV64rr_REV GR64:$dst, GR64:$src), 0, "att">;
3106c3fb27SDimitry Andric
3206c3fb27SDimitry Andric// MONITORX/MWAITX Instructions Alias
3306c3fb27SDimitry Andricdef : InstAlias<"mwaitx\t{%eax, %ecx, %ebx|ebx, ecx, eax}", (MWAITXrrr)>,
3406c3fb27SDimitry Andric      Requires<[ Not64BitMode ]>;
3506c3fb27SDimitry Andricdef : InstAlias<"mwaitx\t{%rax, %rcx, %rbx|rbx, rcx, rax}", (MWAITXrrr)>,
3606c3fb27SDimitry Andric      Requires<[ In64BitMode ]>;
3706c3fb27SDimitry Andric
3806c3fb27SDimitry Andric// MONITORX/MWAITX Instructions Alias
3906c3fb27SDimitry Andricdef : InstAlias<"monitorx\t{%eax, %ecx, %edx|edx, ecx, eax}", (MONITORX32rrr)>,
4006c3fb27SDimitry Andric      Requires<[ Not64BitMode ]>;
4106c3fb27SDimitry Andricdef : InstAlias<"monitorx\t{%rax, %rcx, %rdx|rdx, rcx, rax}", (MONITORX64rrr)>,
4206c3fb27SDimitry Andric      Requires<[ In64BitMode ]>;
4306c3fb27SDimitry Andric
4406c3fb27SDimitry Andric// CLZERO Instruction Alias
4506c3fb27SDimitry Andricdef : InstAlias<"clzero\t{%eax|eax}", (CLZERO32r)>, Requires<[Not64BitMode]>;
4606c3fb27SDimitry Andricdef : InstAlias<"clzero\t{%rax|rax}", (CLZERO64r)>, Requires<[In64BitMode]>;
4706c3fb27SDimitry Andric
4806c3fb27SDimitry Andric// INVLPGB Instruction Alias
4906c3fb27SDimitry Andricdef : InstAlias<"invlpgb\t{%eax, %edx|eax, edx}", (INVLPGB32)>, Requires<[Not64BitMode]>;
5006c3fb27SDimitry Andricdef : InstAlias<"invlpgb\t{%rax, %edx|rax, edx}", (INVLPGB64)>, Requires<[In64BitMode]>;
5106c3fb27SDimitry Andric
5206c3fb27SDimitry Andric// CMPCCXADD Instructions Alias
5306c3fb27SDimitry Andricmulticlass CMPCCXADD_Aliases<string Cond, int CC> {
54*0fca6ea1SDimitry Andric  let Predicates = [In64BitMode] in {
5506c3fb27SDimitry Andric    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
5606c3fb27SDimitry Andric                    (CMPCCXADDmr32 GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
5706c3fb27SDimitry Andric    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
5806c3fb27SDimitry Andric                    (CMPCCXADDmr64 GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
59cb14a3feSDimitry Andric
60cb14a3feSDimitry Andric    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
61cb14a3feSDimitry Andric                    (CMPCCXADDmr32_EVEX GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
62cb14a3feSDimitry Andric    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
63cb14a3feSDimitry Andric                    (CMPCCXADDmr64_EVEX GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
6406c3fb27SDimitry Andric  }
65*0fca6ea1SDimitry Andric}
66*0fca6ea1SDimitry Andric
67*0fca6ea1SDimitry Andric// CCMP Instructions Alias
68*0fca6ea1SDimitry Andricmulticlass CCMP_Aliases<string Cond, int CC> {
69*0fca6ea1SDimitry Andriclet Predicates = [In64BitMode] in {
70*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
71*0fca6ea1SDimitry Andric                (CCMP8rr  GR8:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
72*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
73*0fca6ea1SDimitry Andric                (CCMP16rr GR16:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
74*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
75*0fca6ea1SDimitry Andric                (CCMP32rr GR32:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
76*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
77*0fca6ea1SDimitry Andric                (CCMP64rr GR64:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
78*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
79*0fca6ea1SDimitry Andric                (CCMP8rm  GR8:$src1,  i8mem:$src2,  cflags:$dcf, CC), 0>;
80*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
81*0fca6ea1SDimitry Andric                (CCMP16rm GR16:$src1, i16mem:$src2, cflags:$dcf, CC), 0>;
82*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
83*0fca6ea1SDimitry Andric                (CCMP32rm GR32:$src1, i32mem:$src2, cflags:$dcf, CC), 0>;
84*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
85*0fca6ea1SDimitry Andric                (CCMP64rm GR64:$src1, i64mem:$src2, cflags:$dcf, CC), 0>;
86*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
87*0fca6ea1SDimitry Andric                (CCMP8mr  i8mem:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
88*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
89*0fca6ea1SDimitry Andric                (CCMP16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
90*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
91*0fca6ea1SDimitry Andric                (CCMP32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
92*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
93*0fca6ea1SDimitry Andric                (CCMP64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
94*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
95*0fca6ea1SDimitry Andric                (CCMP8ri  GR8:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
96*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
97*0fca6ea1SDimitry Andric                (CCMP16ri GR16:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
98*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
99*0fca6ea1SDimitry Andric                (CCMP32ri GR32:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
100*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
101*0fca6ea1SDimitry Andric                (CCMP64ri32 GR64:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
102*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
103*0fca6ea1SDimitry Andric                (CCMP16ri8 GR16:$src1, i16i8imm:$src2, cflags:$dcf, CC), 0>;
104*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
105*0fca6ea1SDimitry Andric                (CCMP32ri8 GR32:$src1, i32i8imm:$src2, cflags:$dcf, CC), 0>;
106*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
107*0fca6ea1SDimitry Andric                (CCMP64ri8 GR64:$src1, i64i8imm:$src2, cflags:$dcf, CC), 0>;
108*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
109*0fca6ea1SDimitry Andric                (CCMP8mi  i8mem:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
110*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
111*0fca6ea1SDimitry Andric                (CCMP16mi i16mem:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
112*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
113*0fca6ea1SDimitry Andric                (CCMP32mi i32mem:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
114*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
115*0fca6ea1SDimitry Andric                (CCMP64mi32 i64mem:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
116*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
117*0fca6ea1SDimitry Andric                (CCMP16mi8 i16mem:$src1, i16i8imm:$src2, cflags:$dcf, CC), 0>;
118*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
119*0fca6ea1SDimitry Andric                (CCMP32mi8 i32mem:$src1, i32i8imm:$src2, cflags:$dcf, CC), 0>;
120*0fca6ea1SDimitry Andricdef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
121*0fca6ea1SDimitry Andric                (CCMP64mi8 i64mem:$src1, i64i8imm:$src2, cflags:$dcf, CC), 0>;
122*0fca6ea1SDimitry Andric}
123*0fca6ea1SDimitry Andric}
124*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"o" ,  0>;
125*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"no",  1>;
126*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"b" ,  2>;
127*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"ae",  3>;
128*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"e" ,  4>;
129*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"ne",  5>;
130*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"be",  6>;
131*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"a" ,  7>;
132*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"s" ,  8>;
133*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"ns",  9>;
134*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"t" , 10>;
135*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"f", 11>;
136*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"l" , 12>;
137*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"ge", 13>;
138*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"le", 14>;
139*0fca6ea1SDimitry Andricdefm : CCMP_Aliases<"g" , 15>;
140*0fca6ea1SDimitry Andric
141*0fca6ea1SDimitry Andric// CTEST Instructions Alias
142*0fca6ea1SDimitry Andricmulticlass CTEST_Aliases<string Cond, int CC> {
143*0fca6ea1SDimitry Andriclet Predicates = [In64BitMode] in {
144*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
145*0fca6ea1SDimitry Andric                (CTEST8rr  GR8:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
146*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
147*0fca6ea1SDimitry Andric                (CTEST16rr GR16:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
148*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
149*0fca6ea1SDimitry Andric                (CTEST32rr GR32:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
150*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
151*0fca6ea1SDimitry Andric                (CTEST64rr GR64:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
152*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
153*0fca6ea1SDimitry Andric                (CTEST8mr  i8mem:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
154*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
155*0fca6ea1SDimitry Andric                (CTEST16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
156*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
157*0fca6ea1SDimitry Andric                (CTEST32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
158*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
159*0fca6ea1SDimitry Andric                (CTEST64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
160*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
161*0fca6ea1SDimitry Andric                (CTEST8ri  GR8:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
162*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
163*0fca6ea1SDimitry Andric                (CTEST16ri GR16:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
164*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
165*0fca6ea1SDimitry Andric                (CTEST32ri GR32:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
166*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
167*0fca6ea1SDimitry Andric                (CTEST64ri32 GR64:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
168*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
169*0fca6ea1SDimitry Andric                (CTEST8mi  i8mem:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
170*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
171*0fca6ea1SDimitry Andric                (CTEST16mi i16mem:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
172*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
173*0fca6ea1SDimitry Andric                (CTEST32mi i32mem:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
174*0fca6ea1SDimitry Andricdef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
175*0fca6ea1SDimitry Andric                (CTEST64mi32 i64mem:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
176*0fca6ea1SDimitry Andric}
177*0fca6ea1SDimitry Andric}
178*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"o" ,  0>;
179*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"no",  1>;
180*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"b" ,  2>;
181*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"ae",  3>;
182*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"e" ,  4>;
183*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"ne",  5>;
184*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"be",  6>;
185*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"a" ,  7>;
186*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"s" ,  8>;
187*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"ns",  9>;
188*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"t" , 10>;
189*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"f", 11>;
190*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"l" , 12>;
191*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"ge", 13>;
192*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"le", 14>;
193*0fca6ea1SDimitry Andricdefm : CTEST_Aliases<"g" , 15>;
19406c3fb27SDimitry Andric
19506c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
19606c3fb27SDimitry Andric// Assembler Mnemonic Aliases
19706c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
19806c3fb27SDimitry Andric
19906c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"o" ,  0>;
20006c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"no",  1>;
20106c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"b" ,  2>;
20206c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"ae",  3>;
20306c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"nb",  3>;
20406c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"e" ,  4>;
20506c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"z" ,  4>;
20606c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"ne",  5>;
20706c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"nz",  5>;
20806c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"be",  6>;
20906c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"nbe", 7>;
21006c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"a",   7>;
21106c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"s" ,  8>;
21206c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"ns",  9>;
21306c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"p" , 10>;
21406c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"np", 11>;
21506c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"l" , 12>;
21606c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"ge", 13>;
21706c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"nl", 13>;
21806c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"le", 14>;
21906c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"g",  15>;
22006c3fb27SDimitry Andricdefm : CMPCCXADD_Aliases<"nle",15>;
22106c3fb27SDimitry Andric
22206c3fb27SDimitry Andric
22306c3fb27SDimitry Andricdef : MnemonicAlias<"call", "callw", "att">, Requires<[In16BitMode]>;
22406c3fb27SDimitry Andricdef : MnemonicAlias<"call", "calll", "att">, Requires<[In32BitMode]>;
22506c3fb27SDimitry Andricdef : MnemonicAlias<"call", "callq", "att">, Requires<[In64BitMode]>;
22606c3fb27SDimitry Andric
22706c3fb27SDimitry Andricdef : MnemonicAlias<"cbw",  "cbtw", "att">;
22806c3fb27SDimitry Andricdef : MnemonicAlias<"cwde", "cwtl", "att">;
22906c3fb27SDimitry Andricdef : MnemonicAlias<"cwd",  "cwtd", "att">;
23006c3fb27SDimitry Andricdef : MnemonicAlias<"cdq",  "cltd", "att">;
23106c3fb27SDimitry Andricdef : MnemonicAlias<"cdqe", "cltq", "att">;
23206c3fb27SDimitry Andricdef : MnemonicAlias<"cqo",  "cqto", "att">;
23306c3fb27SDimitry Andric
23406c3fb27SDimitry Andric// In 64-bit mode lret maps to lretl; it is not ambiguous with lretq.
23506c3fb27SDimitry Andricdef : MnemonicAlias<"lret", "lretw", "att">, Requires<[In16BitMode]>;
23606c3fb27SDimitry Andricdef : MnemonicAlias<"lret", "lretl", "att">, Requires<[Not16BitMode]>;
23706c3fb27SDimitry Andric
23806c3fb27SDimitry Andricdef : MnemonicAlias<"leavel", "leave", "att">, Requires<[Not64BitMode]>;
23906c3fb27SDimitry Andricdef : MnemonicAlias<"leaveq", "leave", "att">, Requires<[In64BitMode]>;
24006c3fb27SDimitry Andric
24106c3fb27SDimitry Andricdef : MnemonicAlias<"loopz",  "loope">;
24206c3fb27SDimitry Andricdef : MnemonicAlias<"loopnz", "loopne">;
24306c3fb27SDimitry Andric
24406c3fb27SDimitry Andricdef : MnemonicAlias<"pop",   "popw",  "att">, Requires<[In16BitMode]>;
24506c3fb27SDimitry Andricdef : MnemonicAlias<"pop",   "popl",  "att">, Requires<[In32BitMode]>;
24606c3fb27SDimitry Andricdef : MnemonicAlias<"pop",   "popq",  "att">, Requires<[In64BitMode]>;
24706c3fb27SDimitry Andricdef : MnemonicAlias<"popf",  "popfw", "att">, Requires<[In16BitMode]>;
24806c3fb27SDimitry Andricdef : MnemonicAlias<"popf",  "popfl", "att">, Requires<[In32BitMode]>;
24906c3fb27SDimitry Andricdef : MnemonicAlias<"popf",  "popfq", "att">, Requires<[In64BitMode]>;
25006c3fb27SDimitry Andricdef : MnemonicAlias<"popf",  "popfq", "intel">, Requires<[In64BitMode]>;
25106c3fb27SDimitry Andricdef : MnemonicAlias<"popfd", "popfl", "att">;
25206c3fb27SDimitry Andricdef : MnemonicAlias<"popfw", "popf",  "intel">, Requires<[In32BitMode]>;
25306c3fb27SDimitry Andricdef : MnemonicAlias<"popfw", "popf",  "intel">, Requires<[In64BitMode]>;
25406c3fb27SDimitry Andric
25506c3fb27SDimitry Andric// FIXME: This is wrong for "push reg".  "push %bx" should turn into pushw in
25606c3fb27SDimitry Andric// all modes.  However: "push (addr)" and "push $42" should default to
25706c3fb27SDimitry Andric// pushl/pushq depending on the current mode.  Similar for "pop %bx"
25806c3fb27SDimitry Andricdef : MnemonicAlias<"push",   "pushw",  "att">, Requires<[In16BitMode]>;
25906c3fb27SDimitry Andricdef : MnemonicAlias<"push",   "pushl",  "att">, Requires<[In32BitMode]>;
26006c3fb27SDimitry Andricdef : MnemonicAlias<"push",   "pushq",  "att">, Requires<[In64BitMode]>;
26106c3fb27SDimitry Andricdef : MnemonicAlias<"pushf",  "pushfw", "att">, Requires<[In16BitMode]>;
26206c3fb27SDimitry Andricdef : MnemonicAlias<"pushf",  "pushfl", "att">, Requires<[In32BitMode]>;
26306c3fb27SDimitry Andricdef : MnemonicAlias<"pushf",  "pushfq", "att">, Requires<[In64BitMode]>;
26406c3fb27SDimitry Andricdef : MnemonicAlias<"pushf",  "pushfq", "intel">, Requires<[In64BitMode]>;
26506c3fb27SDimitry Andricdef : MnemonicAlias<"pushfd", "pushfl", "att">;
26606c3fb27SDimitry Andricdef : MnemonicAlias<"pushfw", "pushf",  "intel">, Requires<[In32BitMode]>;
26706c3fb27SDimitry Andricdef : MnemonicAlias<"pushfw", "pushf",  "intel">, Requires<[In64BitMode]>;
26806c3fb27SDimitry Andric
26906c3fb27SDimitry Andricdef : MnemonicAlias<"popad",  "popal",  "intel">, Requires<[Not64BitMode]>;
27006c3fb27SDimitry Andricdef : MnemonicAlias<"pushad", "pushal", "intel">, Requires<[Not64BitMode]>;
27106c3fb27SDimitry Andricdef : MnemonicAlias<"popa",   "popaw",  "intel">, Requires<[In16BitMode]>;
27206c3fb27SDimitry Andricdef : MnemonicAlias<"pusha",  "pushaw", "intel">, Requires<[In16BitMode]>;
27306c3fb27SDimitry Andricdef : MnemonicAlias<"popa",   "popal",  "intel">, Requires<[In32BitMode]>;
27406c3fb27SDimitry Andricdef : MnemonicAlias<"pusha",  "pushal", "intel">, Requires<[In32BitMode]>;
27506c3fb27SDimitry Andric
27606c3fb27SDimitry Andricdef : MnemonicAlias<"popa",   "popaw",  "att">, Requires<[In16BitMode]>;
27706c3fb27SDimitry Andricdef : MnemonicAlias<"pusha",  "pushaw", "att">, Requires<[In16BitMode]>;
27806c3fb27SDimitry Andricdef : MnemonicAlias<"popa",   "popal",  "att">, Requires<[In32BitMode]>;
27906c3fb27SDimitry Andricdef : MnemonicAlias<"pusha",  "pushal", "att">, Requires<[In32BitMode]>;
28006c3fb27SDimitry Andric
28106c3fb27SDimitry Andricdef : MnemonicAlias<"repe",  "rep">;
28206c3fb27SDimitry Andricdef : MnemonicAlias<"repz",  "rep">;
28306c3fb27SDimitry Andricdef : MnemonicAlias<"repnz", "repne">;
28406c3fb27SDimitry Andric
28506c3fb27SDimitry Andricdef : MnemonicAlias<"ret", "retw", "att">, Requires<[In16BitMode]>;
28606c3fb27SDimitry Andricdef : MnemonicAlias<"ret", "retl", "att">, Requires<[In32BitMode]>;
28706c3fb27SDimitry Andricdef : MnemonicAlias<"ret", "retq", "att">, Requires<[In64BitMode]>;
28806c3fb27SDimitry Andric
28906c3fb27SDimitry Andric// Apply 'ret' behavior to 'retn'
29006c3fb27SDimitry Andricdef : MnemonicAlias<"retn", "retw", "att">, Requires<[In16BitMode]>;
29106c3fb27SDimitry Andricdef : MnemonicAlias<"retn", "retl", "att">, Requires<[In32BitMode]>;
29206c3fb27SDimitry Andricdef : MnemonicAlias<"retn", "retq", "att">, Requires<[In64BitMode]>;
29306c3fb27SDimitry Andricdef : MnemonicAlias<"retn", "ret", "intel">;
29406c3fb27SDimitry Andric
29506c3fb27SDimitry Andricdef : MnemonicAlias<"sal", "shl", "intel">;
29606c3fb27SDimitry Andricdef : MnemonicAlias<"salb", "shlb", "att">;
29706c3fb27SDimitry Andricdef : MnemonicAlias<"salw", "shlw", "att">;
29806c3fb27SDimitry Andricdef : MnemonicAlias<"sall", "shll", "att">;
29906c3fb27SDimitry Andricdef : MnemonicAlias<"salq", "shlq", "att">;
30006c3fb27SDimitry Andric
30106c3fb27SDimitry Andricdef : MnemonicAlias<"smovb", "movsb", "att">;
30206c3fb27SDimitry Andricdef : MnemonicAlias<"smovw", "movsw", "att">;
30306c3fb27SDimitry Andricdef : MnemonicAlias<"smovl", "movsl", "att">;
30406c3fb27SDimitry Andricdef : MnemonicAlias<"smovq", "movsq", "att">;
30506c3fb27SDimitry Andric
30606c3fb27SDimitry Andricdef : MnemonicAlias<"ud2a",  "ud2",  "att">;
30706c3fb27SDimitry Andricdef : MnemonicAlias<"ud2bw", "ud1w", "att">;
30806c3fb27SDimitry Andricdef : MnemonicAlias<"ud2bl", "ud1l", "att">;
30906c3fb27SDimitry Andricdef : MnemonicAlias<"ud2bq", "ud1q", "att">;
31006c3fb27SDimitry Andricdef : MnemonicAlias<"verrw", "verr", "att">;
31106c3fb27SDimitry Andric
31206c3fb27SDimitry Andric// MS recognizes 'xacquire'/'xrelease' as 'acquire'/'release'
31306c3fb27SDimitry Andricdef : MnemonicAlias<"acquire", "xacquire", "intel">;
31406c3fb27SDimitry Andricdef : MnemonicAlias<"release", "xrelease", "intel">;
31506c3fb27SDimitry Andric
31606c3fb27SDimitry Andric// System instruction aliases.
31706c3fb27SDimitry Andricdef : MnemonicAlias<"iret",    "iretw",    "att">, Requires<[In16BitMode]>;
31806c3fb27SDimitry Andricdef : MnemonicAlias<"iret",    "iretl",    "att">, Requires<[Not16BitMode]>;
31906c3fb27SDimitry Andricdef : MnemonicAlias<"sysret",  "sysretl",  "att">;
32006c3fb27SDimitry Andricdef : MnemonicAlias<"sysexit", "sysexitl", "att">;
32106c3fb27SDimitry Andric
32206c3fb27SDimitry Andricdef : MnemonicAlias<"lgdt", "lgdtw", "att">, Requires<[In16BitMode]>;
32306c3fb27SDimitry Andricdef : MnemonicAlias<"lgdt", "lgdtl", "att">, Requires<[In32BitMode]>;
32406c3fb27SDimitry Andricdef : MnemonicAlias<"lgdt", "lgdtq", "att">, Requires<[In64BitMode]>;
32506c3fb27SDimitry Andricdef : MnemonicAlias<"lidt", "lidtw", "att">, Requires<[In16BitMode]>;
32606c3fb27SDimitry Andricdef : MnemonicAlias<"lidt", "lidtl", "att">, Requires<[In32BitMode]>;
32706c3fb27SDimitry Andricdef : MnemonicAlias<"lidt", "lidtq", "att">, Requires<[In64BitMode]>;
32806c3fb27SDimitry Andricdef : MnemonicAlias<"sgdt", "sgdtw", "att">, Requires<[In16BitMode]>;
32906c3fb27SDimitry Andricdef : MnemonicAlias<"sgdt", "sgdtl", "att">, Requires<[In32BitMode]>;
33006c3fb27SDimitry Andricdef : MnemonicAlias<"sgdt", "sgdtq", "att">, Requires<[In64BitMode]>;
33106c3fb27SDimitry Andricdef : MnemonicAlias<"sidt", "sidtw", "att">, Requires<[In16BitMode]>;
33206c3fb27SDimitry Andricdef : MnemonicAlias<"sidt", "sidtl", "att">, Requires<[In32BitMode]>;
33306c3fb27SDimitry Andricdef : MnemonicAlias<"sidt", "sidtq", "att">, Requires<[In64BitMode]>;
33406c3fb27SDimitry Andricdef : MnemonicAlias<"lgdt", "lgdtw", "intel">, Requires<[In16BitMode]>;
33506c3fb27SDimitry Andricdef : MnemonicAlias<"lgdt", "lgdtd", "intel">, Requires<[In32BitMode]>;
33606c3fb27SDimitry Andricdef : MnemonicAlias<"lidt", "lidtw", "intel">, Requires<[In16BitMode]>;
33706c3fb27SDimitry Andricdef : MnemonicAlias<"lidt", "lidtd", "intel">, Requires<[In32BitMode]>;
33806c3fb27SDimitry Andricdef : MnemonicAlias<"sgdt", "sgdtw", "intel">, Requires<[In16BitMode]>;
33906c3fb27SDimitry Andricdef : MnemonicAlias<"sgdt", "sgdtd", "intel">, Requires<[In32BitMode]>;
34006c3fb27SDimitry Andricdef : MnemonicAlias<"sidt", "sidtw", "intel">, Requires<[In16BitMode]>;
34106c3fb27SDimitry Andricdef : MnemonicAlias<"sidt", "sidtd", "intel">, Requires<[In32BitMode]>;
34206c3fb27SDimitry Andric
34306c3fb27SDimitry Andric
34406c3fb27SDimitry Andric// Floating point stack aliases.
34506c3fb27SDimitry Andricdef : MnemonicAlias<"fcmovz",   "fcmove",   "att">;
34606c3fb27SDimitry Andricdef : MnemonicAlias<"fcmova",   "fcmovnbe", "att">;
34706c3fb27SDimitry Andricdef : MnemonicAlias<"fcmovnae", "fcmovb",   "att">;
34806c3fb27SDimitry Andricdef : MnemonicAlias<"fcmovna",  "fcmovbe",  "att">;
34906c3fb27SDimitry Andricdef : MnemonicAlias<"fcmovae",  "fcmovnb",  "att">;
35006c3fb27SDimitry Andricdef : MnemonicAlias<"fcomip",   "fcompi">;
35106c3fb27SDimitry Andricdef : MnemonicAlias<"fildq",    "fildll",   "att">;
35206c3fb27SDimitry Andricdef : MnemonicAlias<"fistpq",   "fistpll",  "att">;
35306c3fb27SDimitry Andricdef : MnemonicAlias<"fisttpq",  "fisttpll", "att">;
35406c3fb27SDimitry Andricdef : MnemonicAlias<"fldcww",   "fldcw",    "att">;
35506c3fb27SDimitry Andricdef : MnemonicAlias<"fnstcww",  "fnstcw",   "att">;
35606c3fb27SDimitry Andricdef : MnemonicAlias<"fnstsww",  "fnstsw",   "att">;
35706c3fb27SDimitry Andricdef : MnemonicAlias<"fucomip",  "fucompi">;
35806c3fb27SDimitry Andricdef : MnemonicAlias<"fwait",    "wait">;
35906c3fb27SDimitry Andric
36006c3fb27SDimitry Andricdef : MnemonicAlias<"fxsaveq",   "fxsave64",   "att">;
36106c3fb27SDimitry Andricdef : MnemonicAlias<"fxrstorq",  "fxrstor64",  "att">;
36206c3fb27SDimitry Andricdef : MnemonicAlias<"xsaveq",    "xsave64",    "att">;
36306c3fb27SDimitry Andricdef : MnemonicAlias<"xrstorq",   "xrstor64",   "att">;
36406c3fb27SDimitry Andricdef : MnemonicAlias<"xsaveoptq", "xsaveopt64", "att">;
36506c3fb27SDimitry Andricdef : MnemonicAlias<"xrstorsq",  "xrstors64",  "att">;
36606c3fb27SDimitry Andricdef : MnemonicAlias<"xsavecq",   "xsavec64",   "att">;
36706c3fb27SDimitry Andricdef : MnemonicAlias<"xsavesq",   "xsaves64",   "att">;
36806c3fb27SDimitry Andric
36906c3fb27SDimitry Andricclass CondCodeAlias<string Prefix,string Suffix, string OldCond, string NewCond,
37006c3fb27SDimitry Andric                    string VariantName>
37106c3fb27SDimitry Andric  : MnemonicAlias<!strconcat(Prefix, OldCond, Suffix),
37206c3fb27SDimitry Andric                  !strconcat(Prefix, NewCond, Suffix), VariantName>;
37306c3fb27SDimitry Andric
37406c3fb27SDimitry Andric/// IntegerCondCodeMnemonicAlias - This multiclass defines a bunch of
37506c3fb27SDimitry Andric/// MnemonicAlias's that canonicalize the condition code in a mnemonic, for
37606c3fb27SDimitry Andric/// example "setz" -> "sete".
37706c3fb27SDimitry Andricmulticlass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix,
37806c3fb27SDimitry Andric                                        string V = ""> {
37906c3fb27SDimitry Andric  def C   : CondCodeAlias<Prefix, Suffix, "c",   "b",  V>; // setc   -> setb
38006c3fb27SDimitry Andric  def Z   : CondCodeAlias<Prefix, Suffix, "z" ,  "e",  V>; // setz   -> sete
38106c3fb27SDimitry Andric  def NA  : CondCodeAlias<Prefix, Suffix, "na",  "be", V>; // setna  -> setbe
38206c3fb27SDimitry Andric  def NB  : CondCodeAlias<Prefix, Suffix, "nb",  "ae", V>; // setnb  -> setae
38306c3fb27SDimitry Andric  def NC  : CondCodeAlias<Prefix, Suffix, "nc",  "ae", V>; // setnc  -> setae
38406c3fb27SDimitry Andric  def NG  : CondCodeAlias<Prefix, Suffix, "ng",  "le", V>; // setng  -> setle
38506c3fb27SDimitry Andric  def NL  : CondCodeAlias<Prefix, Suffix, "nl",  "ge", V>; // setnl  -> setge
38606c3fb27SDimitry Andric  def NZ  : CondCodeAlias<Prefix, Suffix, "nz",  "ne", V>; // setnz  -> setne
38706c3fb27SDimitry Andric  def PE  : CondCodeAlias<Prefix, Suffix, "pe",  "p",  V>; // setpe  -> setp
38806c3fb27SDimitry Andric  def PO  : CondCodeAlias<Prefix, Suffix, "po",  "np", V>; // setpo  -> setnp
38906c3fb27SDimitry Andric
39006c3fb27SDimitry Andric  def NAE : CondCodeAlias<Prefix, Suffix, "nae", "b",  V>; // setnae -> setb
39106c3fb27SDimitry Andric  def NBE : CondCodeAlias<Prefix, Suffix, "nbe", "a",  V>; // setnbe -> seta
39206c3fb27SDimitry Andric  def NGE : CondCodeAlias<Prefix, Suffix, "nge", "l",  V>; // setnge -> setl
39306c3fb27SDimitry Andric  def NLE : CondCodeAlias<Prefix, Suffix, "nle", "g",  V>; // setnle -> setg
39406c3fb27SDimitry Andric}
39506c3fb27SDimitry Andric
39606c3fb27SDimitry Andric// Aliases for set<CC>
39706c3fb27SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"set", "">;
39806c3fb27SDimitry Andric// Aliases for j<CC>
39906c3fb27SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"j", "">;
40006c3fb27SDimitry Andric// Aliases for cmov<CC>{w,l,q}
40106c3fb27SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cmov", "w", "att">;
40206c3fb27SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cmov", "l", "att">;
40306c3fb27SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cmov", "q", "att">;
40406c3fb27SDimitry Andric// No size suffix for intel-style asm.
40506c3fb27SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cmov", "", "intel">;
40606c3fb27SDimitry Andric
407*0fca6ea1SDimitry Andric// Aliases for cfcmov<CC>{w,l,q}
408*0fca6ea1SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cfcmov", "w", "att">;
409*0fca6ea1SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cfcmov", "l", "att">;
410*0fca6ea1SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cfcmov", "q", "att">;
411*0fca6ea1SDimitry Andric// No size suffix for intel-style asm.
412*0fca6ea1SDimitry Andricdefm : IntegerCondCodeMnemonicAlias<"cfcmov", "", "intel">;
41306c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
41406c3fb27SDimitry Andric// Assembler Instruction Aliases
41506c3fb27SDimitry Andric//===----------------------------------------------------------------------===//
41606c3fb27SDimitry Andric
41706c3fb27SDimitry Andric// aad/aam default to base 10 if no operand is specified.
41806c3fb27SDimitry Andricdef : InstAlias<"aad", (AAD8i8 10)>, Requires<[Not64BitMode]>;
41906c3fb27SDimitry Andricdef : InstAlias<"aam", (AAM8i8 10)>, Requires<[Not64BitMode]>;
42006c3fb27SDimitry Andric
42106c3fb27SDimitry Andric// Disambiguate the mem/imm form of bt-without-a-suffix as btl.
42206c3fb27SDimitry Andric// Likewise for btc/btr/bts.
42306c3fb27SDimitry Andricdef : InstAlias<"bt\t{$imm, $mem|$mem, $imm}",
42406c3fb27SDimitry Andric                (BT32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
42506c3fb27SDimitry Andricdef : InstAlias<"btc\t{$imm, $mem|$mem, $imm}",
42606c3fb27SDimitry Andric                (BTC32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
42706c3fb27SDimitry Andricdef : InstAlias<"btr\t{$imm, $mem|$mem, $imm}",
42806c3fb27SDimitry Andric                (BTR32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
42906c3fb27SDimitry Andricdef : InstAlias<"bts\t{$imm, $mem|$mem, $imm}",
43006c3fb27SDimitry Andric                (BTS32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
43106c3fb27SDimitry Andric
43206c3fb27SDimitry Andric// clr aliases.
43306c3fb27SDimitry Andricdef : InstAlias<"clr{b}\t$reg", (XOR8rr  GR8 :$reg, GR8 :$reg), 0>;
43406c3fb27SDimitry Andricdef : InstAlias<"clr{w}\t$reg", (XOR16rr GR16:$reg, GR16:$reg), 0>;
43506c3fb27SDimitry Andricdef : InstAlias<"clr{l}\t$reg", (XOR32rr GR32:$reg, GR32:$reg), 0>;
43606c3fb27SDimitry Andricdef : InstAlias<"clr{q}\t$reg", (XOR64rr GR64:$reg, GR64:$reg), 0>;
43706c3fb27SDimitry Andric
43806c3fb27SDimitry Andric// lods aliases. Accept the destination being omitted because it's implicit
43906c3fb27SDimitry Andric// in the mnemonic, or the mnemonic suffix being omitted because it's implicit
44006c3fb27SDimitry Andric// in the destination.
44106c3fb27SDimitry Andricdef : InstAlias<"lodsb\t$src", (LODSB srcidx8:$src),  0>;
44206c3fb27SDimitry Andricdef : InstAlias<"lodsw\t$src", (LODSW srcidx16:$src), 0>;
44306c3fb27SDimitry Andricdef : InstAlias<"lods{l|d}\t$src", (LODSL srcidx32:$src), 0>;
44406c3fb27SDimitry Andricdef : InstAlias<"lodsq\t$src", (LODSQ srcidx64:$src), 0>, Requires<[In64BitMode]>;
44506c3fb27SDimitry Andricdef : InstAlias<"lods\t{$src, %al|al, $src}", (LODSB srcidx8:$src),  0>;
44606c3fb27SDimitry Andricdef : InstAlias<"lods\t{$src, %ax|ax, $src}", (LODSW srcidx16:$src), 0>;
44706c3fb27SDimitry Andricdef : InstAlias<"lods\t{$src, %eax|eax, $src}", (LODSL srcidx32:$src), 0>;
44806c3fb27SDimitry Andricdef : InstAlias<"lods\t{$src, %rax|rax, $src}", (LODSQ srcidx64:$src), 0>, Requires<[In64BitMode]>;
44906c3fb27SDimitry Andricdef : InstAlias<"lods\t$src", (LODSB srcidx8:$src),  0, "intel">;
45006c3fb27SDimitry Andricdef : InstAlias<"lods\t$src", (LODSW srcidx16:$src), 0, "intel">;
45106c3fb27SDimitry Andricdef : InstAlias<"lods\t$src", (LODSL srcidx32:$src), 0, "intel">;
45206c3fb27SDimitry Andricdef : InstAlias<"lods\t$src", (LODSQ srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
45306c3fb27SDimitry Andric
45406c3fb27SDimitry Andric
45506c3fb27SDimitry Andric// stos aliases. Accept the source being omitted because it's implicit in
45606c3fb27SDimitry Andric// the mnemonic, or the mnemonic suffix being omitted because it's implicit
45706c3fb27SDimitry Andric// in the source.
45806c3fb27SDimitry Andricdef : InstAlias<"stosb\t$dst", (STOSB dstidx8:$dst),  0>;
45906c3fb27SDimitry Andricdef : InstAlias<"stosw\t$dst", (STOSW dstidx16:$dst), 0>;
46006c3fb27SDimitry Andricdef : InstAlias<"stos{l|d}\t$dst", (STOSL dstidx32:$dst), 0>;
46106c3fb27SDimitry Andricdef : InstAlias<"stosq\t$dst", (STOSQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
46206c3fb27SDimitry Andricdef : InstAlias<"stos\t{%al, $dst|$dst, al}", (STOSB dstidx8:$dst),  0>;
46306c3fb27SDimitry Andricdef : InstAlias<"stos\t{%ax, $dst|$dst, ax}", (STOSW dstidx16:$dst), 0>;
46406c3fb27SDimitry Andricdef : InstAlias<"stos\t{%eax, $dst|$dst, eax}", (STOSL dstidx32:$dst), 0>;
46506c3fb27SDimitry Andricdef : InstAlias<"stos\t{%rax, $dst|$dst, rax}", (STOSQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
46606c3fb27SDimitry Andricdef : InstAlias<"stos\t$dst", (STOSB dstidx8:$dst),  0, "intel">;
46706c3fb27SDimitry Andricdef : InstAlias<"stos\t$dst", (STOSW dstidx16:$dst), 0, "intel">;
46806c3fb27SDimitry Andricdef : InstAlias<"stos\t$dst", (STOSL dstidx32:$dst), 0, "intel">;
46906c3fb27SDimitry Andricdef : InstAlias<"stos\t$dst", (STOSQ dstidx64:$dst), 0, "intel">, Requires<[In64BitMode]>;
47006c3fb27SDimitry Andric
47106c3fb27SDimitry Andric
47206c3fb27SDimitry Andric// scas aliases. Accept the destination being omitted because it's implicit
47306c3fb27SDimitry Andric// in the mnemonic, or the mnemonic suffix being omitted because it's implicit
47406c3fb27SDimitry Andric// in the destination.
47506c3fb27SDimitry Andricdef : InstAlias<"scasb\t$dst", (SCASB dstidx8:$dst),  0>;
47606c3fb27SDimitry Andricdef : InstAlias<"scasw\t$dst", (SCASW dstidx16:$dst), 0>;
47706c3fb27SDimitry Andricdef : InstAlias<"scas{l|d}\t$dst", (SCASL dstidx32:$dst), 0>;
47806c3fb27SDimitry Andricdef : InstAlias<"scasq\t$dst", (SCASQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
47906c3fb27SDimitry Andricdef : InstAlias<"scas\t{$dst, %al|al, $dst}", (SCASB dstidx8:$dst),  0>;
48006c3fb27SDimitry Andricdef : InstAlias<"scas\t{$dst, %ax|ax, $dst}", (SCASW dstidx16:$dst), 0>;
48106c3fb27SDimitry Andricdef : InstAlias<"scas\t{$dst, %eax|eax, $dst}", (SCASL dstidx32:$dst), 0>;
48206c3fb27SDimitry Andricdef : InstAlias<"scas\t{$dst, %rax|rax, $dst}", (SCASQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
48306c3fb27SDimitry Andricdef : InstAlias<"scas\t$dst", (SCASB dstidx8:$dst),  0, "intel">;
48406c3fb27SDimitry Andricdef : InstAlias<"scas\t$dst", (SCASW dstidx16:$dst), 0, "intel">;
48506c3fb27SDimitry Andricdef : InstAlias<"scas\t$dst", (SCASL dstidx32:$dst), 0, "intel">;
48606c3fb27SDimitry Andricdef : InstAlias<"scas\t$dst", (SCASQ dstidx64:$dst), 0, "intel">, Requires<[In64BitMode]>;
48706c3fb27SDimitry Andric
48806c3fb27SDimitry Andric// cmps aliases. Mnemonic suffix being omitted because it's implicit
48906c3fb27SDimitry Andric// in the destination.
49006c3fb27SDimitry Andricdef : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSB dstidx8:$dst, srcidx8:$src),   0, "intel">;
49106c3fb27SDimitry Andricdef : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSW dstidx16:$dst, srcidx16:$src), 0, "intel">;
49206c3fb27SDimitry Andricdef : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSL dstidx32:$dst, srcidx32:$src), 0, "intel">;
49306c3fb27SDimitry Andricdef : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSQ dstidx64:$dst, srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
49406c3fb27SDimitry Andric
49506c3fb27SDimitry Andric// movs aliases. Mnemonic suffix being omitted because it's implicit
49606c3fb27SDimitry Andric// in the destination.
49706c3fb27SDimitry Andricdef : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSB dstidx8:$dst, srcidx8:$src),   0, "intel">;
49806c3fb27SDimitry Andricdef : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSW dstidx16:$dst, srcidx16:$src), 0, "intel">;
49906c3fb27SDimitry Andricdef : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSL dstidx32:$dst, srcidx32:$src), 0, "intel">;
50006c3fb27SDimitry Andricdef : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSQ dstidx64:$dst, srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
50106c3fb27SDimitry Andric
50206c3fb27SDimitry Andric// div and idiv aliases for explicit A register.
50306c3fb27SDimitry Andricdef : InstAlias<"div{b}\t{$src, %al|al, $src}", (DIV8r  GR8 :$src)>;
50406c3fb27SDimitry Andricdef : InstAlias<"div{w}\t{$src, %ax|ax, $src}", (DIV16r GR16:$src)>;
50506c3fb27SDimitry Andricdef : InstAlias<"div{l}\t{$src, %eax|eax, $src}", (DIV32r GR32:$src)>;
50606c3fb27SDimitry Andricdef : InstAlias<"div{q}\t{$src, %rax|rax, $src}", (DIV64r GR64:$src)>;
50706c3fb27SDimitry Andricdef : InstAlias<"div{b}\t{$src, %al|al, $src}", (DIV8m  i8mem :$src)>;
50806c3fb27SDimitry Andricdef : InstAlias<"div{w}\t{$src, %ax|ax, $src}", (DIV16m i16mem:$src)>;
50906c3fb27SDimitry Andricdef : InstAlias<"div{l}\t{$src, %eax|eax, $src}", (DIV32m i32mem:$src)>;
51006c3fb27SDimitry Andricdef : InstAlias<"div{q}\t{$src, %rax|rax, $src}", (DIV64m i64mem:$src)>;
51106c3fb27SDimitry Andricdef : InstAlias<"idiv{b}\t{$src, %al|al, $src}", (IDIV8r  GR8 :$src)>;
51206c3fb27SDimitry Andricdef : InstAlias<"idiv{w}\t{$src, %ax|ax, $src}", (IDIV16r GR16:$src)>;
51306c3fb27SDimitry Andricdef : InstAlias<"idiv{l}\t{$src, %eax|eax, $src}", (IDIV32r GR32:$src)>;
51406c3fb27SDimitry Andricdef : InstAlias<"idiv{q}\t{$src, %rax|rax, $src}", (IDIV64r GR64:$src)>;
51506c3fb27SDimitry Andricdef : InstAlias<"idiv{b}\t{$src, %al|al, $src}", (IDIV8m  i8mem :$src)>;
51606c3fb27SDimitry Andricdef : InstAlias<"idiv{w}\t{$src, %ax|ax, $src}", (IDIV16m i16mem:$src)>;
51706c3fb27SDimitry Andricdef : InstAlias<"idiv{l}\t{$src, %eax|eax, $src}", (IDIV32m i32mem:$src)>;
51806c3fb27SDimitry Andricdef : InstAlias<"idiv{q}\t{$src, %rax|rax, $src}", (IDIV64m i64mem:$src)>;
51906c3fb27SDimitry Andric
52006c3fb27SDimitry Andric
52106c3fb27SDimitry Andric
52206c3fb27SDimitry Andric// Various unary fpstack operations default to operating on ST1.
52306c3fb27SDimitry Andric// For example, "fxch" -> "fxch %st(1)"
52406c3fb27SDimitry Andricdef : InstAlias<"faddp",        (ADD_FPrST0  ST1), 0>;
52506c3fb27SDimitry Andricdef:  InstAlias<"fadd",         (ADD_FPrST0  ST1), 0>;
52606c3fb27SDimitry Andricdef : InstAlias<"fsub{|r}p",    (SUBR_FPrST0 ST1), 0>;
52706c3fb27SDimitry Andricdef : InstAlias<"fsub{r|}p",    (SUB_FPrST0  ST1), 0>;
52806c3fb27SDimitry Andricdef : InstAlias<"fmul",         (MUL_FPrST0  ST1), 0>;
52906c3fb27SDimitry Andricdef : InstAlias<"fmulp",        (MUL_FPrST0  ST1), 0>;
53006c3fb27SDimitry Andricdef : InstAlias<"fdiv{|r}p",    (DIVR_FPrST0 ST1), 0>;
53106c3fb27SDimitry Andricdef : InstAlias<"fdiv{r|}p",    (DIV_FPrST0  ST1), 0>;
53206c3fb27SDimitry Andricdef : InstAlias<"fxch",         (XCH_F       ST1), 0>;
53306c3fb27SDimitry Andricdef : InstAlias<"fcom",         (COM_FST0r   ST1), 0>;
53406c3fb27SDimitry Andricdef : InstAlias<"fcomp",        (COMP_FST0r  ST1), 0>;
53506c3fb27SDimitry Andricdef : InstAlias<"fcomi",        (COM_FIr     ST1), 0>;
53606c3fb27SDimitry Andricdef : InstAlias<"fcompi",       (COM_FIPr    ST1), 0>;
53706c3fb27SDimitry Andricdef : InstAlias<"fucom",        (UCOM_Fr     ST1), 0>;
53806c3fb27SDimitry Andricdef : InstAlias<"fucomp",       (UCOM_FPr    ST1), 0>;
53906c3fb27SDimitry Andricdef : InstAlias<"fucomi",       (UCOM_FIr    ST1), 0>;
54006c3fb27SDimitry Andricdef : InstAlias<"fucompi",      (UCOM_FIPr   ST1), 0>;
54106c3fb27SDimitry Andric
54206c3fb27SDimitry Andric// Handle fmul/fadd/fsub/fdiv instructions with explicitly written st(0) op.
54306c3fb27SDimitry Andric// For example, "fadd %st(4), %st(0)" -> "fadd %st(4)".  We also disambiguate
54406c3fb27SDimitry Andric// instructions like "fadd %st(0), %st(0)" as "fadd %st(0)" for consistency with
54506c3fb27SDimitry Andric// gas.
54606c3fb27SDimitry Andricmulticlass FpUnaryAlias<string Mnemonic, Instruction Inst, bit EmitAlias = 1> {
54706c3fb27SDimitry Andric def : InstAlias<!strconcat(Mnemonic, "\t$op"),
54806c3fb27SDimitry Andric                 (Inst RSTi:$op), EmitAlias>;
54906c3fb27SDimitry Andric def : InstAlias<!strconcat(Mnemonic, "\t{%st, %st|st, st}"),
55006c3fb27SDimitry Andric                 (Inst ST0), EmitAlias>;
55106c3fb27SDimitry Andric}
55206c3fb27SDimitry Andric
55306c3fb27SDimitry Andricdefm : FpUnaryAlias<"fadd",   ADD_FST0r, 0>;
55406c3fb27SDimitry Andricdefm : FpUnaryAlias<"faddp",  ADD_FPrST0, 0>;
55506c3fb27SDimitry Andricdefm : FpUnaryAlias<"fsub",   SUB_FST0r, 0>;
55606c3fb27SDimitry Andricdefm : FpUnaryAlias<"fsub{|r}p",  SUBR_FPrST0, 0>;
55706c3fb27SDimitry Andricdefm : FpUnaryAlias<"fsubr",  SUBR_FST0r, 0>;
55806c3fb27SDimitry Andricdefm : FpUnaryAlias<"fsub{r|}p", SUB_FPrST0, 0>;
55906c3fb27SDimitry Andricdefm : FpUnaryAlias<"fmul",   MUL_FST0r, 0>;
56006c3fb27SDimitry Andricdefm : FpUnaryAlias<"fmulp",  MUL_FPrST0, 0>;
56106c3fb27SDimitry Andricdefm : FpUnaryAlias<"fdiv",   DIV_FST0r, 0>;
56206c3fb27SDimitry Andricdefm : FpUnaryAlias<"fdiv{|r}p",  DIVR_FPrST0, 0>;
56306c3fb27SDimitry Andricdefm : FpUnaryAlias<"fdivr",  DIVR_FST0r, 0>;
56406c3fb27SDimitry Andricdefm : FpUnaryAlias<"fdiv{r|}p", DIV_FPrST0, 0>;
56506c3fb27SDimitry Andricdefm : FpUnaryAlias<"fcomi",   COM_FIr, 0>;
56606c3fb27SDimitry Andricdefm : FpUnaryAlias<"fucomi",  UCOM_FIr, 0>;
56706c3fb27SDimitry Andricdefm : FpUnaryAlias<"fcompi",   COM_FIPr, 0>;
56806c3fb27SDimitry Andricdefm : FpUnaryAlias<"fucompi",  UCOM_FIPr, 0>;
56906c3fb27SDimitry Andric
57006c3fb27SDimitry Andric
57106c3fb27SDimitry Andric// Handle "f{mulp,addp} $op, %st(0)" the same as "f{mulp,addp} $op", since they
57206c3fb27SDimitry Andric// commute.  We also allow fdiv[r]p/fsubrp even though they don't commute,
57306c3fb27SDimitry Andric// solely because gas supports it.
57406c3fb27SDimitry Andricdef : InstAlias<"faddp\t{$op, %st|st, $op}", (ADD_FPrST0 RSTi:$op), 0>;
57506c3fb27SDimitry Andricdef : InstAlias<"fmulp\t{$op, %st|st, $op}", (MUL_FPrST0 RSTi:$op), 0>;
57606c3fb27SDimitry Andricdef : InstAlias<"fsub{|r}p\t{$op, %st|st, $op}", (SUBR_FPrST0 RSTi:$op), 0>;
57706c3fb27SDimitry Andricdef : InstAlias<"fsub{r|}p\t{$op, %st|st, $op}", (SUB_FPrST0 RSTi:$op), 0>;
57806c3fb27SDimitry Andricdef : InstAlias<"fdiv{|r}p\t{$op, %st|st, $op}", (DIVR_FPrST0 RSTi:$op), 0>;
57906c3fb27SDimitry Andricdef : InstAlias<"fdiv{r|}p\t{$op, %st|st, $op}", (DIV_FPrST0 RSTi:$op), 0>;
58006c3fb27SDimitry Andric
58106c3fb27SDimitry Andricdef : InstAlias<"fnstsw"     , (FNSTSW16r), 0>;
58206c3fb27SDimitry Andric
58306c3fb27SDimitry Andric// lcall and ljmp aliases.  This seems to be an odd mapping in 64-bit mode, but
58406c3fb27SDimitry Andric// this is compatible with what GAS does.
58506c3fb27SDimitry Andricdef : InstAlias<"lcall\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg), 0>, Requires<[In32BitMode]>;
58606c3fb27SDimitry Andricdef : InstAlias<"ljmp\t$seg, $off",  (FARJMP32i  i32imm:$off, i16imm:$seg), 0>, Requires<[In32BitMode]>;
58706c3fb27SDimitry Andricdef : InstAlias<"lcall\t{*}$dst",    (FARCALL32m opaquemem:$dst), 0>, Requires<[Not16BitMode]>;
58806c3fb27SDimitry Andricdef : InstAlias<"ljmp\t{*}$dst",     (FARJMP32m  opaquemem:$dst), 0>, Requires<[Not16BitMode]>;
58906c3fb27SDimitry Andricdef : InstAlias<"lcall\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg), 0>, Requires<[In16BitMode]>;
59006c3fb27SDimitry Andricdef : InstAlias<"ljmp\t$seg, $off",  (FARJMP16i  i16imm:$off, i16imm:$seg), 0>, Requires<[In16BitMode]>;
59106c3fb27SDimitry Andricdef : InstAlias<"lcall\t{*}$dst",    (FARCALL16m opaquemem:$dst), 0>, Requires<[In16BitMode]>;
59206c3fb27SDimitry Andricdef : InstAlias<"ljmp\t{*}$dst",     (FARJMP16m  opaquemem:$dst), 0>, Requires<[In16BitMode]>;
59306c3fb27SDimitry Andric
59406c3fb27SDimitry Andricdef : InstAlias<"jmp\t{*}$dst",      (JMP64m  i64mem:$dst), 0, "att">, Requires<[In64BitMode]>;
59506c3fb27SDimitry Andricdef : InstAlias<"jmp\t{*}$dst",      (JMP32m  i32mem:$dst), 0, "att">, Requires<[In32BitMode]>;
59606c3fb27SDimitry Andricdef : InstAlias<"jmp\t{*}$dst",      (JMP16m  i16mem:$dst), 0, "att">, Requires<[In16BitMode]>;
59706c3fb27SDimitry Andric
59806c3fb27SDimitry Andric
59906c3fb27SDimitry Andric// "imul <imm>, B" is an alias for "imul <imm>, B, B".
60006c3fb27SDimitry Andricdef : InstAlias<"imul{w}\t{$imm, $r|$r, $imm}", (IMUL16rri  GR16:$r, GR16:$r, i16imm:$imm), 0>;
60106c3fb27SDimitry Andricdef : InstAlias<"imul{w}\t{$imm, $r|$r, $imm}", (IMUL16rri8 GR16:$r, GR16:$r, i16i8imm:$imm), 0>;
60206c3fb27SDimitry Andricdef : InstAlias<"imul{l}\t{$imm, $r|$r, $imm}", (IMUL32rri  GR32:$r, GR32:$r, i32imm:$imm), 0>;
60306c3fb27SDimitry Andricdef : InstAlias<"imul{l}\t{$imm, $r|$r, $imm}", (IMUL32rri8 GR32:$r, GR32:$r, i32i8imm:$imm), 0>;
60406c3fb27SDimitry Andricdef : InstAlias<"imul{q}\t{$imm, $r|$r, $imm}", (IMUL64rri32 GR64:$r, GR64:$r, i64i32imm:$imm), 0>;
60506c3fb27SDimitry Andricdef : InstAlias<"imul{q}\t{$imm, $r|$r, $imm}", (IMUL64rri8 GR64:$r, GR64:$r, i64i8imm:$imm), 0>;
60606c3fb27SDimitry Andric
60706c3fb27SDimitry Andric// ins aliases. Accept the mnemonic suffix being omitted because it's implicit
60806c3fb27SDimitry Andric// in the destination.
60906c3fb27SDimitry Andricdef : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSB dstidx8:$dst),  0, "intel">;
61006c3fb27SDimitry Andricdef : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSW dstidx16:$dst), 0, "intel">;
61106c3fb27SDimitry Andricdef : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSL dstidx32:$dst), 0, "intel">;
61206c3fb27SDimitry Andric
61306c3fb27SDimitry Andric// outs aliases. Accept the mnemonic suffix being omitted because it's implicit
61406c3fb27SDimitry Andric// in the source.
61506c3fb27SDimitry Andricdef : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSB srcidx8:$src),  0, "intel">;
61606c3fb27SDimitry Andricdef : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSW srcidx16:$src), 0, "intel">;
61706c3fb27SDimitry Andricdef : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSL srcidx32:$src), 0, "intel">;
61806c3fb27SDimitry Andric
61906c3fb27SDimitry Andric// inb %dx -> inb %al, %dx
62006c3fb27SDimitry Andricdef : InstAlias<"inb\t{%dx|dx}", (IN8rr), 0>;
62106c3fb27SDimitry Andricdef : InstAlias<"inw\t{%dx|dx}", (IN16rr), 0>;
62206c3fb27SDimitry Andricdef : InstAlias<"inl\t{%dx|dx}", (IN32rr), 0>;
62306c3fb27SDimitry Andricdef : InstAlias<"inb\t$port", (IN8ri u8imm:$port), 0>;
62406c3fb27SDimitry Andricdef : InstAlias<"inw\t$port", (IN16ri u8imm:$port), 0>;
62506c3fb27SDimitry Andricdef : InstAlias<"inl\t$port", (IN32ri u8imm:$port), 0>;
62606c3fb27SDimitry Andric
62706c3fb27SDimitry Andric
62806c3fb27SDimitry Andric// jmp and call aliases for lcall and ljmp.  jmp $42,$5 -> ljmp
62906c3fb27SDimitry Andricdef : InstAlias<"call\t$seg, $off",  (FARCALL16i i16imm:$off, i16imm:$seg)>, Requires<[In16BitMode]>;
63006c3fb27SDimitry Andricdef : InstAlias<"jmp\t$seg, $off",   (FARJMP16i  i16imm:$off, i16imm:$seg)>, Requires<[In16BitMode]>;
63106c3fb27SDimitry Andricdef : InstAlias<"call\t$seg, $off",  (FARCALL32i i32imm:$off, i16imm:$seg)>, Requires<[In32BitMode]>;
63206c3fb27SDimitry Andricdef : InstAlias<"jmp\t$seg, $off",   (FARJMP32i  i32imm:$off, i16imm:$seg)>, Requires<[In32BitMode]>;
63306c3fb27SDimitry Andricdef : InstAlias<"callw\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
63406c3fb27SDimitry Andricdef : InstAlias<"jmpw\t$seg, $off",  (FARJMP16i  i16imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
63506c3fb27SDimitry Andricdef : InstAlias<"calll\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
63606c3fb27SDimitry Andricdef : InstAlias<"jmpl\t$seg, $off",  (FARJMP32i  i32imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
63706c3fb27SDimitry Andric
63806c3fb27SDimitry Andric// Match 'movq <largeimm>, <reg>' as an alias for movabsq.
63906c3fb27SDimitry Andricdef : InstAlias<"mov{q}\t{$imm, $reg|$reg, $imm}", (MOV64ri GR64:$reg, i64imm:$imm), 0>;
64006c3fb27SDimitry Andric
64106c3fb27SDimitry Andric// Match 'movd GR64, MMX' as an alias for movq to be compatible with gas,
64206c3fb27SDimitry Andric// which supports this due to an old AMD documentation bug when 64-bit mode was
64306c3fb27SDimitry Andric// created.
64406c3fb27SDimitry Andricdef : InstAlias<"movd\t{$src, $dst|$dst, $src}",
64506c3fb27SDimitry Andric                (MMX_MOVD64to64rr VR64:$dst, GR64:$src), 0>;
64606c3fb27SDimitry Andricdef : InstAlias<"movd\t{$src, $dst|$dst, $src}",
64706c3fb27SDimitry Andric                (MMX_MOVD64from64rr GR64:$dst, VR64:$src), 0>;
64806c3fb27SDimitry Andric
64906c3fb27SDimitry Andric// movsx aliases
65006c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX16rr8 GR16:$dst, GR8:$src), 0, "att">;
65106c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX16rm8 GR16:$dst, i8mem:$src), 0, "att">;
65206c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX32rr8 GR32:$dst, GR8:$src), 0, "att">;
65306c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX32rr16 GR32:$dst, GR16:$src), 0, "att">;
65406c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr8 GR64:$dst, GR8:$src), 0, "att">;
65506c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr16 GR64:$dst, GR16:$src), 0, "att">;
65606c3fb27SDimitry Andricdef : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr32 GR64:$dst, GR32:$src), 0, "att">;
65706c3fb27SDimitry Andric
65806c3fb27SDimitry Andric// movzx aliases
65906c3fb27SDimitry Andricdef : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX16rr8 GR16:$dst, GR8:$src), 0, "att">;
66006c3fb27SDimitry Andricdef : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX16rm8 GR16:$dst, i8mem:$src), 0, "att">;
66106c3fb27SDimitry Andricdef : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX32rr8 GR32:$dst, GR8:$src), 0, "att">;
66206c3fb27SDimitry Andricdef : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX32rr16 GR32:$dst, GR16:$src), 0, "att">;
66306c3fb27SDimitry Andricdef : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX64rr8 GR64:$dst, GR8:$src), 0, "att">;
66406c3fb27SDimitry Andricdef : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX64rr16 GR64:$dst, GR16:$src), 0, "att">;
66506c3fb27SDimitry Andric// Note: No GR32->GR64 movzx form.
66606c3fb27SDimitry Andric
66706c3fb27SDimitry Andric// outb %dx -> outb %al, %dx
66806c3fb27SDimitry Andricdef : InstAlias<"outb\t{%dx|dx}", (OUT8rr), 0>;
66906c3fb27SDimitry Andricdef : InstAlias<"outw\t{%dx|dx}", (OUT16rr), 0>;
67006c3fb27SDimitry Andricdef : InstAlias<"outl\t{%dx|dx}", (OUT32rr), 0>;
67106c3fb27SDimitry Andricdef : InstAlias<"outb\t$port", (OUT8ir u8imm:$port), 0>;
67206c3fb27SDimitry Andricdef : InstAlias<"outw\t$port", (OUT16ir u8imm:$port), 0>;
67306c3fb27SDimitry Andricdef : InstAlias<"outl\t$port", (OUT32ir u8imm:$port), 0>;
67406c3fb27SDimitry Andric
67506c3fb27SDimitry Andric// 'sldt <mem>' can be encoded with either sldtw or sldtq with the same
67606c3fb27SDimitry Andric// effect (both store to a 16-bit mem).  Force to sldtw to avoid ambiguity
67706c3fb27SDimitry Andric// errors, since its encoding is the most compact.
67806c3fb27SDimitry Andricdef : InstAlias<"sldt $mem", (SLDT16m i16mem:$mem), 0>;
67906c3fb27SDimitry Andric
68006c3fb27SDimitry Andric// shld/shrd op,op -> shld op, op, CL
68106c3fb27SDimitry Andricdef : InstAlias<"shld{w}\t{$r2, $r1|$r1, $r2}", (SHLD16rrCL GR16:$r1, GR16:$r2), 0>;
68206c3fb27SDimitry Andricdef : InstAlias<"shld{l}\t{$r2, $r1|$r1, $r2}", (SHLD32rrCL GR32:$r1, GR32:$r2), 0>;
68306c3fb27SDimitry Andricdef : InstAlias<"shld{q}\t{$r2, $r1|$r1, $r2}", (SHLD64rrCL GR64:$r1, GR64:$r2), 0>;
68406c3fb27SDimitry Andricdef : InstAlias<"shrd{w}\t{$r2, $r1|$r1, $r2}", (SHRD16rrCL GR16:$r1, GR16:$r2), 0>;
68506c3fb27SDimitry Andricdef : InstAlias<"shrd{l}\t{$r2, $r1|$r1, $r2}", (SHRD32rrCL GR32:$r1, GR32:$r2), 0>;
68606c3fb27SDimitry Andricdef : InstAlias<"shrd{q}\t{$r2, $r1|$r1, $r2}", (SHRD64rrCL GR64:$r1, GR64:$r2), 0>;
68706c3fb27SDimitry Andric
68806c3fb27SDimitry Andricdef : InstAlias<"shld{w}\t{$reg, $mem|$mem, $reg}", (SHLD16mrCL i16mem:$mem, GR16:$reg), 0>;
68906c3fb27SDimitry Andricdef : InstAlias<"shld{l}\t{$reg, $mem|$mem, $reg}", (SHLD32mrCL i32mem:$mem, GR32:$reg), 0>;
69006c3fb27SDimitry Andricdef : InstAlias<"shld{q}\t{$reg, $mem|$mem, $reg}", (SHLD64mrCL i64mem:$mem, GR64:$reg), 0>;
69106c3fb27SDimitry Andricdef : InstAlias<"shrd{w}\t{$reg, $mem|$mem, $reg}", (SHRD16mrCL i16mem:$mem, GR16:$reg), 0>;
69206c3fb27SDimitry Andricdef : InstAlias<"shrd{l}\t{$reg, $mem|$mem, $reg}", (SHRD32mrCL i32mem:$mem, GR32:$reg), 0>;
69306c3fb27SDimitry Andricdef : InstAlias<"shrd{q}\t{$reg, $mem|$mem, $reg}", (SHRD64mrCL i64mem:$mem, GR64:$reg), 0>;
69406c3fb27SDimitry Andric
69506c3fb27SDimitry Andric// test: We accept "testX <reg>, <mem>" and "testX <mem>, <reg>" as synonyms.
69606c3fb27SDimitry Andricdef : InstAlias<"test{b}\t{$mem, $val|$val, $mem}",
69706c3fb27SDimitry Andric                (TEST8mr  i8mem :$mem, GR8 :$val), 0>;
69806c3fb27SDimitry Andricdef : InstAlias<"test{w}\t{$mem, $val|$val, $mem}",
69906c3fb27SDimitry Andric                (TEST16mr i16mem:$mem, GR16:$val), 0>;
70006c3fb27SDimitry Andricdef : InstAlias<"test{l}\t{$mem, $val|$val, $mem}",
70106c3fb27SDimitry Andric                (TEST32mr i32mem:$mem, GR32:$val), 0>;
70206c3fb27SDimitry Andricdef : InstAlias<"test{q}\t{$mem, $val|$val, $mem}",
70306c3fb27SDimitry Andric                (TEST64mr i64mem:$mem, GR64:$val), 0>;
70406c3fb27SDimitry Andric
70506c3fb27SDimitry Andric// xchg: We accept "xchgX <reg>, <mem>" and "xchgX <mem>, <reg>" as synonyms.
70606c3fb27SDimitry Andricdef : InstAlias<"xchg{b}\t{$mem, $val|$val, $mem}",
70706c3fb27SDimitry Andric                (XCHG8rm  GR8 :$val, i8mem :$mem), 0>;
70806c3fb27SDimitry Andricdef : InstAlias<"xchg{w}\t{$mem, $val|$val, $mem}",
70906c3fb27SDimitry Andric                (XCHG16rm GR16:$val, i16mem:$mem), 0>;
71006c3fb27SDimitry Andricdef : InstAlias<"xchg{l}\t{$mem, $val|$val, $mem}",
71106c3fb27SDimitry Andric                (XCHG32rm GR32:$val, i32mem:$mem), 0>;
71206c3fb27SDimitry Andricdef : InstAlias<"xchg{q}\t{$mem, $val|$val, $mem}",
71306c3fb27SDimitry Andric                (XCHG64rm GR64:$val, i64mem:$mem), 0>;
71406c3fb27SDimitry Andric
71506c3fb27SDimitry Andric// xchg: We accept "xchgX <reg>, %eax" and "xchgX %eax, <reg>" as synonyms.
71606c3fb27SDimitry Andricdef : InstAlias<"xchg{w}\t{%ax, $src|$src, ax}", (XCHG16ar GR16:$src), 0>;
71706c3fb27SDimitry Andricdef : InstAlias<"xchg{l}\t{%eax, $src|$src, eax}", (XCHG32ar GR32:$src), 0>;
71806c3fb27SDimitry Andricdef : InstAlias<"xchg{q}\t{%rax, $src|$src, rax}", (XCHG64ar GR64:$src), 0>;
71906c3fb27SDimitry Andric
72006c3fb27SDimitry Andric// In 64-bit mode, xchg %eax, %eax can't be encoded with the 0x90 opcode we
72106c3fb27SDimitry Andric// would get by default because it's defined as NOP. But xchg %eax, %eax implies
72206c3fb27SDimitry Andric// implicit zeroing of the upper 32 bits. So alias to the longer encoding.
72306c3fb27SDimitry Andricdef : InstAlias<"xchg{l}\t{%eax, %eax|eax, eax}",
72406c3fb27SDimitry Andric                (XCHG32rr EAX, EAX), 0>, Requires<[In64BitMode]>;
72506c3fb27SDimitry Andric
72606c3fb27SDimitry Andric// xchg %rax, %rax is a nop in x86-64 and can be encoded as such. Without this
72706c3fb27SDimitry Andric// we emit an unneeded REX.w prefix.
72806c3fb27SDimitry Andricdef : InstAlias<"xchg{q}\t{%rax, %rax|rax, rax}", (NOOP), 0>;
72906c3fb27SDimitry Andric
73006c3fb27SDimitry Andric// These aliases exist to get the parser to prioritize matching 8-bit
73106c3fb27SDimitry Andric// immediate encodings over matching the implicit ax/eax/rax encodings. By
73206c3fb27SDimitry Andric// explicitly mentioning the A register here, these entries will be ordered
73306c3fb27SDimitry Andric// first due to the more explicit immediate type.
73406c3fb27SDimitry Andricdef : InstAlias<"adc{w}\t{$imm, %ax|ax, $imm}", (ADC16ri8 AX, i16i8imm:$imm), 0>;
73506c3fb27SDimitry Andricdef : InstAlias<"add{w}\t{$imm, %ax|ax, $imm}", (ADD16ri8 AX, i16i8imm:$imm), 0>;
73606c3fb27SDimitry Andricdef : InstAlias<"and{w}\t{$imm, %ax|ax, $imm}", (AND16ri8 AX, i16i8imm:$imm), 0>;
73706c3fb27SDimitry Andricdef : InstAlias<"cmp{w}\t{$imm, %ax|ax, $imm}", (CMP16ri8 AX, i16i8imm:$imm), 0>;
73806c3fb27SDimitry Andricdef : InstAlias<"or{w}\t{$imm, %ax|ax, $imm}",  (OR16ri8 AX,  i16i8imm:$imm), 0>;
73906c3fb27SDimitry Andricdef : InstAlias<"sbb{w}\t{$imm, %ax|ax, $imm}", (SBB16ri8 AX, i16i8imm:$imm), 0>;
74006c3fb27SDimitry Andricdef : InstAlias<"sub{w}\t{$imm, %ax|ax, $imm}", (SUB16ri8 AX, i16i8imm:$imm), 0>;
74106c3fb27SDimitry Andricdef : InstAlias<"xor{w}\t{$imm, %ax|ax, $imm}", (XOR16ri8 AX, i16i8imm:$imm), 0>;
74206c3fb27SDimitry Andric
74306c3fb27SDimitry Andricdef : InstAlias<"adc{l}\t{$imm, %eax|eax, $imm}", (ADC32ri8 EAX, i32i8imm:$imm), 0>;
74406c3fb27SDimitry Andricdef : InstAlias<"add{l}\t{$imm, %eax|eax, $imm}", (ADD32ri8 EAX, i32i8imm:$imm), 0>;
74506c3fb27SDimitry Andricdef : InstAlias<"and{l}\t{$imm, %eax|eax, $imm}", (AND32ri8 EAX, i32i8imm:$imm), 0>;
74606c3fb27SDimitry Andricdef : InstAlias<"cmp{l}\t{$imm, %eax|eax, $imm}", (CMP32ri8 EAX, i32i8imm:$imm), 0>;
74706c3fb27SDimitry Andricdef : InstAlias<"or{l}\t{$imm, %eax|eax, $imm}",  (OR32ri8 EAX,  i32i8imm:$imm), 0>;
74806c3fb27SDimitry Andricdef : InstAlias<"sbb{l}\t{$imm, %eax|eax, $imm}", (SBB32ri8 EAX, i32i8imm:$imm), 0>;
74906c3fb27SDimitry Andricdef : InstAlias<"sub{l}\t{$imm, %eax|eax, $imm}", (SUB32ri8 EAX, i32i8imm:$imm), 0>;
75006c3fb27SDimitry Andricdef : InstAlias<"xor{l}\t{$imm, %eax|eax, $imm}", (XOR32ri8 EAX, i32i8imm:$imm), 0>;
75106c3fb27SDimitry Andric
75206c3fb27SDimitry Andricdef : InstAlias<"adc{q}\t{$imm, %rax|rax, $imm}", (ADC64ri8 RAX, i64i8imm:$imm), 0>;
75306c3fb27SDimitry Andricdef : InstAlias<"add{q}\t{$imm, %rax|rax, $imm}", (ADD64ri8 RAX, i64i8imm:$imm), 0>;
75406c3fb27SDimitry Andricdef : InstAlias<"and{q}\t{$imm, %rax|rax, $imm}", (AND64ri8 RAX, i64i8imm:$imm), 0>;
75506c3fb27SDimitry Andricdef : InstAlias<"cmp{q}\t{$imm, %rax|rax, $imm}", (CMP64ri8 RAX, i64i8imm:$imm), 0>;
75606c3fb27SDimitry Andricdef : InstAlias<"or{q}\t{$imm, %rax|rax, $imm}",  (OR64ri8 RAX,  i64i8imm:$imm), 0>;
75706c3fb27SDimitry Andricdef : InstAlias<"sbb{q}\t{$imm, %rax|rax, $imm}", (SBB64ri8 RAX, i64i8imm:$imm), 0>;
75806c3fb27SDimitry Andricdef : InstAlias<"sub{q}\t{$imm, %rax|rax, $imm}", (SUB64ri8 RAX, i64i8imm:$imm), 0>;
75906c3fb27SDimitry Andricdef : InstAlias<"xor{q}\t{$imm, %rax|rax, $imm}", (XOR64ri8 RAX, i64i8imm:$imm), 0>;
76006c3fb27SDimitry Andric
76106c3fb27SDimitry Andric//  MMX instr alia
76206c3fb27SDimitry Andricdef : InstAlias<"movq.s\t{$src, $dst|$dst, $src}",
76306c3fb27SDimitry Andric                (MMX_MOVQ64rr_REV VR64:$dst, VR64:$src), 0>;
76406c3fb27SDimitry Andric
765*0fca6ea1SDimitry Andric//  CMOV SETCC SETZUCC Aliases
76606c3fb27SDimitry Andricmulticlass CMOV_SETCC_Aliases<string Cond, int CC> {
76706c3fb27SDimitry Andric  def : InstAlias<"cmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
76806c3fb27SDimitry Andric                  (CMOV16rr GR16:$dst, GR16:$src, CC), 0>;
76906c3fb27SDimitry Andric  def : InstAlias<"cmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
77006c3fb27SDimitry Andric                  (CMOV16rm GR16:$dst, i16mem:$src, CC), 0>;
77106c3fb27SDimitry Andric  def : InstAlias<"cmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
77206c3fb27SDimitry Andric                  (CMOV32rr GR32:$dst, GR32:$src, CC), 0>;
77306c3fb27SDimitry Andric  def : InstAlias<"cmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
77406c3fb27SDimitry Andric                  (CMOV32rm GR32:$dst, i32mem:$src, CC), 0>;
77506c3fb27SDimitry Andric  def : InstAlias<"cmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
77606c3fb27SDimitry Andric                  (CMOV64rr GR64:$dst, GR64:$src, CC), 0>;
77706c3fb27SDimitry Andric  def : InstAlias<"cmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
77806c3fb27SDimitry Andric                  (CMOV64rm GR64:$dst, i64mem:$src, CC), 0>;
779*0fca6ea1SDimitry Andriclet Predicates = [In64BitMode] in {
780*0fca6ea1SDimitry Andric  def : InstAlias<"cmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
781*0fca6ea1SDimitry Andric                  (CMOV16rr_ND GR16:$dst, GR16:$src1, GR16:$src2, CC), 0>;
782*0fca6ea1SDimitry Andric  def : InstAlias<"cmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
783*0fca6ea1SDimitry Andric                  (CMOV16rm_ND GR16:$dst, GR16:$src1, i16mem:$src2, CC), 0>;
784*0fca6ea1SDimitry Andric  def : InstAlias<"cmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
785*0fca6ea1SDimitry Andric                  (CMOV32rr_ND GR32:$dst, GR32:$src1, GR32:$src2, CC), 0>;
786*0fca6ea1SDimitry Andric  def : InstAlias<"cmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
787*0fca6ea1SDimitry Andric                  (CMOV32rm_ND GR32:$dst, GR32:$src1, i32mem:$src2, CC), 0>;
788*0fca6ea1SDimitry Andric  def : InstAlias<"cmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
789*0fca6ea1SDimitry Andric                  (CMOV64rr_ND GR64:$dst, GR64:$src1, GR64:$src2, CC), 0>;
790*0fca6ea1SDimitry Andric  def : InstAlias<"cmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
791*0fca6ea1SDimitry Andric                  (CMOV64rm_ND GR64:$dst, GR64:$src1, i64mem:$src2, CC), 0>;
79206c3fb27SDimitry Andric
793*0fca6ea1SDimitry Andric  def : InstAlias<"setzu"#Cond#"\t$dst", (SETZUCCr GR8:$dst, CC), 0>;
794*0fca6ea1SDimitry Andric  def : InstAlias<"setzu"#Cond#"\t$dst", (SETZUCCm i8mem:$dst, CC), 0>;
795*0fca6ea1SDimitry Andric  def : InstAlias<"set"#Cond#"\t$dst", (SETCCr_EVEX GR8:$dst, CC), 0>;
796*0fca6ea1SDimitry Andric  def : InstAlias<"set"#Cond#"\t$dst", (SETCCm_EVEX i8mem:$dst, CC), 0>;
797*0fca6ea1SDimitry Andric}
79806c3fb27SDimitry Andric  def : InstAlias<"set"#Cond#"\t$dst", (SETCCr GR8:$dst, CC), 0>;
79906c3fb27SDimitry Andric  def : InstAlias<"set"#Cond#"\t$dst", (SETCCm i8mem:$dst, CC), 0>;
80006c3fb27SDimitry Andric}
80106c3fb27SDimitry Andric
80206c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"o" ,  0>;
80306c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"no",  1>;
80406c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"b" ,  2>;
80506c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"ae",  3>;
80606c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"e" ,  4>;
80706c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"ne",  5>;
80806c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"be",  6>;
80906c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"a" ,  7>;
81006c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"s" ,  8>;
81106c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"ns",  9>;
81206c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"p" , 10>;
81306c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"np", 11>;
81406c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"l" , 12>;
81506c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"ge", 13>;
81606c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"le", 14>;
81706c3fb27SDimitry Andricdefm : CMOV_SETCC_Aliases<"g" , 15>;
81806c3fb27SDimitry Andric
819*0fca6ea1SDimitry Andricmulticlass CFCMOV_Aliases<string Cond, int CC> {
820*0fca6ea1SDimitry Andriclet Predicates = [In64BitMode] in {
821*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
822*0fca6ea1SDimitry Andric                  (CFCMOV16rr GR16:$dst, GR16:$src, CC), 0>;
823*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
824*0fca6ea1SDimitry Andric                  (CFCMOV32rr GR32:$dst, GR32:$src, CC), 0>;
825*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
826*0fca6ea1SDimitry Andric                  (CFCMOV64rr GR64:$dst, GR64:$src, CC), 0>;
827*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
828*0fca6ea1SDimitry Andric                  (CFCMOV16rm GR16:$dst, i16mem:$src, CC), 0>;
829*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
830*0fca6ea1SDimitry Andric                  (CFCMOV32rm GR32:$dst, i32mem:$src, CC), 0>;
831*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
832*0fca6ea1SDimitry Andric                  (CFCMOV64rm GR64:$dst, i64mem:$src, CC), 0>;
833*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
834*0fca6ea1SDimitry Andric                  (CFCMOV16mr i16mem:$dst, GR16:$src, CC), 0>;
835*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
836*0fca6ea1SDimitry Andric                  (CFCMOV32mr i32mem:$dst, GR32:$src, CC), 0>;
837*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
838*0fca6ea1SDimitry Andric                  (CFCMOV64mr i64mem:$dst, GR64:$src, CC), 0>;
839*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
840*0fca6ea1SDimitry Andric                  (CFCMOV16rr_ND GR16:$dst, GR16:$src1, GR16:$src2, CC), 0>;
841*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
842*0fca6ea1SDimitry Andric                  (CFCMOV32rr_ND GR32:$dst, GR32:$src1, GR32:$src2, CC), 0>;
843*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
844*0fca6ea1SDimitry Andric                  (CFCMOV64rr_ND GR64:$dst, GR64:$src1, GR64:$src2, CC), 0>;
845*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
846*0fca6ea1SDimitry Andric                  (CFCMOV16rm_ND GR16:$dst, GR16:$src1, i16mem:$src2, CC), 0>;
847*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
848*0fca6ea1SDimitry Andric                  (CFCMOV32rm_ND GR32:$dst, GR32:$src1, i32mem:$src2, CC), 0>;
849*0fca6ea1SDimitry Andric  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
850*0fca6ea1SDimitry Andric                  (CFCMOV64rm_ND GR64:$dst, GR64:$src1, i64mem:$src2, CC), 0>;
851*0fca6ea1SDimitry Andric}
852*0fca6ea1SDimitry Andric}
853*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"o" ,  0>;
854*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"no",  1>;
855*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"b" ,  2>;
856*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"ae",  3>;
857*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"e" ,  4>;
858*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"ne",  5>;
859*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"be",  6>;
860*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"a" ,  7>;
861*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"s" ,  8>;
862*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"ns",  9>;
863*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"p" , 10>;
864*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"np", 11>;
865*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"l" , 12>;
866*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"ge", 13>;
867*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"le", 14>;
868*0fca6ea1SDimitry Andricdefm : CFCMOV_Aliases<"g" , 15>;
869*0fca6ea1SDimitry Andric
87006c3fb27SDimitry Andric// Condition dump instructions Alias
87106c3fb27SDimitry Andricdef : InstAlias<"jo\t$dst",  (JCC_1 brtarget8:$dst,  0), 0>;
87206c3fb27SDimitry Andricdef : InstAlias<"jno\t$dst", (JCC_1 brtarget8:$dst,  1), 0>;
87306c3fb27SDimitry Andricdef : InstAlias<"jb\t$dst",  (JCC_1 brtarget8:$dst,  2), 0>;
87406c3fb27SDimitry Andricdef : InstAlias<"jae\t$dst", (JCC_1 brtarget8:$dst,  3), 0>;
87506c3fb27SDimitry Andricdef : InstAlias<"je\t$dst",  (JCC_1 brtarget8:$dst,  4), 0>;
87606c3fb27SDimitry Andricdef : InstAlias<"jne\t$dst", (JCC_1 brtarget8:$dst,  5), 0>;
87706c3fb27SDimitry Andricdef : InstAlias<"jbe\t$dst", (JCC_1 brtarget8:$dst,  6), 0>;
87806c3fb27SDimitry Andricdef : InstAlias<"ja\t$dst",  (JCC_1 brtarget8:$dst,  7), 0>;
87906c3fb27SDimitry Andricdef : InstAlias<"js\t$dst",  (JCC_1 brtarget8:$dst,  8), 0>;
88006c3fb27SDimitry Andricdef : InstAlias<"jns\t$dst", (JCC_1 brtarget8:$dst,  9), 0>;
88106c3fb27SDimitry Andricdef : InstAlias<"jp\t$dst",  (JCC_1 brtarget8:$dst, 10), 0>;
88206c3fb27SDimitry Andricdef : InstAlias<"jnp\t$dst", (JCC_1 brtarget8:$dst, 11), 0>;
88306c3fb27SDimitry Andricdef : InstAlias<"jl\t$dst",  (JCC_1 brtarget8:$dst, 12), 0>;
88406c3fb27SDimitry Andricdef : InstAlias<"jge\t$dst", (JCC_1 brtarget8:$dst, 13), 0>;
88506c3fb27SDimitry Andricdef : InstAlias<"jle\t$dst", (JCC_1 brtarget8:$dst, 14), 0>;
88606c3fb27SDimitry Andricdef : InstAlias<"jg\t$dst",  (JCC_1 brtarget8:$dst, 15), 0>;
88706c3fb27SDimitry Andric
88806c3fb27SDimitry Andric// SVM instructions Alias
88906c3fb27SDimitry Andricdef : InstAlias<"skinit\t{%eax|eax}", (SKINIT), 0>;
89006c3fb27SDimitry Andricdef : InstAlias<"vmrun\t{%eax|eax}", (VMRUN32), 0>, Requires<[Not64BitMode]>;
89106c3fb27SDimitry Andricdef : InstAlias<"vmrun\t{%rax|rax}", (VMRUN64), 0>, Requires<[In64BitMode]>;
89206c3fb27SDimitry Andricdef : InstAlias<"vmload\t{%eax|eax}", (VMLOAD32), 0>, Requires<[Not64BitMode]>;
89306c3fb27SDimitry Andricdef : InstAlias<"vmload\t{%rax|rax}", (VMLOAD64), 0>, Requires<[In64BitMode]>;
89406c3fb27SDimitry Andricdef : InstAlias<"vmsave\t{%eax|eax}", (VMSAVE32), 0>, Requires<[Not64BitMode]>;
89506c3fb27SDimitry Andricdef : InstAlias<"vmsave\t{%rax|rax}", (VMSAVE64), 0>, Requires<[In64BitMode]>;
89606c3fb27SDimitry Andricdef : InstAlias<"invlpga\t{%eax, %ecx|eax, ecx}", (INVLPGA32), 0>, Requires<[Not64BitMode]>;
89706c3fb27SDimitry Andricdef : InstAlias<"invlpga\t{%rax, %ecx|rax, ecx}", (INVLPGA64), 0>, Requires<[In64BitMode]>;
89806c3fb27SDimitry Andric
899cb14a3feSDimitry Andric// Aliases with explicit %xmm0
900cb14a3feSDimitry Andricdef : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
901cb14a3feSDimitry Andric                (SHA256RNDS2rr VR128:$dst, VR128:$src2), 0>;
902cb14a3feSDimitry Andricdef : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
903cb14a3feSDimitry Andric                (SHA256RNDS2rm VR128:$dst, i128mem:$src2), 0>;
904