Debian Codegraph @

suite/synctools/tablegen/X86/back/X86CapstoneFull.td

raw
1 // Capstone definitions fix for X86 LLVM instructions.
2
3 let Defs = [EFLAGS] in
4 def INT1 : I<0xf1, RawFrm, (outs), (ins), "int1", []>;
5
6 def FSETPM : I<0xDB, MRM_E4, (outs), (ins), "fsetpm", []>;
7
8 // Capstone: comment out below lines for X86 Reduce mode
9
10 /*
11 // X87 Floating Point Stack.
12 include "X86InstrFPStack.td"
13
14 // SIMD support (SSE, MMX and AVX)
15 include "X86InstrFragmentsSIMD.td"
16
17 // FMA - Fused Multiply-Add support (requires FMA)
18 include "X86InstrFMA.td"
19
20 // XOP
21 include "X86InstrXOP.td"
22
23 // SSE, MMX and 3DNow! vector support.
24 include "X86InstrSSE.td"
25 include "X86InstrAVX512.td"
26 include "X86InstrMMX.td"
27 include "X86Instr3DNow.td"
28
29 // MPX instructions
30 include "X86InstrMPX.td"
31
32 //include "X86InstrTSX.td"
33 include "X86InstrSGX.td"
34
35 // Various unary fpstack operations default to operating on ST1.
36 // For example, "fxch" -> "fxch %st(1)"
37 def : InstAlias<"faddp", (ADD_FPrST0 ST1), 0>;
38 def: InstAlias<"fadd", (ADD_FPrST0 ST1), 0>;
39 def : InstAlias<"fsub{|r}p", (SUBR_FPrST0 ST1), 0>;
40 def : InstAlias<"fsub{r|}p", (SUB_FPrST0 ST1), 0>;
41 def : InstAlias<"fmul", (MUL_FPrST0 ST1), 0>;
42 def : InstAlias<"fmulp", (MUL_FPrST0 ST1), 0>;
43 def : InstAlias<"fdiv{|r}p", (DIVR_FPrST0 ST1), 0>;
44 def : InstAlias<"fdiv{r|}p", (DIV_FPrST0 ST1), 0>;
45 def : InstAlias<"fxch", (XCH_F ST1), 0>;
46 def : InstAlias<"fcom", (COM_FST0r ST1), 0>;
47 def : InstAlias<"fcomp", (COMP_FST0r ST1), 0>;
48 def : InstAlias<"fcomi", (COM_FIr ST1), 0>;
49 def : InstAlias<"fcompi", (COM_FIPr ST1), 0>;
50 def : InstAlias<"fucom", (UCOM_Fr ST1), 0>;
51 def : InstAlias<"fucomp", (UCOM_FPr ST1), 0>;
52 def : InstAlias<"fucomi", (UCOM_FIr ST1), 0>;
53 def : InstAlias<"fucompi", (UCOM_FIPr ST1), 0>;
54
55 // Handle fmul/fadd/fsub/fdiv instructions with explicitly written st(0) op.
56 // For example, "fadd %st(4), %st(0)" -> "fadd %st(4)". We also disambiguate
57 // instructions like "fadd %st(0), %st(0)" as "fadd %st(0)" for consistency with
58 // gas.
59 multiclass FpUnaryAlias<string Mnemonic, Instruction Inst, bit EmitAlias = 1> {
60 def : InstAlias<!strconcat(Mnemonic, "\t{$op, %st(0)|st(0), $op}"),
61 (Inst RST:$op), EmitAlias>;
62 def : InstAlias<!strconcat(Mnemonic, "\t{%st(0), %st(0)|st(0), st(0)}"),
63 (Inst ST0), EmitAlias>;
64 }
65
66 defm : FpUnaryAlias<"fadd", ADD_FST0r>;
67 defm : FpUnaryAlias<"faddp", ADD_FPrST0, 0>;
68 defm : FpUnaryAlias<"fsub", SUB_FST0r>;
69 defm : FpUnaryAlias<"fsub{|r}p", SUBR_FPrST0>;
70 defm : FpUnaryAlias<"fsubr", SUBR_FST0r>;
71 defm : FpUnaryAlias<"fsub{r|}p", SUB_FPrST0>;
72 defm : FpUnaryAlias<"fmul", MUL_FST0r>;
73 defm : FpUnaryAlias<"fmulp", MUL_FPrST0>;
74 defm : FpUnaryAlias<"fdiv", DIV_FST0r>;
75 defm : FpUnaryAlias<"fdiv{|r}p", DIVR_FPrST0>;
76 defm : FpUnaryAlias<"fdivr", DIVR_FST0r>;
77 defm : FpUnaryAlias<"fdiv{r|}p", DIV_FPrST0>;
78 defm : FpUnaryAlias<"fcomi", COM_FIr, 0>;
79 defm : FpUnaryAlias<"fucomi", UCOM_FIr, 0>;
80 defm : FpUnaryAlias<"fcompi", COM_FIPr>;
81 defm : FpUnaryAlias<"fucompi", UCOM_FIPr>;
82
83
84 // Handle "f{mulp,addp} st(0), $op" the same as "f{mulp,addp} $op", since they
85 // commute. We also allow fdiv[r]p/fsubrp even though they don't commute,
86 // solely because gas supports it.
87 def : InstAlias<"faddp\t{%st(0), $op|$op, st(0)}", (ADD_FPrST0 RST:$op), 0>;
88 def : InstAlias<"fmulp\t{%st(0), $op|$op, st(0)}", (MUL_FPrST0 RST:$op)>;
89 def : InstAlias<"fsub{|r}p\t{%st(0), $op|$op, st(0)}", (SUBR_FPrST0 RST:$op)>;
90 def : InstAlias<"fsub{r|}p\t{%st(0), $op|$op, st(0)}", (SUB_FPrST0 RST:$op)>;
91 def : InstAlias<"fdiv{|r}p\t{%st(0), $op|$op, st(0)}", (DIVR_FPrST0 RST:$op)>;
92 def : InstAlias<"fdiv{r|}p\t{%st(0), $op|$op, st(0)}", (DIV_FPrST0 RST:$op)>;
93
94 def : InstAlias<"fnstsw" , (FNSTSW16r), 0>;
95
96 // Match 'movd GR64, MMX' as an alias for movq to be compatible with gas,
97 // which supports this due to an old AMD documentation bug when 64-bit mode was
98 // created.
99 def : InstAlias<"movd\t{$src, $dst|$dst, $src}",
100 (MMX_MOVD64to64rr VR64:$dst, GR64:$src), 0>;
101 def : InstAlias<"movd\t{$src, $dst|$dst, $src}",
102 (MMX_MOVD64from64rr GR64:$dst, VR64:$src), 0>;
103 */