xref: /llvm-project/llvm/lib/Target/X86/X86InstrAsmAlias.td (revision 2c62d08bda98bab743fc86c9ccc40304949566d6)
1b9ea7327SWang, Xin10//==- X86InstrAsmAlias.td - Assembler Instruction Aliases --*- tablegen -*-===//
2b9ea7327SWang, Xin10//
3b9ea7327SWang, Xin10// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4b9ea7327SWang, Xin10// See https://llvm.org/LICENSE.txt for license information.
5b9ea7327SWang, Xin10// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6b9ea7327SWang, Xin10//
7b9ea7327SWang, Xin10//===----------------------------------------------------------------------===//
8b9ea7327SWang, Xin10//
9b9ea7327SWang, Xin10// This file describes the assembler mnemonic/instruction aliases in the X86
10b9ea7327SWang, Xin10// architecture.
11b9ea7327SWang, Xin10//
12b9ea7327SWang, Xin10//===----------------------------------------------------------------------===//
13b9ea7327SWang, Xin10
14b9ea7327SWang, Xin10// Reversed version with ".s" suffix for GAS compatibility.
15b9ea7327SWang, Xin10def : InstAlias<"mov{b}.s\t{$src, $dst|$dst, $src}",
16b9ea7327SWang, Xin10                (MOV8rr_REV GR8:$dst, GR8:$src), 0>;
17b9ea7327SWang, Xin10def : InstAlias<"mov{w}.s\t{$src, $dst|$dst, $src}",
18b9ea7327SWang, Xin10                (MOV16rr_REV GR16:$dst, GR16:$src), 0>;
19b9ea7327SWang, Xin10def : InstAlias<"mov{l}.s\t{$src, $dst|$dst, $src}",
20b9ea7327SWang, Xin10                (MOV32rr_REV GR32:$dst, GR32:$src), 0>;
21b9ea7327SWang, Xin10def : InstAlias<"mov{q}.s\t{$src, $dst|$dst, $src}",
22b9ea7327SWang, Xin10                (MOV64rr_REV GR64:$dst, GR64:$src), 0>;
23b9ea7327SWang, Xin10def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
24b9ea7327SWang, Xin10                (MOV8rr_REV GR8:$dst, GR8:$src), 0, "att">;
25b9ea7327SWang, Xin10def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
26b9ea7327SWang, Xin10                (MOV16rr_REV GR16:$dst, GR16:$src), 0, "att">;
27b9ea7327SWang, Xin10def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
28b9ea7327SWang, Xin10                (MOV32rr_REV GR32:$dst, GR32:$src), 0, "att">;
29b9ea7327SWang, Xin10def : InstAlias<"mov.s\t{$src, $dst|$dst, $src}",
30b9ea7327SWang, Xin10                (MOV64rr_REV GR64:$dst, GR64:$src), 0, "att">;
31b9ea7327SWang, Xin10
32b9ea7327SWang, Xin10// MONITORX/MWAITX Instructions Alias
33b9ea7327SWang, Xin10def : InstAlias<"mwaitx\t{%eax, %ecx, %ebx|ebx, ecx, eax}", (MWAITXrrr)>,
34b9ea7327SWang, Xin10      Requires<[ Not64BitMode ]>;
35b9ea7327SWang, Xin10def : InstAlias<"mwaitx\t{%rax, %rcx, %rbx|rbx, rcx, rax}", (MWAITXrrr)>,
36b9ea7327SWang, Xin10      Requires<[ In64BitMode ]>;
37b9ea7327SWang, Xin10
38b9ea7327SWang, Xin10// MONITORX/MWAITX Instructions Alias
39b9ea7327SWang, Xin10def : InstAlias<"monitorx\t{%eax, %ecx, %edx|edx, ecx, eax}", (MONITORX32rrr)>,
40b9ea7327SWang, Xin10      Requires<[ Not64BitMode ]>;
41b9ea7327SWang, Xin10def : InstAlias<"monitorx\t{%rax, %rcx, %rdx|rdx, rcx, rax}", (MONITORX64rrr)>,
42b9ea7327SWang, Xin10      Requires<[ In64BitMode ]>;
43b9ea7327SWang, Xin10
44b9ea7327SWang, Xin10// CLZERO Instruction Alias
45b9ea7327SWang, Xin10def : InstAlias<"clzero\t{%eax|eax}", (CLZERO32r)>, Requires<[Not64BitMode]>;
46b9ea7327SWang, Xin10def : InstAlias<"clzero\t{%rax|rax}", (CLZERO64r)>, Requires<[In64BitMode]>;
47b9ea7327SWang, Xin10
48b9ea7327SWang, Xin10// INVLPGB Instruction Alias
49b9ea7327SWang, Xin10def : InstAlias<"invlpgb\t{%eax, %edx|eax, edx}", (INVLPGB32)>, Requires<[Not64BitMode]>;
50b9ea7327SWang, Xin10def : InstAlias<"invlpgb\t{%rax, %edx|rax, edx}", (INVLPGB64)>, Requires<[In64BitMode]>;
51b9ea7327SWang, Xin10
52b9ea7327SWang, Xin10// CMPCCXADD Instructions Alias
53b9ea7327SWang, Xin10multiclass CMPCCXADD_Aliases<string Cond, int CC> {
54ec062f5bSFreddy Ye  let Predicates = [In64BitMode] in {
55b9ea7327SWang, Xin10    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
56b9ea7327SWang, Xin10                    (CMPCCXADDmr32 GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
57b9ea7327SWang, Xin10    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
58b9ea7327SWang, Xin10                    (CMPCCXADDmr64 GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
591d4691a2SXinWang10
601d4691a2SXinWang10    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
611d4691a2SXinWang10                    (CMPCCXADDmr32_EVEX GR32:$dst, i32mem:$dstsrc2, GR32:$src3, CC), 0>;
621d4691a2SXinWang10    def : InstAlias<"cmp"#Cond#"xadd"#"\t{$src3, $dst, $dstsrc2|$dstsrc2, $dst, $src3}",
631d4691a2SXinWang10                    (CMPCCXADDmr64_EVEX GR64:$dst, i64mem:$dstsrc2, GR64:$src3, CC), 0>;
64b9ea7327SWang, Xin10  }
65ec062f5bSFreddy Ye}
66b9ea7327SWang, Xin10
671ca8092eSShengchen Kan// CCMP Instructions Alias
681ca8092eSShengchen Kanmulticlass CCMP_Aliases<string Cond, int CC> {
691ca8092eSShengchen Kanlet Predicates = [In64BitMode] in {
701ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
711ca8092eSShengchen Kan                (CCMP8rr  GR8:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
721ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
731ca8092eSShengchen Kan                (CCMP16rr GR16:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
741ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
751ca8092eSShengchen Kan                (CCMP32rr GR32:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
761ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
771ca8092eSShengchen Kan                (CCMP64rr GR64:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
781ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
791ca8092eSShengchen Kan                (CCMP8rm  GR8:$src1,  i8mem:$src2,  cflags:$dcf, CC), 0>;
801ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
811ca8092eSShengchen Kan                (CCMP16rm GR16:$src1, i16mem:$src2, cflags:$dcf, CC), 0>;
821ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
831ca8092eSShengchen Kan                (CCMP32rm GR32:$src1, i32mem:$src2, cflags:$dcf, CC), 0>;
841ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
851ca8092eSShengchen Kan                (CCMP64rm GR64:$src1, i64mem:$src2, cflags:$dcf, CC), 0>;
861ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
871ca8092eSShengchen Kan                (CCMP8mr  i8mem:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
881ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
891ca8092eSShengchen Kan                (CCMP16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
901ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
911ca8092eSShengchen Kan                (CCMP32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
921ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
931ca8092eSShengchen Kan                (CCMP64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
941ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
951ca8092eSShengchen Kan                (CCMP8ri  GR8:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
961ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
971ca8092eSShengchen Kan                (CCMP16ri GR16:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
981ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
991ca8092eSShengchen Kan                (CCMP32ri GR32:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
1001ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1011ca8092eSShengchen Kan                (CCMP64ri32 GR64:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
1021ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1031ca8092eSShengchen Kan                (CCMP16ri8 GR16:$src1, i16i8imm:$src2, cflags:$dcf, CC), 0>;
1041ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1051ca8092eSShengchen Kan                (CCMP32ri8 GR32:$src1, i32i8imm:$src2, cflags:$dcf, CC), 0>;
1061ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1071ca8092eSShengchen Kan                (CCMP64ri8 GR64:$src1, i64i8imm:$src2, cflags:$dcf, CC), 0>;
1081ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
1091ca8092eSShengchen Kan                (CCMP8mi  i8mem:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
1101ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1111ca8092eSShengchen Kan                (CCMP16mi i16mem:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
1121ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1131ca8092eSShengchen Kan                (CCMP32mi i32mem:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
1141ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1151ca8092eSShengchen Kan                (CCMP64mi32 i64mem:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
1161ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1171ca8092eSShengchen Kan                (CCMP16mi8 i16mem:$src1, i16i8imm:$src2, cflags:$dcf, CC), 0>;
1181ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1191ca8092eSShengchen Kan                (CCMP32mi8 i32mem:$src1, i32i8imm:$src2, cflags:$dcf, CC), 0>;
1201ca8092eSShengchen Kandef : InstAlias<"ccmp"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1211ca8092eSShengchen Kan                (CCMP64mi8 i64mem:$src1, i64i8imm:$src2, cflags:$dcf, CC), 0>;
1221ca8092eSShengchen Kan}
1231ca8092eSShengchen Kan}
1241ca8092eSShengchen Kandefm : CCMP_Aliases<"o" ,  0>;
1251ca8092eSShengchen Kandefm : CCMP_Aliases<"no",  1>;
1261ca8092eSShengchen Kandefm : CCMP_Aliases<"b" ,  2>;
127*2c62d08bSFreddy Yedefm : CCMP_Aliases<"c" ,  2>;
128*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nae", 2>;
129*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nb",  3>;
130*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nc",  3>;
1311ca8092eSShengchen Kandefm : CCMP_Aliases<"ae",  3>;
1321ca8092eSShengchen Kandefm : CCMP_Aliases<"e" ,  4>;
133*2c62d08bSFreddy Yedefm : CCMP_Aliases<"z" ,  4>;
1341ca8092eSShengchen Kandefm : CCMP_Aliases<"ne",  5>;
135*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nz",  5>;
1361ca8092eSShengchen Kandefm : CCMP_Aliases<"be",  6>;
137*2c62d08bSFreddy Yedefm : CCMP_Aliases<"na",  6>;
138*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nbe", 7>;
1391ca8092eSShengchen Kandefm : CCMP_Aliases<"a" ,  7>;
1401ca8092eSShengchen Kandefm : CCMP_Aliases<"s" ,  8>;
1411ca8092eSShengchen Kandefm : CCMP_Aliases<"ns",  9>;
1421ca8092eSShengchen Kandefm : CCMP_Aliases<"t" , 10>;
1431ca8092eSShengchen Kandefm : CCMP_Aliases<"f", 11>;
1441ca8092eSShengchen Kandefm : CCMP_Aliases<"l" , 12>;
145*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nge",12>;
146*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nl", 13>;
1471ca8092eSShengchen Kandefm : CCMP_Aliases<"ge", 13>;
1481ca8092eSShengchen Kandefm : CCMP_Aliases<"le", 14>;
149*2c62d08bSFreddy Yedefm : CCMP_Aliases<"ng", 14>;
1501ca8092eSShengchen Kandefm : CCMP_Aliases<"g" , 15>;
151*2c62d08bSFreddy Yedefm : CCMP_Aliases<"nle",15>;
1521ca8092eSShengchen Kan
1531ca8092eSShengchen Kan// CTEST Instructions Alias
1541ca8092eSShengchen Kanmulticlass CTEST_Aliases<string Cond, int CC> {
1551ca8092eSShengchen Kanlet Predicates = [In64BitMode] in {
1561ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
1571ca8092eSShengchen Kan                (CTEST8rr  GR8:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
1581ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1591ca8092eSShengchen Kan                (CTEST16rr GR16:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
1601ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1611ca8092eSShengchen Kan                (CTEST32rr GR32:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
1621ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1631ca8092eSShengchen Kan                (CTEST64rr GR64:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
1641ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
1651ca8092eSShengchen Kan                (CTEST8mr  i8mem:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
1661ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1671ca8092eSShengchen Kan                (CTEST16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
1681ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1691ca8092eSShengchen Kan                (CTEST32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
1701ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1711ca8092eSShengchen Kan                (CTEST64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
1722e0c2154SFreddy Yedef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src1, $src2|$src2, $src1}",
1732e0c2154SFreddy Ye                (CTEST8mr  i8mem:$src1,  GR8:$src2,  cflags:$dcf, CC), 0>;
1742e0c2154SFreddy Yedef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src1, $src2|$src2, $src1}",
1752e0c2154SFreddy Ye                (CTEST16mr i16mem:$src1, GR16:$src2, cflags:$dcf, CC), 0>;
1762e0c2154SFreddy Yedef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src1, $src2|$src2, $src1}",
1772e0c2154SFreddy Ye                (CTEST32mr i32mem:$src1, GR32:$src2, cflags:$dcf, CC), 0>;
1782e0c2154SFreddy Yedef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src1, $src2|$src2, $src1}",
1792e0c2154SFreddy Ye                (CTEST64mr i64mem:$src1, GR64:$src2, cflags:$dcf, CC), 0>;
1801ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
1811ca8092eSShengchen Kan                (CTEST8ri  GR8:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
1821ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1831ca8092eSShengchen Kan                (CTEST16ri GR16:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
1841ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1851ca8092eSShengchen Kan                (CTEST32ri GR32:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
1861ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1871ca8092eSShengchen Kan                (CTEST64ri32 GR64:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
1881ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{b} $dcf\t{$src2, $src1|$src1, $src2}",
1891ca8092eSShengchen Kan                (CTEST8mi  i8mem:$src1,  i8imm:$src2,  cflags:$dcf, CC), 0>;
1901ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{w} $dcf\t{$src2, $src1|$src1, $src2}",
1911ca8092eSShengchen Kan                (CTEST16mi i16mem:$src1, i16imm:$src2, cflags:$dcf, CC), 0>;
1921ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{l} $dcf\t{$src2, $src1|$src1, $src2}",
1931ca8092eSShengchen Kan                (CTEST32mi i32mem:$src1, i32imm:$src2, cflags:$dcf, CC), 0>;
1941ca8092eSShengchen Kandef : InstAlias<"ctest"#Cond#"{q} $dcf\t{$src2, $src1|$src1, $src2}",
1951ca8092eSShengchen Kan                (CTEST64mi32 i64mem:$src1, i64i32imm:$src2, cflags:$dcf, CC), 0>;
1961ca8092eSShengchen Kan}
1971ca8092eSShengchen Kan}
1981ca8092eSShengchen Kandefm : CTEST_Aliases<"o" ,  0>;
1991ca8092eSShengchen Kandefm : CTEST_Aliases<"no",  1>;
2001ca8092eSShengchen Kandefm : CTEST_Aliases<"b" ,  2>;
201*2c62d08bSFreddy Yedefm : CTEST_Aliases<"c" ,  2>;
202*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nae", 2>;
203*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nb",  3>;
204*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nc",  3>;
2051ca8092eSShengchen Kandefm : CTEST_Aliases<"ae",  3>;
2061ca8092eSShengchen Kandefm : CTEST_Aliases<"e" ,  4>;
207*2c62d08bSFreddy Yedefm : CTEST_Aliases<"z" ,  4>;
2081ca8092eSShengchen Kandefm : CTEST_Aliases<"ne",  5>;
209*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nz",  5>;
2101ca8092eSShengchen Kandefm : CTEST_Aliases<"be",  6>;
211*2c62d08bSFreddy Yedefm : CTEST_Aliases<"na",  6>;
212*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nbe", 7>;
2131ca8092eSShengchen Kandefm : CTEST_Aliases<"a" ,  7>;
2141ca8092eSShengchen Kandefm : CTEST_Aliases<"s" ,  8>;
2151ca8092eSShengchen Kandefm : CTEST_Aliases<"ns",  9>;
2161ca8092eSShengchen Kandefm : CTEST_Aliases<"t" , 10>;
2171ca8092eSShengchen Kandefm : CTEST_Aliases<"f", 11>;
2181ca8092eSShengchen Kandefm : CTEST_Aliases<"l" , 12>;
219*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nge",12>;
220*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nl", 13>;
2211ca8092eSShengchen Kandefm : CTEST_Aliases<"ge", 13>;
2221ca8092eSShengchen Kandefm : CTEST_Aliases<"le", 14>;
223*2c62d08bSFreddy Yedefm : CTEST_Aliases<"ng", 14>;
2241ca8092eSShengchen Kandefm : CTEST_Aliases<"g" , 15>;
225*2c62d08bSFreddy Yedefm : CTEST_Aliases<"nle",15>;
2261ca8092eSShengchen Kan
227b9ea7327SWang, Xin10//===----------------------------------------------------------------------===//
228b9ea7327SWang, Xin10// Assembler Mnemonic Aliases
229b9ea7327SWang, Xin10//===----------------------------------------------------------------------===//
230b9ea7327SWang, Xin10
231b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"o" ,  0>;
232b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"no",  1>;
233b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"b" ,  2>;
234b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"ae",  3>;
235b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"e" ,  4>;
236b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"ne",  5>;
237b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"be",  6>;
238b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"a",   7>;
239b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"s" ,  8>;
240b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"ns",  9>;
241b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"p" , 10>;
242b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"np", 11>;
243b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"l" , 12>;
244b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"ge", 13>;
245b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"le", 14>;
246b9ea7327SWang, Xin10defm : CMPCCXADD_Aliases<"g",  15>;
247b9ea7327SWang, Xin10
248b9ea7327SWang, Xin10
249b9ea7327SWang, Xin10def : MnemonicAlias<"call", "callw", "att">, Requires<[In16BitMode]>;
250b9ea7327SWang, Xin10def : MnemonicAlias<"call", "calll", "att">, Requires<[In32BitMode]>;
251b9ea7327SWang, Xin10def : MnemonicAlias<"call", "callq", "att">, Requires<[In64BitMode]>;
252b9ea7327SWang, Xin10
253b9ea7327SWang, Xin10def : MnemonicAlias<"cbw",  "cbtw", "att">;
254b9ea7327SWang, Xin10def : MnemonicAlias<"cwde", "cwtl", "att">;
255b9ea7327SWang, Xin10def : MnemonicAlias<"cwd",  "cwtd", "att">;
256b9ea7327SWang, Xin10def : MnemonicAlias<"cdq",  "cltd", "att">;
257b9ea7327SWang, Xin10def : MnemonicAlias<"cdqe", "cltq", "att">;
258b9ea7327SWang, Xin10def : MnemonicAlias<"cqo",  "cqto", "att">;
259b9ea7327SWang, Xin10
260b9ea7327SWang, Xin10// In 64-bit mode lret maps to lretl; it is not ambiguous with lretq.
261b9ea7327SWang, Xin10def : MnemonicAlias<"lret", "lretw", "att">, Requires<[In16BitMode]>;
262b9ea7327SWang, Xin10def : MnemonicAlias<"lret", "lretl", "att">, Requires<[Not16BitMode]>;
263b9ea7327SWang, Xin10
264b9ea7327SWang, Xin10def : MnemonicAlias<"leavel", "leave", "att">, Requires<[Not64BitMode]>;
265b9ea7327SWang, Xin10def : MnemonicAlias<"leaveq", "leave", "att">, Requires<[In64BitMode]>;
266b9ea7327SWang, Xin10
267b9ea7327SWang, Xin10def : MnemonicAlias<"loopz",  "loope">;
268b9ea7327SWang, Xin10def : MnemonicAlias<"loopnz", "loopne">;
269b9ea7327SWang, Xin10
270b9ea7327SWang, Xin10def : MnemonicAlias<"pop",   "popw",  "att">, Requires<[In16BitMode]>;
271b9ea7327SWang, Xin10def : MnemonicAlias<"pop",   "popl",  "att">, Requires<[In32BitMode]>;
272b9ea7327SWang, Xin10def : MnemonicAlias<"pop",   "popq",  "att">, Requires<[In64BitMode]>;
273b9ea7327SWang, Xin10def : MnemonicAlias<"popf",  "popfw", "att">, Requires<[In16BitMode]>;
274b9ea7327SWang, Xin10def : MnemonicAlias<"popf",  "popfl", "att">, Requires<[In32BitMode]>;
275b9ea7327SWang, Xin10def : MnemonicAlias<"popf",  "popfq", "att">, Requires<[In64BitMode]>;
276b9ea7327SWang, Xin10def : MnemonicAlias<"popf",  "popfq", "intel">, Requires<[In64BitMode]>;
277b9ea7327SWang, Xin10def : MnemonicAlias<"popfd", "popfl", "att">;
278b9ea7327SWang, Xin10def : MnemonicAlias<"popfw", "popf",  "intel">, Requires<[In32BitMode]>;
279b9ea7327SWang, Xin10def : MnemonicAlias<"popfw", "popf",  "intel">, Requires<[In64BitMode]>;
280b9ea7327SWang, Xin10
281b9ea7327SWang, Xin10// FIXME: This is wrong for "push reg".  "push %bx" should turn into pushw in
282b9ea7327SWang, Xin10// all modes.  However: "push (addr)" and "push $42" should default to
283b9ea7327SWang, Xin10// pushl/pushq depending on the current mode.  Similar for "pop %bx"
284b9ea7327SWang, Xin10def : MnemonicAlias<"push",   "pushw",  "att">, Requires<[In16BitMode]>;
285b9ea7327SWang, Xin10def : MnemonicAlias<"push",   "pushl",  "att">, Requires<[In32BitMode]>;
286b9ea7327SWang, Xin10def : MnemonicAlias<"push",   "pushq",  "att">, Requires<[In64BitMode]>;
287b9ea7327SWang, Xin10def : MnemonicAlias<"pushf",  "pushfw", "att">, Requires<[In16BitMode]>;
288b9ea7327SWang, Xin10def : MnemonicAlias<"pushf",  "pushfl", "att">, Requires<[In32BitMode]>;
289b9ea7327SWang, Xin10def : MnemonicAlias<"pushf",  "pushfq", "att">, Requires<[In64BitMode]>;
290b9ea7327SWang, Xin10def : MnemonicAlias<"pushf",  "pushfq", "intel">, Requires<[In64BitMode]>;
291b9ea7327SWang, Xin10def : MnemonicAlias<"pushfd", "pushfl", "att">;
292b9ea7327SWang, Xin10def : MnemonicAlias<"pushfw", "pushf",  "intel">, Requires<[In32BitMode]>;
293b9ea7327SWang, Xin10def : MnemonicAlias<"pushfw", "pushf",  "intel">, Requires<[In64BitMode]>;
294b9ea7327SWang, Xin10
295b9ea7327SWang, Xin10def : MnemonicAlias<"popad",  "popal",  "intel">, Requires<[Not64BitMode]>;
296b9ea7327SWang, Xin10def : MnemonicAlias<"pushad", "pushal", "intel">, Requires<[Not64BitMode]>;
297b9ea7327SWang, Xin10def : MnemonicAlias<"popa",   "popaw",  "intel">, Requires<[In16BitMode]>;
298b9ea7327SWang, Xin10def : MnemonicAlias<"pusha",  "pushaw", "intel">, Requires<[In16BitMode]>;
299b9ea7327SWang, Xin10def : MnemonicAlias<"popa",   "popal",  "intel">, Requires<[In32BitMode]>;
300b9ea7327SWang, Xin10def : MnemonicAlias<"pusha",  "pushal", "intel">, Requires<[In32BitMode]>;
301b9ea7327SWang, Xin10
302b9ea7327SWang, Xin10def : MnemonicAlias<"popa",   "popaw",  "att">, Requires<[In16BitMode]>;
303b9ea7327SWang, Xin10def : MnemonicAlias<"pusha",  "pushaw", "att">, Requires<[In16BitMode]>;
304b9ea7327SWang, Xin10def : MnemonicAlias<"popa",   "popal",  "att">, Requires<[In32BitMode]>;
305b9ea7327SWang, Xin10def : MnemonicAlias<"pusha",  "pushal", "att">, Requires<[In32BitMode]>;
306b9ea7327SWang, Xin10
307b9ea7327SWang, Xin10def : MnemonicAlias<"repe",  "rep">;
308b9ea7327SWang, Xin10def : MnemonicAlias<"repz",  "rep">;
309b9ea7327SWang, Xin10def : MnemonicAlias<"repnz", "repne">;
310b9ea7327SWang, Xin10
311b9ea7327SWang, Xin10def : MnemonicAlias<"ret", "retw", "att">, Requires<[In16BitMode]>;
312b9ea7327SWang, Xin10def : MnemonicAlias<"ret", "retl", "att">, Requires<[In32BitMode]>;
313b9ea7327SWang, Xin10def : MnemonicAlias<"ret", "retq", "att">, Requires<[In64BitMode]>;
314b9ea7327SWang, Xin10
315b9ea7327SWang, Xin10// Apply 'ret' behavior to 'retn'
316b9ea7327SWang, Xin10def : MnemonicAlias<"retn", "retw", "att">, Requires<[In16BitMode]>;
317b9ea7327SWang, Xin10def : MnemonicAlias<"retn", "retl", "att">, Requires<[In32BitMode]>;
318b9ea7327SWang, Xin10def : MnemonicAlias<"retn", "retq", "att">, Requires<[In64BitMode]>;
319b9ea7327SWang, Xin10def : MnemonicAlias<"retn", "ret", "intel">;
320b9ea7327SWang, Xin10
321b9ea7327SWang, Xin10def : MnemonicAlias<"sal", "shl", "intel">;
322b9ea7327SWang, Xin10def : MnemonicAlias<"salb", "shlb", "att">;
323b9ea7327SWang, Xin10def : MnemonicAlias<"salw", "shlw", "att">;
324b9ea7327SWang, Xin10def : MnemonicAlias<"sall", "shll", "att">;
325b9ea7327SWang, Xin10def : MnemonicAlias<"salq", "shlq", "att">;
326b9ea7327SWang, Xin10
327b9ea7327SWang, Xin10def : MnemonicAlias<"smovb", "movsb", "att">;
328b9ea7327SWang, Xin10def : MnemonicAlias<"smovw", "movsw", "att">;
329b9ea7327SWang, Xin10def : MnemonicAlias<"smovl", "movsl", "att">;
330b9ea7327SWang, Xin10def : MnemonicAlias<"smovq", "movsq", "att">;
331b9ea7327SWang, Xin10
332b9ea7327SWang, Xin10def : MnemonicAlias<"ud2a",  "ud2",  "att">;
333b9ea7327SWang, Xin10def : MnemonicAlias<"ud2bw", "ud1w", "att">;
334b9ea7327SWang, Xin10def : MnemonicAlias<"ud2bl", "ud1l", "att">;
335b9ea7327SWang, Xin10def : MnemonicAlias<"ud2bq", "ud1q", "att">;
336b9ea7327SWang, Xin10def : MnemonicAlias<"verrw", "verr", "att">;
337b9ea7327SWang, Xin10
338b9ea7327SWang, Xin10// MS recognizes 'xacquire'/'xrelease' as 'acquire'/'release'
339b9ea7327SWang, Xin10def : MnemonicAlias<"acquire", "xacquire", "intel">;
340b9ea7327SWang, Xin10def : MnemonicAlias<"release", "xrelease", "intel">;
341b9ea7327SWang, Xin10
342b9ea7327SWang, Xin10// System instruction aliases.
343b9ea7327SWang, Xin10def : MnemonicAlias<"iret",    "iretw",    "att">, Requires<[In16BitMode]>;
344b9ea7327SWang, Xin10def : MnemonicAlias<"iret",    "iretl",    "att">, Requires<[Not16BitMode]>;
345b9ea7327SWang, Xin10def : MnemonicAlias<"sysret",  "sysretl",  "att">;
346b9ea7327SWang, Xin10def : MnemonicAlias<"sysexit", "sysexitl", "att">;
347b9ea7327SWang, Xin10
348b9ea7327SWang, Xin10def : MnemonicAlias<"lgdt", "lgdtw", "att">, Requires<[In16BitMode]>;
349b9ea7327SWang, Xin10def : MnemonicAlias<"lgdt", "lgdtl", "att">, Requires<[In32BitMode]>;
350b9ea7327SWang, Xin10def : MnemonicAlias<"lgdt", "lgdtq", "att">, Requires<[In64BitMode]>;
351b9ea7327SWang, Xin10def : MnemonicAlias<"lidt", "lidtw", "att">, Requires<[In16BitMode]>;
352b9ea7327SWang, Xin10def : MnemonicAlias<"lidt", "lidtl", "att">, Requires<[In32BitMode]>;
353b9ea7327SWang, Xin10def : MnemonicAlias<"lidt", "lidtq", "att">, Requires<[In64BitMode]>;
354b9ea7327SWang, Xin10def : MnemonicAlias<"sgdt", "sgdtw", "att">, Requires<[In16BitMode]>;
355b9ea7327SWang, Xin10def : MnemonicAlias<"sgdt", "sgdtl", "att">, Requires<[In32BitMode]>;
356b9ea7327SWang, Xin10def : MnemonicAlias<"sgdt", "sgdtq", "att">, Requires<[In64BitMode]>;
357b9ea7327SWang, Xin10def : MnemonicAlias<"sidt", "sidtw", "att">, Requires<[In16BitMode]>;
358b9ea7327SWang, Xin10def : MnemonicAlias<"sidt", "sidtl", "att">, Requires<[In32BitMode]>;
359b9ea7327SWang, Xin10def : MnemonicAlias<"sidt", "sidtq", "att">, Requires<[In64BitMode]>;
360b9ea7327SWang, Xin10def : MnemonicAlias<"lgdt", "lgdtw", "intel">, Requires<[In16BitMode]>;
361b9ea7327SWang, Xin10def : MnemonicAlias<"lgdt", "lgdtd", "intel">, Requires<[In32BitMode]>;
362b9ea7327SWang, Xin10def : MnemonicAlias<"lidt", "lidtw", "intel">, Requires<[In16BitMode]>;
363b9ea7327SWang, Xin10def : MnemonicAlias<"lidt", "lidtd", "intel">, Requires<[In32BitMode]>;
364b9ea7327SWang, Xin10def : MnemonicAlias<"sgdt", "sgdtw", "intel">, Requires<[In16BitMode]>;
365b9ea7327SWang, Xin10def : MnemonicAlias<"sgdt", "sgdtd", "intel">, Requires<[In32BitMode]>;
366b9ea7327SWang, Xin10def : MnemonicAlias<"sidt", "sidtw", "intel">, Requires<[In16BitMode]>;
367b9ea7327SWang, Xin10def : MnemonicAlias<"sidt", "sidtd", "intel">, Requires<[In32BitMode]>;
368b9ea7327SWang, Xin10
369b9ea7327SWang, Xin10
370b9ea7327SWang, Xin10// Floating point stack aliases.
371b9ea7327SWang, Xin10def : MnemonicAlias<"fcmovz",   "fcmove",   "att">;
372b9ea7327SWang, Xin10def : MnemonicAlias<"fcmova",   "fcmovnbe", "att">;
373b9ea7327SWang, Xin10def : MnemonicAlias<"fcmovnae", "fcmovb",   "att">;
374b9ea7327SWang, Xin10def : MnemonicAlias<"fcmovna",  "fcmovbe",  "att">;
375b9ea7327SWang, Xin10def : MnemonicAlias<"fcmovae",  "fcmovnb",  "att">;
376b9ea7327SWang, Xin10def : MnemonicAlias<"fcomip",   "fcompi">;
377b9ea7327SWang, Xin10def : MnemonicAlias<"fildq",    "fildll",   "att">;
378b9ea7327SWang, Xin10def : MnemonicAlias<"fistpq",   "fistpll",  "att">;
379b9ea7327SWang, Xin10def : MnemonicAlias<"fisttpq",  "fisttpll", "att">;
380b9ea7327SWang, Xin10def : MnemonicAlias<"fldcww",   "fldcw",    "att">;
381b9ea7327SWang, Xin10def : MnemonicAlias<"fnstcww",  "fnstcw",   "att">;
382b9ea7327SWang, Xin10def : MnemonicAlias<"fnstsww",  "fnstsw",   "att">;
383b9ea7327SWang, Xin10def : MnemonicAlias<"fucomip",  "fucompi">;
384b9ea7327SWang, Xin10def : MnemonicAlias<"fwait",    "wait">;
385b9ea7327SWang, Xin10
386b9ea7327SWang, Xin10def : MnemonicAlias<"fxsaveq",   "fxsave64",   "att">;
387b9ea7327SWang, Xin10def : MnemonicAlias<"fxrstorq",  "fxrstor64",  "att">;
388b9ea7327SWang, Xin10def : MnemonicAlias<"xsaveq",    "xsave64",    "att">;
389b9ea7327SWang, Xin10def : MnemonicAlias<"xrstorq",   "xrstor64",   "att">;
390b9ea7327SWang, Xin10def : MnemonicAlias<"xsaveoptq", "xsaveopt64", "att">;
391b9ea7327SWang, Xin10def : MnemonicAlias<"xrstorsq",  "xrstors64",  "att">;
392b9ea7327SWang, Xin10def : MnemonicAlias<"xsavecq",   "xsavec64",   "att">;
393b9ea7327SWang, Xin10def : MnemonicAlias<"xsavesq",   "xsaves64",   "att">;
394b9ea7327SWang, Xin10
395b9ea7327SWang, Xin10class CondCodeAlias<string Prefix,string Suffix, string OldCond, string NewCond,
396b9ea7327SWang, Xin10                    string VariantName>
397b9ea7327SWang, Xin10  : MnemonicAlias<!strconcat(Prefix, OldCond, Suffix),
398b9ea7327SWang, Xin10                  !strconcat(Prefix, NewCond, Suffix), VariantName>;
399b9ea7327SWang, Xin10
400b9ea7327SWang, Xin10/// IntegerCondCodeMnemonicAlias - This multiclass defines a bunch of
401b9ea7327SWang, Xin10/// MnemonicAlias's that canonicalize the condition code in a mnemonic, for
402b9ea7327SWang, Xin10/// example "setz" -> "sete".
403b9ea7327SWang, Xin10multiclass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix,
404b9ea7327SWang, Xin10                                        string V = ""> {
405b9ea7327SWang, Xin10  def C   : CondCodeAlias<Prefix, Suffix, "c",   "b",  V>; // setc   -> setb
406b9ea7327SWang, Xin10  def Z   : CondCodeAlias<Prefix, Suffix, "z" ,  "e",  V>; // setz   -> sete
407b9ea7327SWang, Xin10  def NA  : CondCodeAlias<Prefix, Suffix, "na",  "be", V>; // setna  -> setbe
408b9ea7327SWang, Xin10  def NB  : CondCodeAlias<Prefix, Suffix, "nb",  "ae", V>; // setnb  -> setae
409b9ea7327SWang, Xin10  def NC  : CondCodeAlias<Prefix, Suffix, "nc",  "ae", V>; // setnc  -> setae
410b9ea7327SWang, Xin10  def NG  : CondCodeAlias<Prefix, Suffix, "ng",  "le", V>; // setng  -> setle
411b9ea7327SWang, Xin10  def NL  : CondCodeAlias<Prefix, Suffix, "nl",  "ge", V>; // setnl  -> setge
412b9ea7327SWang, Xin10  def NZ  : CondCodeAlias<Prefix, Suffix, "nz",  "ne", V>; // setnz  -> setne
413b9ea7327SWang, Xin10  def PE  : CondCodeAlias<Prefix, Suffix, "pe",  "p",  V>; // setpe  -> setp
414b9ea7327SWang, Xin10  def PO  : CondCodeAlias<Prefix, Suffix, "po",  "np", V>; // setpo  -> setnp
415b9ea7327SWang, Xin10
416b9ea7327SWang, Xin10  def NAE : CondCodeAlias<Prefix, Suffix, "nae", "b",  V>; // setnae -> setb
417b9ea7327SWang, Xin10  def NBE : CondCodeAlias<Prefix, Suffix, "nbe", "a",  V>; // setnbe -> seta
418b9ea7327SWang, Xin10  def NGE : CondCodeAlias<Prefix, Suffix, "nge", "l",  V>; // setnge -> setl
419b9ea7327SWang, Xin10  def NLE : CondCodeAlias<Prefix, Suffix, "nle", "g",  V>; // setnle -> setg
420b9ea7327SWang, Xin10}
421b9ea7327SWang, Xin10
422b9ea7327SWang, Xin10// Aliases for set<CC>
423b9ea7327SWang, Xin10defm : IntegerCondCodeMnemonicAlias<"set", "">;
424*2c62d08bSFreddy Yedefm : IntegerCondCodeMnemonicAlias<"setzu", "">;
425b9ea7327SWang, Xin10// Aliases for j<CC>
426b9ea7327SWang, Xin10defm : IntegerCondCodeMnemonicAlias<"j", "">;
427b9ea7327SWang, Xin10// Aliases for cmov<CC>{w,l,q}
428b9ea7327SWang, Xin10defm : IntegerCondCodeMnemonicAlias<"cmov", "w", "att">;
429b9ea7327SWang, Xin10defm : IntegerCondCodeMnemonicAlias<"cmov", "l", "att">;
430b9ea7327SWang, Xin10defm : IntegerCondCodeMnemonicAlias<"cmov", "q", "att">;
431b9ea7327SWang, Xin10// No size suffix for intel-style asm.
432b9ea7327SWang, Xin10defm : IntegerCondCodeMnemonicAlias<"cmov", "", "intel">;
433b9ea7327SWang, Xin10
4347b766a6fSXinWang10// Aliases for cfcmov<CC>{w,l,q}
4357b766a6fSXinWang10defm : IntegerCondCodeMnemonicAlias<"cfcmov", "w", "att">;
4367b766a6fSXinWang10defm : IntegerCondCodeMnemonicAlias<"cfcmov", "l", "att">;
4377b766a6fSXinWang10defm : IntegerCondCodeMnemonicAlias<"cfcmov", "q", "att">;
4387b766a6fSXinWang10// No size suffix for intel-style asm.
4397b766a6fSXinWang10defm : IntegerCondCodeMnemonicAlias<"cfcmov", "", "intel">;
440*2c62d08bSFreddy Ye
441*2c62d08bSFreddy Ye// Aliases for cmp<CC>xadd
442*2c62d08bSFreddy Yedefm : IntegerCondCodeMnemonicAlias<"cmp", "xadd", "">;
443b9ea7327SWang, Xin10//===----------------------------------------------------------------------===//
444b9ea7327SWang, Xin10// Assembler Instruction Aliases
445b9ea7327SWang, Xin10//===----------------------------------------------------------------------===//
446b9ea7327SWang, Xin10
447b9ea7327SWang, Xin10// aad/aam default to base 10 if no operand is specified.
448b9ea7327SWang, Xin10def : InstAlias<"aad", (AAD8i8 10)>, Requires<[Not64BitMode]>;
449b9ea7327SWang, Xin10def : InstAlias<"aam", (AAM8i8 10)>, Requires<[Not64BitMode]>;
450b9ea7327SWang, Xin10
451b9ea7327SWang, Xin10// Disambiguate the mem/imm form of bt-without-a-suffix as btl.
452b9ea7327SWang, Xin10// Likewise for btc/btr/bts.
453b9ea7327SWang, Xin10def : InstAlias<"bt\t{$imm, $mem|$mem, $imm}",
454b9ea7327SWang, Xin10                (BT32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
455b9ea7327SWang, Xin10def : InstAlias<"btc\t{$imm, $mem|$mem, $imm}",
456b9ea7327SWang, Xin10                (BTC32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
457b9ea7327SWang, Xin10def : InstAlias<"btr\t{$imm, $mem|$mem, $imm}",
458b9ea7327SWang, Xin10                (BTR32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
459b9ea7327SWang, Xin10def : InstAlias<"bts\t{$imm, $mem|$mem, $imm}",
460b9ea7327SWang, Xin10                (BTS32mi8 i32mem:$mem, i32u8imm:$imm), 0, "att">;
461b9ea7327SWang, Xin10
462b9ea7327SWang, Xin10// clr aliases.
463b9ea7327SWang, Xin10def : InstAlias<"clr{b}\t$reg", (XOR8rr  GR8 :$reg, GR8 :$reg), 0>;
464b9ea7327SWang, Xin10def : InstAlias<"clr{w}\t$reg", (XOR16rr GR16:$reg, GR16:$reg), 0>;
465b9ea7327SWang, Xin10def : InstAlias<"clr{l}\t$reg", (XOR32rr GR32:$reg, GR32:$reg), 0>;
466b9ea7327SWang, Xin10def : InstAlias<"clr{q}\t$reg", (XOR64rr GR64:$reg, GR64:$reg), 0>;
467b9ea7327SWang, Xin10
468b9ea7327SWang, Xin10// lods aliases. Accept the destination being omitted because it's implicit
469b9ea7327SWang, Xin10// in the mnemonic, or the mnemonic suffix being omitted because it's implicit
470b9ea7327SWang, Xin10// in the destination.
471b9ea7327SWang, Xin10def : InstAlias<"lodsb\t$src", (LODSB srcidx8:$src),  0>;
472b9ea7327SWang, Xin10def : InstAlias<"lodsw\t$src", (LODSW srcidx16:$src), 0>;
473b9ea7327SWang, Xin10def : InstAlias<"lods{l|d}\t$src", (LODSL srcidx32:$src), 0>;
474b9ea7327SWang, Xin10def : InstAlias<"lodsq\t$src", (LODSQ srcidx64:$src), 0>, Requires<[In64BitMode]>;
475b9ea7327SWang, Xin10def : InstAlias<"lods\t{$src, %al|al, $src}", (LODSB srcidx8:$src),  0>;
476b9ea7327SWang, Xin10def : InstAlias<"lods\t{$src, %ax|ax, $src}", (LODSW srcidx16:$src), 0>;
477b9ea7327SWang, Xin10def : InstAlias<"lods\t{$src, %eax|eax, $src}", (LODSL srcidx32:$src), 0>;
478b9ea7327SWang, Xin10def : InstAlias<"lods\t{$src, %rax|rax, $src}", (LODSQ srcidx64:$src), 0>, Requires<[In64BitMode]>;
479b9ea7327SWang, Xin10def : InstAlias<"lods\t$src", (LODSB srcidx8:$src),  0, "intel">;
480b9ea7327SWang, Xin10def : InstAlias<"lods\t$src", (LODSW srcidx16:$src), 0, "intel">;
481b9ea7327SWang, Xin10def : InstAlias<"lods\t$src", (LODSL srcidx32:$src), 0, "intel">;
482b9ea7327SWang, Xin10def : InstAlias<"lods\t$src", (LODSQ srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
483b9ea7327SWang, Xin10
484b9ea7327SWang, Xin10
485b9ea7327SWang, Xin10// stos aliases. Accept the source being omitted because it's implicit in
486b9ea7327SWang, Xin10// the mnemonic, or the mnemonic suffix being omitted because it's implicit
487b9ea7327SWang, Xin10// in the source.
488b9ea7327SWang, Xin10def : InstAlias<"stosb\t$dst", (STOSB dstidx8:$dst),  0>;
489b9ea7327SWang, Xin10def : InstAlias<"stosw\t$dst", (STOSW dstidx16:$dst), 0>;
490b9ea7327SWang, Xin10def : InstAlias<"stos{l|d}\t$dst", (STOSL dstidx32:$dst), 0>;
491b9ea7327SWang, Xin10def : InstAlias<"stosq\t$dst", (STOSQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
492b9ea7327SWang, Xin10def : InstAlias<"stos\t{%al, $dst|$dst, al}", (STOSB dstidx8:$dst),  0>;
493b9ea7327SWang, Xin10def : InstAlias<"stos\t{%ax, $dst|$dst, ax}", (STOSW dstidx16:$dst), 0>;
494b9ea7327SWang, Xin10def : InstAlias<"stos\t{%eax, $dst|$dst, eax}", (STOSL dstidx32:$dst), 0>;
495b9ea7327SWang, Xin10def : InstAlias<"stos\t{%rax, $dst|$dst, rax}", (STOSQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
496b9ea7327SWang, Xin10def : InstAlias<"stos\t$dst", (STOSB dstidx8:$dst),  0, "intel">;
497b9ea7327SWang, Xin10def : InstAlias<"stos\t$dst", (STOSW dstidx16:$dst), 0, "intel">;
498b9ea7327SWang, Xin10def : InstAlias<"stos\t$dst", (STOSL dstidx32:$dst), 0, "intel">;
499b9ea7327SWang, Xin10def : InstAlias<"stos\t$dst", (STOSQ dstidx64:$dst), 0, "intel">, Requires<[In64BitMode]>;
500b9ea7327SWang, Xin10
501b9ea7327SWang, Xin10
502b9ea7327SWang, Xin10// scas aliases. Accept the destination being omitted because it's implicit
503b9ea7327SWang, Xin10// in the mnemonic, or the mnemonic suffix being omitted because it's implicit
504b9ea7327SWang, Xin10// in the destination.
505b9ea7327SWang, Xin10def : InstAlias<"scasb\t$dst", (SCASB dstidx8:$dst),  0>;
506b9ea7327SWang, Xin10def : InstAlias<"scasw\t$dst", (SCASW dstidx16:$dst), 0>;
507b9ea7327SWang, Xin10def : InstAlias<"scas{l|d}\t$dst", (SCASL dstidx32:$dst), 0>;
508b9ea7327SWang, Xin10def : InstAlias<"scasq\t$dst", (SCASQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
509b9ea7327SWang, Xin10def : InstAlias<"scas\t{$dst, %al|al, $dst}", (SCASB dstidx8:$dst),  0>;
510b9ea7327SWang, Xin10def : InstAlias<"scas\t{$dst, %ax|ax, $dst}", (SCASW dstidx16:$dst), 0>;
511b9ea7327SWang, Xin10def : InstAlias<"scas\t{$dst, %eax|eax, $dst}", (SCASL dstidx32:$dst), 0>;
512b9ea7327SWang, Xin10def : InstAlias<"scas\t{$dst, %rax|rax, $dst}", (SCASQ dstidx64:$dst), 0>, Requires<[In64BitMode]>;
513b9ea7327SWang, Xin10def : InstAlias<"scas\t$dst", (SCASB dstidx8:$dst),  0, "intel">;
514b9ea7327SWang, Xin10def : InstAlias<"scas\t$dst", (SCASW dstidx16:$dst), 0, "intel">;
515b9ea7327SWang, Xin10def : InstAlias<"scas\t$dst", (SCASL dstidx32:$dst), 0, "intel">;
516b9ea7327SWang, Xin10def : InstAlias<"scas\t$dst", (SCASQ dstidx64:$dst), 0, "intel">, Requires<[In64BitMode]>;
517b9ea7327SWang, Xin10
518b9ea7327SWang, Xin10// cmps aliases. Mnemonic suffix being omitted because it's implicit
519b9ea7327SWang, Xin10// in the destination.
520b9ea7327SWang, Xin10def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSB dstidx8:$dst, srcidx8:$src),   0, "intel">;
521b9ea7327SWang, Xin10def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSW dstidx16:$dst, srcidx16:$src), 0, "intel">;
522b9ea7327SWang, Xin10def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSL dstidx32:$dst, srcidx32:$src), 0, "intel">;
523b9ea7327SWang, Xin10def : InstAlias<"cmps\t{$dst, $src|$src, $dst}", (CMPSQ dstidx64:$dst, srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
524b9ea7327SWang, Xin10
525b9ea7327SWang, Xin10// movs aliases. Mnemonic suffix being omitted because it's implicit
526b9ea7327SWang, Xin10// in the destination.
527b9ea7327SWang, Xin10def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSB dstidx8:$dst, srcidx8:$src),   0, "intel">;
528b9ea7327SWang, Xin10def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSW dstidx16:$dst, srcidx16:$src), 0, "intel">;
529b9ea7327SWang, Xin10def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSL dstidx32:$dst, srcidx32:$src), 0, "intel">;
530b9ea7327SWang, Xin10def : InstAlias<"movs\t{$src, $dst|$dst, $src}", (MOVSQ dstidx64:$dst, srcidx64:$src), 0, "intel">, Requires<[In64BitMode]>;
531b9ea7327SWang, Xin10
532b9ea7327SWang, Xin10// div and idiv aliases for explicit A register.
533b9ea7327SWang, Xin10def : InstAlias<"div{b}\t{$src, %al|al, $src}", (DIV8r  GR8 :$src)>;
534b9ea7327SWang, Xin10def : InstAlias<"div{w}\t{$src, %ax|ax, $src}", (DIV16r GR16:$src)>;
535b9ea7327SWang, Xin10def : InstAlias<"div{l}\t{$src, %eax|eax, $src}", (DIV32r GR32:$src)>;
536b9ea7327SWang, Xin10def : InstAlias<"div{q}\t{$src, %rax|rax, $src}", (DIV64r GR64:$src)>;
537b9ea7327SWang, Xin10def : InstAlias<"div{b}\t{$src, %al|al, $src}", (DIV8m  i8mem :$src)>;
538b9ea7327SWang, Xin10def : InstAlias<"div{w}\t{$src, %ax|ax, $src}", (DIV16m i16mem:$src)>;
539b9ea7327SWang, Xin10def : InstAlias<"div{l}\t{$src, %eax|eax, $src}", (DIV32m i32mem:$src)>;
540b9ea7327SWang, Xin10def : InstAlias<"div{q}\t{$src, %rax|rax, $src}", (DIV64m i64mem:$src)>;
541b9ea7327SWang, Xin10def : InstAlias<"idiv{b}\t{$src, %al|al, $src}", (IDIV8r  GR8 :$src)>;
542b9ea7327SWang, Xin10def : InstAlias<"idiv{w}\t{$src, %ax|ax, $src}", (IDIV16r GR16:$src)>;
543b9ea7327SWang, Xin10def : InstAlias<"idiv{l}\t{$src, %eax|eax, $src}", (IDIV32r GR32:$src)>;
544b9ea7327SWang, Xin10def : InstAlias<"idiv{q}\t{$src, %rax|rax, $src}", (IDIV64r GR64:$src)>;
545b9ea7327SWang, Xin10def : InstAlias<"idiv{b}\t{$src, %al|al, $src}", (IDIV8m  i8mem :$src)>;
546b9ea7327SWang, Xin10def : InstAlias<"idiv{w}\t{$src, %ax|ax, $src}", (IDIV16m i16mem:$src)>;
547b9ea7327SWang, Xin10def : InstAlias<"idiv{l}\t{$src, %eax|eax, $src}", (IDIV32m i32mem:$src)>;
548b9ea7327SWang, Xin10def : InstAlias<"idiv{q}\t{$src, %rax|rax, $src}", (IDIV64m i64mem:$src)>;
549b9ea7327SWang, Xin10
550b9ea7327SWang, Xin10
551b9ea7327SWang, Xin10
552b9ea7327SWang, Xin10// Various unary fpstack operations default to operating on ST1.
553b9ea7327SWang, Xin10// For example, "fxch" -> "fxch %st(1)"
554b9ea7327SWang, Xin10def : InstAlias<"faddp",        (ADD_FPrST0  ST1), 0>;
555b9ea7327SWang, Xin10def:  InstAlias<"fadd",         (ADD_FPrST0  ST1), 0>;
556b9ea7327SWang, Xin10def : InstAlias<"fsub{|r}p",    (SUBR_FPrST0 ST1), 0>;
557b9ea7327SWang, Xin10def : InstAlias<"fsub{r|}p",    (SUB_FPrST0  ST1), 0>;
558b9ea7327SWang, Xin10def : InstAlias<"fmul",         (MUL_FPrST0  ST1), 0>;
559b9ea7327SWang, Xin10def : InstAlias<"fmulp",        (MUL_FPrST0  ST1), 0>;
560b9ea7327SWang, Xin10def : InstAlias<"fdiv{|r}p",    (DIVR_FPrST0 ST1), 0>;
561b9ea7327SWang, Xin10def : InstAlias<"fdiv{r|}p",    (DIV_FPrST0  ST1), 0>;
562b9ea7327SWang, Xin10def : InstAlias<"fxch",         (XCH_F       ST1), 0>;
563b9ea7327SWang, Xin10def : InstAlias<"fcom",         (COM_FST0r   ST1), 0>;
564b9ea7327SWang, Xin10def : InstAlias<"fcomp",        (COMP_FST0r  ST1), 0>;
565b9ea7327SWang, Xin10def : InstAlias<"fcomi",        (COM_FIr     ST1), 0>;
566b9ea7327SWang, Xin10def : InstAlias<"fcompi",       (COM_FIPr    ST1), 0>;
567b9ea7327SWang, Xin10def : InstAlias<"fucom",        (UCOM_Fr     ST1), 0>;
568b9ea7327SWang, Xin10def : InstAlias<"fucomp",       (UCOM_FPr    ST1), 0>;
569b9ea7327SWang, Xin10def : InstAlias<"fucomi",       (UCOM_FIr    ST1), 0>;
570b9ea7327SWang, Xin10def : InstAlias<"fucompi",      (UCOM_FIPr   ST1), 0>;
571b9ea7327SWang, Xin10
572b9ea7327SWang, Xin10// Handle fmul/fadd/fsub/fdiv instructions with explicitly written st(0) op.
573b9ea7327SWang, Xin10// For example, "fadd %st(4), %st(0)" -> "fadd %st(4)".  We also disambiguate
574b9ea7327SWang, Xin10// instructions like "fadd %st(0), %st(0)" as "fadd %st(0)" for consistency with
575b9ea7327SWang, Xin10// gas.
576b9ea7327SWang, Xin10multiclass FpUnaryAlias<string Mnemonic, Instruction Inst, bit EmitAlias = 1> {
577b9ea7327SWang, Xin10 def : InstAlias<!strconcat(Mnemonic, "\t$op"),
578b9ea7327SWang, Xin10                 (Inst RSTi:$op), EmitAlias>;
579b9ea7327SWang, Xin10 def : InstAlias<!strconcat(Mnemonic, "\t{%st, %st|st, st}"),
580b9ea7327SWang, Xin10                 (Inst ST0), EmitAlias>;
581b9ea7327SWang, Xin10}
582b9ea7327SWang, Xin10
583b9ea7327SWang, Xin10defm : FpUnaryAlias<"fadd",   ADD_FST0r, 0>;
584b9ea7327SWang, Xin10defm : FpUnaryAlias<"faddp",  ADD_FPrST0, 0>;
585b9ea7327SWang, Xin10defm : FpUnaryAlias<"fsub",   SUB_FST0r, 0>;
586b9ea7327SWang, Xin10defm : FpUnaryAlias<"fsub{|r}p",  SUBR_FPrST0, 0>;
587b9ea7327SWang, Xin10defm : FpUnaryAlias<"fsubr",  SUBR_FST0r, 0>;
588b9ea7327SWang, Xin10defm : FpUnaryAlias<"fsub{r|}p", SUB_FPrST0, 0>;
589b9ea7327SWang, Xin10defm : FpUnaryAlias<"fmul",   MUL_FST0r, 0>;
590b9ea7327SWang, Xin10defm : FpUnaryAlias<"fmulp",  MUL_FPrST0, 0>;
591b9ea7327SWang, Xin10defm : FpUnaryAlias<"fdiv",   DIV_FST0r, 0>;
592b9ea7327SWang, Xin10defm : FpUnaryAlias<"fdiv{|r}p",  DIVR_FPrST0, 0>;
593b9ea7327SWang, Xin10defm : FpUnaryAlias<"fdivr",  DIVR_FST0r, 0>;
594b9ea7327SWang, Xin10defm : FpUnaryAlias<"fdiv{r|}p", DIV_FPrST0, 0>;
595b9ea7327SWang, Xin10defm : FpUnaryAlias<"fcomi",   COM_FIr, 0>;
596b9ea7327SWang, Xin10defm : FpUnaryAlias<"fucomi",  UCOM_FIr, 0>;
597b9ea7327SWang, Xin10defm : FpUnaryAlias<"fcompi",   COM_FIPr, 0>;
598b9ea7327SWang, Xin10defm : FpUnaryAlias<"fucompi",  UCOM_FIPr, 0>;
599b9ea7327SWang, Xin10
600b9ea7327SWang, Xin10
601b9ea7327SWang, Xin10// Handle "f{mulp,addp} $op, %st(0)" the same as "f{mulp,addp} $op", since they
602b9ea7327SWang, Xin10// commute.  We also allow fdiv[r]p/fsubrp even though they don't commute,
603b9ea7327SWang, Xin10// solely because gas supports it.
604b9ea7327SWang, Xin10def : InstAlias<"faddp\t{$op, %st|st, $op}", (ADD_FPrST0 RSTi:$op), 0>;
605b9ea7327SWang, Xin10def : InstAlias<"fmulp\t{$op, %st|st, $op}", (MUL_FPrST0 RSTi:$op), 0>;
606b9ea7327SWang, Xin10def : InstAlias<"fsub{|r}p\t{$op, %st|st, $op}", (SUBR_FPrST0 RSTi:$op), 0>;
607b9ea7327SWang, Xin10def : InstAlias<"fsub{r|}p\t{$op, %st|st, $op}", (SUB_FPrST0 RSTi:$op), 0>;
608b9ea7327SWang, Xin10def : InstAlias<"fdiv{|r}p\t{$op, %st|st, $op}", (DIVR_FPrST0 RSTi:$op), 0>;
609b9ea7327SWang, Xin10def : InstAlias<"fdiv{r|}p\t{$op, %st|st, $op}", (DIV_FPrST0 RSTi:$op), 0>;
610b9ea7327SWang, Xin10
611b9ea7327SWang, Xin10def : InstAlias<"fnstsw"     , (FNSTSW16r), 0>;
612b9ea7327SWang, Xin10
613b9ea7327SWang, Xin10// lcall and ljmp aliases.  This seems to be an odd mapping in 64-bit mode, but
614b9ea7327SWang, Xin10// this is compatible with what GAS does.
615b9ea7327SWang, Xin10def : InstAlias<"lcall\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg), 0>, Requires<[In32BitMode]>;
616b9ea7327SWang, Xin10def : InstAlias<"ljmp\t$seg, $off",  (FARJMP32i  i32imm:$off, i16imm:$seg), 0>, Requires<[In32BitMode]>;
617b9ea7327SWang, Xin10def : InstAlias<"lcall\t{*}$dst",    (FARCALL32m opaquemem:$dst), 0>, Requires<[Not16BitMode]>;
618b9ea7327SWang, Xin10def : InstAlias<"ljmp\t{*}$dst",     (FARJMP32m  opaquemem:$dst), 0>, Requires<[Not16BitMode]>;
619b9ea7327SWang, Xin10def : InstAlias<"lcall\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg), 0>, Requires<[In16BitMode]>;
620b9ea7327SWang, Xin10def : InstAlias<"ljmp\t$seg, $off",  (FARJMP16i  i16imm:$off, i16imm:$seg), 0>, Requires<[In16BitMode]>;
621b9ea7327SWang, Xin10def : InstAlias<"lcall\t{*}$dst",    (FARCALL16m opaquemem:$dst), 0>, Requires<[In16BitMode]>;
622b9ea7327SWang, Xin10def : InstAlias<"ljmp\t{*}$dst",     (FARJMP16m  opaquemem:$dst), 0>, Requires<[In16BitMode]>;
623b9ea7327SWang, Xin10
624b9ea7327SWang, Xin10def : InstAlias<"jmp\t{*}$dst",      (JMP64m  i64mem:$dst), 0, "att">, Requires<[In64BitMode]>;
625b9ea7327SWang, Xin10def : InstAlias<"jmp\t{*}$dst",      (JMP32m  i32mem:$dst), 0, "att">, Requires<[In32BitMode]>;
626b9ea7327SWang, Xin10def : InstAlias<"jmp\t{*}$dst",      (JMP16m  i16mem:$dst), 0, "att">, Requires<[In16BitMode]>;
627b9ea7327SWang, Xin10
628b9ea7327SWang, Xin10
629b9ea7327SWang, Xin10// "imul <imm>, B" is an alias for "imul <imm>, B, B".
630b9ea7327SWang, Xin10def : InstAlias<"imul{w}\t{$imm, $r|$r, $imm}", (IMUL16rri  GR16:$r, GR16:$r, i16imm:$imm), 0>;
631b9ea7327SWang, Xin10def : InstAlias<"imul{w}\t{$imm, $r|$r, $imm}", (IMUL16rri8 GR16:$r, GR16:$r, i16i8imm:$imm), 0>;
632b9ea7327SWang, Xin10def : InstAlias<"imul{l}\t{$imm, $r|$r, $imm}", (IMUL32rri  GR32:$r, GR32:$r, i32imm:$imm), 0>;
633b9ea7327SWang, Xin10def : InstAlias<"imul{l}\t{$imm, $r|$r, $imm}", (IMUL32rri8 GR32:$r, GR32:$r, i32i8imm:$imm), 0>;
634b9ea7327SWang, Xin10def : InstAlias<"imul{q}\t{$imm, $r|$r, $imm}", (IMUL64rri32 GR64:$r, GR64:$r, i64i32imm:$imm), 0>;
635b9ea7327SWang, Xin10def : InstAlias<"imul{q}\t{$imm, $r|$r, $imm}", (IMUL64rri8 GR64:$r, GR64:$r, i64i8imm:$imm), 0>;
636b9ea7327SWang, Xin10
637b9ea7327SWang, Xin10// ins aliases. Accept the mnemonic suffix being omitted because it's implicit
638b9ea7327SWang, Xin10// in the destination.
639b9ea7327SWang, Xin10def : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSB dstidx8:$dst),  0, "intel">;
640b9ea7327SWang, Xin10def : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSW dstidx16:$dst), 0, "intel">;
641b9ea7327SWang, Xin10def : InstAlias<"ins\t{%dx, $dst|$dst, dx}", (INSL dstidx32:$dst), 0, "intel">;
642b9ea7327SWang, Xin10
643b9ea7327SWang, Xin10// outs aliases. Accept the mnemonic suffix being omitted because it's implicit
644b9ea7327SWang, Xin10// in the source.
645b9ea7327SWang, Xin10def : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSB srcidx8:$src),  0, "intel">;
646b9ea7327SWang, Xin10def : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSW srcidx16:$src), 0, "intel">;
647b9ea7327SWang, Xin10def : InstAlias<"outs\t{$src, %dx|dx, $src}", (OUTSL srcidx32:$src), 0, "intel">;
648b9ea7327SWang, Xin10
649b9ea7327SWang, Xin10// inb %dx -> inb %al, %dx
650b9ea7327SWang, Xin10def : InstAlias<"inb\t{%dx|dx}", (IN8rr), 0>;
651b9ea7327SWang, Xin10def : InstAlias<"inw\t{%dx|dx}", (IN16rr), 0>;
652b9ea7327SWang, Xin10def : InstAlias<"inl\t{%dx|dx}", (IN32rr), 0>;
653b9ea7327SWang, Xin10def : InstAlias<"inb\t$port", (IN8ri u8imm:$port), 0>;
654b9ea7327SWang, Xin10def : InstAlias<"inw\t$port", (IN16ri u8imm:$port), 0>;
655b9ea7327SWang, Xin10def : InstAlias<"inl\t$port", (IN32ri u8imm:$port), 0>;
656b9ea7327SWang, Xin10
657b9ea7327SWang, Xin10
658b9ea7327SWang, Xin10// jmp and call aliases for lcall and ljmp.  jmp $42,$5 -> ljmp
659b9ea7327SWang, Xin10def : InstAlias<"call\t$seg, $off",  (FARCALL16i i16imm:$off, i16imm:$seg)>, Requires<[In16BitMode]>;
660b9ea7327SWang, Xin10def : InstAlias<"jmp\t$seg, $off",   (FARJMP16i  i16imm:$off, i16imm:$seg)>, Requires<[In16BitMode]>;
661b9ea7327SWang, Xin10def : InstAlias<"call\t$seg, $off",  (FARCALL32i i32imm:$off, i16imm:$seg)>, Requires<[In32BitMode]>;
662b9ea7327SWang, Xin10def : InstAlias<"jmp\t$seg, $off",   (FARJMP32i  i32imm:$off, i16imm:$seg)>, Requires<[In32BitMode]>;
663b9ea7327SWang, Xin10def : InstAlias<"callw\t$seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
664b9ea7327SWang, Xin10def : InstAlias<"jmpw\t$seg, $off",  (FARJMP16i  i16imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
665b9ea7327SWang, Xin10def : InstAlias<"calll\t$seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
666b9ea7327SWang, Xin10def : InstAlias<"jmpl\t$seg, $off",  (FARJMP32i  i32imm:$off, i16imm:$seg)>, Requires<[Not64BitMode]>;
667b9ea7327SWang, Xin10
668b9ea7327SWang, Xin10// Match 'movq <largeimm>, <reg>' as an alias for movabsq.
669b9ea7327SWang, Xin10def : InstAlias<"mov{q}\t{$imm, $reg|$reg, $imm}", (MOV64ri GR64:$reg, i64imm:$imm), 0>;
670b9ea7327SWang, Xin10
671b9ea7327SWang, Xin10// Match 'movd GR64, MMX' as an alias for movq to be compatible with gas,
672b9ea7327SWang, Xin10// which supports this due to an old AMD documentation bug when 64-bit mode was
673b9ea7327SWang, Xin10// created.
674b9ea7327SWang, Xin10def : InstAlias<"movd\t{$src, $dst|$dst, $src}",
675b9ea7327SWang, Xin10                (MMX_MOVD64to64rr VR64:$dst, GR64:$src), 0>;
676b9ea7327SWang, Xin10def : InstAlias<"movd\t{$src, $dst|$dst, $src}",
677b9ea7327SWang, Xin10                (MMX_MOVD64from64rr GR64:$dst, VR64:$src), 0>;
678b9ea7327SWang, Xin10
679b9ea7327SWang, Xin10// movsx aliases
680b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX16rr8 GR16:$dst, GR8:$src), 0, "att">;
681b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX16rm8 GR16:$dst, i8mem:$src), 0, "att">;
682b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX32rr8 GR32:$dst, GR8:$src), 0, "att">;
683b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX32rr16 GR32:$dst, GR16:$src), 0, "att">;
684b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr8 GR64:$dst, GR8:$src), 0, "att">;
685b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr16 GR64:$dst, GR16:$src), 0, "att">;
686b9ea7327SWang, Xin10def : InstAlias<"movsx\t{$src, $dst|$dst, $src}", (MOVSX64rr32 GR64:$dst, GR32:$src), 0, "att">;
687b9ea7327SWang, Xin10
688b9ea7327SWang, Xin10// movzx aliases
689b9ea7327SWang, Xin10def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX16rr8 GR16:$dst, GR8:$src), 0, "att">;
690b9ea7327SWang, Xin10def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX16rm8 GR16:$dst, i8mem:$src), 0, "att">;
691b9ea7327SWang, Xin10def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX32rr8 GR32:$dst, GR8:$src), 0, "att">;
692b9ea7327SWang, Xin10def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX32rr16 GR32:$dst, GR16:$src), 0, "att">;
693b9ea7327SWang, Xin10def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX64rr8 GR64:$dst, GR8:$src), 0, "att">;
694b9ea7327SWang, Xin10def : InstAlias<"movzx\t{$src, $dst|$dst, $src}", (MOVZX64rr16 GR64:$dst, GR16:$src), 0, "att">;
695b9ea7327SWang, Xin10// Note: No GR32->GR64 movzx form.
696b9ea7327SWang, Xin10
697b9ea7327SWang, Xin10// outb %dx -> outb %al, %dx
698b9ea7327SWang, Xin10def : InstAlias<"outb\t{%dx|dx}", (OUT8rr), 0>;
699b9ea7327SWang, Xin10def : InstAlias<"outw\t{%dx|dx}", (OUT16rr), 0>;
700b9ea7327SWang, Xin10def : InstAlias<"outl\t{%dx|dx}", (OUT32rr), 0>;
701b9ea7327SWang, Xin10def : InstAlias<"outb\t$port", (OUT8ir u8imm:$port), 0>;
702b9ea7327SWang, Xin10def : InstAlias<"outw\t$port", (OUT16ir u8imm:$port), 0>;
703b9ea7327SWang, Xin10def : InstAlias<"outl\t$port", (OUT32ir u8imm:$port), 0>;
704b9ea7327SWang, Xin10
705b9ea7327SWang, Xin10// 'sldt <mem>' can be encoded with either sldtw or sldtq with the same
706b9ea7327SWang, Xin10// effect (both store to a 16-bit mem).  Force to sldtw to avoid ambiguity
707b9ea7327SWang, Xin10// errors, since its encoding is the most compact.
708b9ea7327SWang, Xin10def : InstAlias<"sldt $mem", (SLDT16m i16mem:$mem), 0>;
709b9ea7327SWang, Xin10
710b9ea7327SWang, Xin10// shld/shrd op,op -> shld op, op, CL
711b9ea7327SWang, Xin10def : InstAlias<"shld{w}\t{$r2, $r1|$r1, $r2}", (SHLD16rrCL GR16:$r1, GR16:$r2), 0>;
712b9ea7327SWang, Xin10def : InstAlias<"shld{l}\t{$r2, $r1|$r1, $r2}", (SHLD32rrCL GR32:$r1, GR32:$r2), 0>;
713b9ea7327SWang, Xin10def : InstAlias<"shld{q}\t{$r2, $r1|$r1, $r2}", (SHLD64rrCL GR64:$r1, GR64:$r2), 0>;
714b9ea7327SWang, Xin10def : InstAlias<"shrd{w}\t{$r2, $r1|$r1, $r2}", (SHRD16rrCL GR16:$r1, GR16:$r2), 0>;
715b9ea7327SWang, Xin10def : InstAlias<"shrd{l}\t{$r2, $r1|$r1, $r2}", (SHRD32rrCL GR32:$r1, GR32:$r2), 0>;
716b9ea7327SWang, Xin10def : InstAlias<"shrd{q}\t{$r2, $r1|$r1, $r2}", (SHRD64rrCL GR64:$r1, GR64:$r2), 0>;
717b9ea7327SWang, Xin10
718b9ea7327SWang, Xin10def : InstAlias<"shld{w}\t{$reg, $mem|$mem, $reg}", (SHLD16mrCL i16mem:$mem, GR16:$reg), 0>;
719b9ea7327SWang, Xin10def : InstAlias<"shld{l}\t{$reg, $mem|$mem, $reg}", (SHLD32mrCL i32mem:$mem, GR32:$reg), 0>;
720b9ea7327SWang, Xin10def : InstAlias<"shld{q}\t{$reg, $mem|$mem, $reg}", (SHLD64mrCL i64mem:$mem, GR64:$reg), 0>;
721b9ea7327SWang, Xin10def : InstAlias<"shrd{w}\t{$reg, $mem|$mem, $reg}", (SHRD16mrCL i16mem:$mem, GR16:$reg), 0>;
722b9ea7327SWang, Xin10def : InstAlias<"shrd{l}\t{$reg, $mem|$mem, $reg}", (SHRD32mrCL i32mem:$mem, GR32:$reg), 0>;
723b9ea7327SWang, Xin10def : InstAlias<"shrd{q}\t{$reg, $mem|$mem, $reg}", (SHRD64mrCL i64mem:$mem, GR64:$reg), 0>;
724b9ea7327SWang, Xin10
725b9ea7327SWang, Xin10// test: We accept "testX <reg>, <mem>" and "testX <mem>, <reg>" as synonyms.
726b9ea7327SWang, Xin10def : InstAlias<"test{b}\t{$mem, $val|$val, $mem}",
727b9ea7327SWang, Xin10                (TEST8mr  i8mem :$mem, GR8 :$val), 0>;
728b9ea7327SWang, Xin10def : InstAlias<"test{w}\t{$mem, $val|$val, $mem}",
729b9ea7327SWang, Xin10                (TEST16mr i16mem:$mem, GR16:$val), 0>;
730b9ea7327SWang, Xin10def : InstAlias<"test{l}\t{$mem, $val|$val, $mem}",
731b9ea7327SWang, Xin10                (TEST32mr i32mem:$mem, GR32:$val), 0>;
732b9ea7327SWang, Xin10def : InstAlias<"test{q}\t{$mem, $val|$val, $mem}",
733b9ea7327SWang, Xin10                (TEST64mr i64mem:$mem, GR64:$val), 0>;
734b9ea7327SWang, Xin10
735b9ea7327SWang, Xin10// xchg: We accept "xchgX <reg>, <mem>" and "xchgX <mem>, <reg>" as synonyms.
736b9ea7327SWang, Xin10def : InstAlias<"xchg{b}\t{$mem, $val|$val, $mem}",
737b9ea7327SWang, Xin10                (XCHG8rm  GR8 :$val, i8mem :$mem), 0>;
738b9ea7327SWang, Xin10def : InstAlias<"xchg{w}\t{$mem, $val|$val, $mem}",
739b9ea7327SWang, Xin10                (XCHG16rm GR16:$val, i16mem:$mem), 0>;
740b9ea7327SWang, Xin10def : InstAlias<"xchg{l}\t{$mem, $val|$val, $mem}",
741b9ea7327SWang, Xin10                (XCHG32rm GR32:$val, i32mem:$mem), 0>;
742b9ea7327SWang, Xin10def : InstAlias<"xchg{q}\t{$mem, $val|$val, $mem}",
743b9ea7327SWang, Xin10                (XCHG64rm GR64:$val, i64mem:$mem), 0>;
744b9ea7327SWang, Xin10
745b9ea7327SWang, Xin10// xchg: We accept "xchgX <reg>, %eax" and "xchgX %eax, <reg>" as synonyms.
746b9ea7327SWang, Xin10def : InstAlias<"xchg{w}\t{%ax, $src|$src, ax}", (XCHG16ar GR16:$src), 0>;
747b9ea7327SWang, Xin10def : InstAlias<"xchg{l}\t{%eax, $src|$src, eax}", (XCHG32ar GR32:$src), 0>;
748b9ea7327SWang, Xin10def : InstAlias<"xchg{q}\t{%rax, $src|$src, rax}", (XCHG64ar GR64:$src), 0>;
749b9ea7327SWang, Xin10
750b9ea7327SWang, Xin10// In 64-bit mode, xchg %eax, %eax can't be encoded with the 0x90 opcode we
751b9ea7327SWang, Xin10// would get by default because it's defined as NOP. But xchg %eax, %eax implies
752b9ea7327SWang, Xin10// implicit zeroing of the upper 32 bits. So alias to the longer encoding.
753b9ea7327SWang, Xin10def : InstAlias<"xchg{l}\t{%eax, %eax|eax, eax}",
754b9ea7327SWang, Xin10                (XCHG32rr EAX, EAX), 0>, Requires<[In64BitMode]>;
755b9ea7327SWang, Xin10
756b9ea7327SWang, Xin10// xchg %rax, %rax is a nop in x86-64 and can be encoded as such. Without this
757b9ea7327SWang, Xin10// we emit an unneeded REX.w prefix.
758b9ea7327SWang, Xin10def : InstAlias<"xchg{q}\t{%rax, %rax|rax, rax}", (NOOP), 0>;
759b9ea7327SWang, Xin10
760b9ea7327SWang, Xin10// These aliases exist to get the parser to prioritize matching 8-bit
761b9ea7327SWang, Xin10// immediate encodings over matching the implicit ax/eax/rax encodings. By
762b9ea7327SWang, Xin10// explicitly mentioning the A register here, these entries will be ordered
763b9ea7327SWang, Xin10// first due to the more explicit immediate type.
764b9ea7327SWang, Xin10def : InstAlias<"adc{w}\t{$imm, %ax|ax, $imm}", (ADC16ri8 AX, i16i8imm:$imm), 0>;
765b9ea7327SWang, Xin10def : InstAlias<"add{w}\t{$imm, %ax|ax, $imm}", (ADD16ri8 AX, i16i8imm:$imm), 0>;
766b9ea7327SWang, Xin10def : InstAlias<"and{w}\t{$imm, %ax|ax, $imm}", (AND16ri8 AX, i16i8imm:$imm), 0>;
767b9ea7327SWang, Xin10def : InstAlias<"cmp{w}\t{$imm, %ax|ax, $imm}", (CMP16ri8 AX, i16i8imm:$imm), 0>;
768b9ea7327SWang, Xin10def : InstAlias<"or{w}\t{$imm, %ax|ax, $imm}",  (OR16ri8 AX,  i16i8imm:$imm), 0>;
769b9ea7327SWang, Xin10def : InstAlias<"sbb{w}\t{$imm, %ax|ax, $imm}", (SBB16ri8 AX, i16i8imm:$imm), 0>;
770b9ea7327SWang, Xin10def : InstAlias<"sub{w}\t{$imm, %ax|ax, $imm}", (SUB16ri8 AX, i16i8imm:$imm), 0>;
771b9ea7327SWang, Xin10def : InstAlias<"xor{w}\t{$imm, %ax|ax, $imm}", (XOR16ri8 AX, i16i8imm:$imm), 0>;
772b9ea7327SWang, Xin10
773b9ea7327SWang, Xin10def : InstAlias<"adc{l}\t{$imm, %eax|eax, $imm}", (ADC32ri8 EAX, i32i8imm:$imm), 0>;
774b9ea7327SWang, Xin10def : InstAlias<"add{l}\t{$imm, %eax|eax, $imm}", (ADD32ri8 EAX, i32i8imm:$imm), 0>;
775b9ea7327SWang, Xin10def : InstAlias<"and{l}\t{$imm, %eax|eax, $imm}", (AND32ri8 EAX, i32i8imm:$imm), 0>;
776b9ea7327SWang, Xin10def : InstAlias<"cmp{l}\t{$imm, %eax|eax, $imm}", (CMP32ri8 EAX, i32i8imm:$imm), 0>;
777b9ea7327SWang, Xin10def : InstAlias<"or{l}\t{$imm, %eax|eax, $imm}",  (OR32ri8 EAX,  i32i8imm:$imm), 0>;
778b9ea7327SWang, Xin10def : InstAlias<"sbb{l}\t{$imm, %eax|eax, $imm}", (SBB32ri8 EAX, i32i8imm:$imm), 0>;
779b9ea7327SWang, Xin10def : InstAlias<"sub{l}\t{$imm, %eax|eax, $imm}", (SUB32ri8 EAX, i32i8imm:$imm), 0>;
780b9ea7327SWang, Xin10def : InstAlias<"xor{l}\t{$imm, %eax|eax, $imm}", (XOR32ri8 EAX, i32i8imm:$imm), 0>;
781b9ea7327SWang, Xin10
782b9ea7327SWang, Xin10def : InstAlias<"adc{q}\t{$imm, %rax|rax, $imm}", (ADC64ri8 RAX, i64i8imm:$imm), 0>;
783b9ea7327SWang, Xin10def : InstAlias<"add{q}\t{$imm, %rax|rax, $imm}", (ADD64ri8 RAX, i64i8imm:$imm), 0>;
784b9ea7327SWang, Xin10def : InstAlias<"and{q}\t{$imm, %rax|rax, $imm}", (AND64ri8 RAX, i64i8imm:$imm), 0>;
785b9ea7327SWang, Xin10def : InstAlias<"cmp{q}\t{$imm, %rax|rax, $imm}", (CMP64ri8 RAX, i64i8imm:$imm), 0>;
786b9ea7327SWang, Xin10def : InstAlias<"or{q}\t{$imm, %rax|rax, $imm}",  (OR64ri8 RAX,  i64i8imm:$imm), 0>;
787b9ea7327SWang, Xin10def : InstAlias<"sbb{q}\t{$imm, %rax|rax, $imm}", (SBB64ri8 RAX, i64i8imm:$imm), 0>;
788b9ea7327SWang, Xin10def : InstAlias<"sub{q}\t{$imm, %rax|rax, $imm}", (SUB64ri8 RAX, i64i8imm:$imm), 0>;
789b9ea7327SWang, Xin10def : InstAlias<"xor{q}\t{$imm, %rax|rax, $imm}", (XOR64ri8 RAX, i64i8imm:$imm), 0>;
790b9ea7327SWang, Xin10
791b9ea7327SWang, Xin10//  MMX instr alia
792b9ea7327SWang, Xin10def : InstAlias<"movq.s\t{$src, $dst|$dst, $src}",
793b9ea7327SWang, Xin10                (MMX_MOVQ64rr_REV VR64:$dst, VR64:$src), 0>;
794b9ea7327SWang, Xin10
795f4509cf2SFreddy Ye//  CMOV SETCC SETZUCC Aliases
796b9ea7327SWang, Xin10multiclass CMOV_SETCC_Aliases<string Cond, int CC> {
797b9ea7327SWang, Xin10  def : InstAlias<"cmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
798b9ea7327SWang, Xin10                  (CMOV16rr GR16:$dst, GR16:$src, CC), 0>;
799b9ea7327SWang, Xin10  def : InstAlias<"cmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
800b9ea7327SWang, Xin10                  (CMOV16rm GR16:$dst, i16mem:$src, CC), 0>;
801b9ea7327SWang, Xin10  def : InstAlias<"cmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
802b9ea7327SWang, Xin10                  (CMOV32rr GR32:$dst, GR32:$src, CC), 0>;
803b9ea7327SWang, Xin10  def : InstAlias<"cmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
804b9ea7327SWang, Xin10                  (CMOV32rm GR32:$dst, i32mem:$src, CC), 0>;
805b9ea7327SWang, Xin10  def : InstAlias<"cmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
806b9ea7327SWang, Xin10                  (CMOV64rr GR64:$dst, GR64:$src, CC), 0>;
807b9ea7327SWang, Xin10  def : InstAlias<"cmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
808b9ea7327SWang, Xin10                  (CMOV64rm GR64:$dst, i64mem:$src, CC), 0>;
8097b766a6fSXinWang10let Predicates = [In64BitMode] in {
8107b766a6fSXinWang10  def : InstAlias<"cmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8117b766a6fSXinWang10                  (CMOV16rr_ND GR16:$dst, GR16:$src1, GR16:$src2, CC), 0>;
8127b766a6fSXinWang10  def : InstAlias<"cmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8137b766a6fSXinWang10                  (CMOV16rm_ND GR16:$dst, GR16:$src1, i16mem:$src2, CC), 0>;
8147b766a6fSXinWang10  def : InstAlias<"cmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8157b766a6fSXinWang10                  (CMOV32rr_ND GR32:$dst, GR32:$src1, GR32:$src2, CC), 0>;
8167b766a6fSXinWang10  def : InstAlias<"cmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8177b766a6fSXinWang10                  (CMOV32rm_ND GR32:$dst, GR32:$src1, i32mem:$src2, CC), 0>;
8187b766a6fSXinWang10  def : InstAlias<"cmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8197b766a6fSXinWang10                  (CMOV64rr_ND GR64:$dst, GR64:$src1, GR64:$src2, CC), 0>;
8207b766a6fSXinWang10  def : InstAlias<"cmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8217b766a6fSXinWang10                  (CMOV64rm_ND GR64:$dst, GR64:$src1, i64mem:$src2, CC), 0>;
822b9ea7327SWang, Xin10
823f4509cf2SFreddy Ye  def : InstAlias<"setzu"#Cond#"\t$dst", (SETZUCCr GR8:$dst, CC), 0>;
824f4509cf2SFreddy Ye  def : InstAlias<"setzu"#Cond#"\t$dst", (SETZUCCm i8mem:$dst, CC), 0>;
825f4509cf2SFreddy Ye  def : InstAlias<"set"#Cond#"\t$dst", (SETCCr_EVEX GR8:$dst, CC), 0>;
826f4509cf2SFreddy Ye  def : InstAlias<"set"#Cond#"\t$dst", (SETCCm_EVEX i8mem:$dst, CC), 0>;
827f4509cf2SFreddy Ye}
828b9ea7327SWang, Xin10  def : InstAlias<"set"#Cond#"\t$dst", (SETCCr GR8:$dst, CC), 0>;
829b9ea7327SWang, Xin10  def : InstAlias<"set"#Cond#"\t$dst", (SETCCm i8mem:$dst, CC), 0>;
830b9ea7327SWang, Xin10}
831b9ea7327SWang, Xin10
832b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"o" ,  0>;
833b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"no",  1>;
834b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"b" ,  2>;
835b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"ae",  3>;
836b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"e" ,  4>;
837b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"ne",  5>;
838b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"be",  6>;
839b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"a" ,  7>;
840b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"s" ,  8>;
841b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"ns",  9>;
842b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"p" , 10>;
843b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"np", 11>;
844b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"l" , 12>;
845b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"ge", 13>;
846b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"le", 14>;
847b9ea7327SWang, Xin10defm : CMOV_SETCC_Aliases<"g" , 15>;
848b9ea7327SWang, Xin10
8497b766a6fSXinWang10multiclass CFCMOV_Aliases<string Cond, int CC> {
8507b766a6fSXinWang10let Predicates = [In64BitMode] in {
8517b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
8527b766a6fSXinWang10                  (CFCMOV16rr GR16:$dst, GR16:$src, CC), 0>;
8537b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
8547b766a6fSXinWang10                  (CFCMOV32rr GR32:$dst, GR32:$src, CC), 0>;
8557b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
8567b766a6fSXinWang10                  (CFCMOV64rr GR64:$dst, GR64:$src, CC), 0>;
8577b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
8587b766a6fSXinWang10                  (CFCMOV16rm GR16:$dst, i16mem:$src, CC), 0>;
8597b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
8607b766a6fSXinWang10                  (CFCMOV32rm GR32:$dst, i32mem:$src, CC), 0>;
8617b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
8627b766a6fSXinWang10                  (CFCMOV64rm GR64:$dst, i64mem:$src, CC), 0>;
8637b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src, $dst|$dst, $src}",
8647b766a6fSXinWang10                  (CFCMOV16mr i16mem:$dst, GR16:$src, CC), 0>;
8657b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src, $dst|$dst, $src}",
8667b766a6fSXinWang10                  (CFCMOV32mr i32mem:$dst, GR32:$src, CC), 0>;
8677b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src, $dst|$dst, $src}",
8687b766a6fSXinWang10                  (CFCMOV64mr i64mem:$dst, GR64:$src, CC), 0>;
8697b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8707b766a6fSXinWang10                  (CFCMOV16rr_ND GR16:$dst, GR16:$src1, GR16:$src2, CC), 0>;
8717b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8727b766a6fSXinWang10                  (CFCMOV32rr_ND GR32:$dst, GR32:$src1, GR32:$src2, CC), 0>;
8737b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8747b766a6fSXinWang10                  (CFCMOV64rr_ND GR64:$dst, GR64:$src1, GR64:$src2, CC), 0>;
8757b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8767b766a6fSXinWang10                  (CFCMOV16rm_ND GR16:$dst, GR16:$src1, i16mem:$src2, CC), 0>;
8777b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8787b766a6fSXinWang10                  (CFCMOV32rm_ND GR32:$dst, GR32:$src1, i32mem:$src2, CC), 0>;
8797b766a6fSXinWang10  def : InstAlias<"cfcmov"#Cond#"{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}",
8807b766a6fSXinWang10                  (CFCMOV64rm_ND GR64:$dst, GR64:$src1, i64mem:$src2, CC), 0>;
8817b766a6fSXinWang10}
8827b766a6fSXinWang10}
8837b766a6fSXinWang10defm : CFCMOV_Aliases<"o" ,  0>;
8847b766a6fSXinWang10defm : CFCMOV_Aliases<"no",  1>;
8857b766a6fSXinWang10defm : CFCMOV_Aliases<"b" ,  2>;
8867b766a6fSXinWang10defm : CFCMOV_Aliases<"ae",  3>;
8877b766a6fSXinWang10defm : CFCMOV_Aliases<"e" ,  4>;
8887b766a6fSXinWang10defm : CFCMOV_Aliases<"ne",  5>;
8897b766a6fSXinWang10defm : CFCMOV_Aliases<"be",  6>;
8907b766a6fSXinWang10defm : CFCMOV_Aliases<"a" ,  7>;
8917b766a6fSXinWang10defm : CFCMOV_Aliases<"s" ,  8>;
8927b766a6fSXinWang10defm : CFCMOV_Aliases<"ns",  9>;
8937b766a6fSXinWang10defm : CFCMOV_Aliases<"p" , 10>;
8947b766a6fSXinWang10defm : CFCMOV_Aliases<"np", 11>;
8957b766a6fSXinWang10defm : CFCMOV_Aliases<"l" , 12>;
8967b766a6fSXinWang10defm : CFCMOV_Aliases<"ge", 13>;
8977b766a6fSXinWang10defm : CFCMOV_Aliases<"le", 14>;
8987b766a6fSXinWang10defm : CFCMOV_Aliases<"g" , 15>;
8997b766a6fSXinWang10
900b9ea7327SWang, Xin10// Condition dump instructions Alias
901b9ea7327SWang, Xin10def : InstAlias<"jo\t$dst",  (JCC_1 brtarget8:$dst,  0), 0>;
902b9ea7327SWang, Xin10def : InstAlias<"jno\t$dst", (JCC_1 brtarget8:$dst,  1), 0>;
903b9ea7327SWang, Xin10def : InstAlias<"jb\t$dst",  (JCC_1 brtarget8:$dst,  2), 0>;
904b9ea7327SWang, Xin10def : InstAlias<"jae\t$dst", (JCC_1 brtarget8:$dst,  3), 0>;
905b9ea7327SWang, Xin10def : InstAlias<"je\t$dst",  (JCC_1 brtarget8:$dst,  4), 0>;
906b9ea7327SWang, Xin10def : InstAlias<"jne\t$dst", (JCC_1 brtarget8:$dst,  5), 0>;
907b9ea7327SWang, Xin10def : InstAlias<"jbe\t$dst", (JCC_1 brtarget8:$dst,  6), 0>;
908b9ea7327SWang, Xin10def : InstAlias<"ja\t$dst",  (JCC_1 brtarget8:$dst,  7), 0>;
909b9ea7327SWang, Xin10def : InstAlias<"js\t$dst",  (JCC_1 brtarget8:$dst,  8), 0>;
910b9ea7327SWang, Xin10def : InstAlias<"jns\t$dst", (JCC_1 brtarget8:$dst,  9), 0>;
911b9ea7327SWang, Xin10def : InstAlias<"jp\t$dst",  (JCC_1 brtarget8:$dst, 10), 0>;
912b9ea7327SWang, Xin10def : InstAlias<"jnp\t$dst", (JCC_1 brtarget8:$dst, 11), 0>;
913b9ea7327SWang, Xin10def : InstAlias<"jl\t$dst",  (JCC_1 brtarget8:$dst, 12), 0>;
914b9ea7327SWang, Xin10def : InstAlias<"jge\t$dst", (JCC_1 brtarget8:$dst, 13), 0>;
915b9ea7327SWang, Xin10def : InstAlias<"jle\t$dst", (JCC_1 brtarget8:$dst, 14), 0>;
916b9ea7327SWang, Xin10def : InstAlias<"jg\t$dst",  (JCC_1 brtarget8:$dst, 15), 0>;
917b9ea7327SWang, Xin10
918b9ea7327SWang, Xin10// SVM instructions Alias
919b9ea7327SWang, Xin10def : InstAlias<"skinit\t{%eax|eax}", (SKINIT), 0>;
920b9ea7327SWang, Xin10def : InstAlias<"vmrun\t{%eax|eax}", (VMRUN32), 0>, Requires<[Not64BitMode]>;
921b9ea7327SWang, Xin10def : InstAlias<"vmrun\t{%rax|rax}", (VMRUN64), 0>, Requires<[In64BitMode]>;
922b9ea7327SWang, Xin10def : InstAlias<"vmload\t{%eax|eax}", (VMLOAD32), 0>, Requires<[Not64BitMode]>;
923b9ea7327SWang, Xin10def : InstAlias<"vmload\t{%rax|rax}", (VMLOAD64), 0>, Requires<[In64BitMode]>;
924b9ea7327SWang, Xin10def : InstAlias<"vmsave\t{%eax|eax}", (VMSAVE32), 0>, Requires<[Not64BitMode]>;
925b9ea7327SWang, Xin10def : InstAlias<"vmsave\t{%rax|rax}", (VMSAVE64), 0>, Requires<[In64BitMode]>;
926b9ea7327SWang, Xin10def : InstAlias<"invlpga\t{%eax, %ecx|eax, ecx}", (INVLPGA32), 0>, Requires<[Not64BitMode]>;
927b9ea7327SWang, Xin10def : InstAlias<"invlpga\t{%rax, %ecx|rax, ecx}", (INVLPGA64), 0>, Requires<[In64BitMode]>;
928b9ea7327SWang, Xin10
929037c2207SXinWang10// Aliases with explicit %xmm0
930037c2207SXinWang10def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
931037c2207SXinWang10                (SHA256RNDS2rr VR128:$dst, VR128:$src2), 0>;
932037c2207SXinWang10def : InstAlias<"sha256rnds2\t{$src2, $dst|$dst, $src2}",
933037c2207SXinWang10                (SHA256RNDS2rm VR128:$dst, i128mem:$src2), 0>;
934