summaryrefslogtreecommitdiff
path: root/6/insns.def
blob: 6e9aeda22c10a1c1a834c56a9eaea8ed9b545fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* Table of instructions. Each instruction
   is defined by the following macro:
        Insn(enumval, fmt, attr)
    The format string 'fmt' has the following expansions:
        %r            - int reg
        %f            - xmm reg
        %m            - mem
        %i            - imm
        %v            - reg/mem
        %u            - reg/imm
        %x            - reg/freg/mem/imm
        %[1-9]*t      - Mode of an operand. The optional number
                        preceeding it is the operand desired for
                        the mode.
    Currently, there aren't any attrs, because none were needed yet.
    Eventually, they'll probably include flag setting and so on.

    For technical reasons, the indexing on use and def statments is 1-based,
    instead of 0-based. (0 is the sentinel value).
*/
#define None .l={0},.r={0}
Insn(Inone,     "BAD_INSN",                     Use(None), Def(None))
/* Note, the mov instruction is specified in an overly general manner. */
Insn(Imov,      "\tmov%t %x,%x\n",              Use(.l={1}),                    Def(.l={2}))
Insn(Imovt,      "PSEUDO: TRUNCATE\n",          Use(.l={1}),                    Def(.l={2}))
Insn(Imovzx,    "\tmovz%1t%2t %x,%x\n",         Use(.l={1}),                    Def(.l={2}))
Insn(Imovsx,    "\tmovs%1t%2t %x,%x\n",         Use(.l={1}),                    Def(.l={2}))
Insn(Irepmovsb, "\trep movsb\n",                Use(.r={Rrcx,Rrsi,Rrdi}),       Def(None))
Insn(Irepmovsw, "\trep movsw\n",                Use(.r={Rrcx,Rrsi,Rrdi}),       Def(None))
Insn(Irepmovsl, "\trep movsl\n",                Use(.r={Rrcx,Rrsi,Rrdi}),       Def(None))
Insn(Irepmovsq, "\trep movsq\n",                Use(.r={Rrcx,Rrsi,Rrdi}),       Def(None))
Insn(Ilea,      "\tlea%2t %m,%r\n",             Use(.l={1}),                    Def(.l={2}))

Insn(Iadd,      "\tadd%t %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
Insn(Isub,      "\tsub%t %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
Insn(Iimul,     "\timul%t %x,%r\n",             Use(.l={1,2}),                  Def(.l={2}))
/* there is no imul for 8 bit values. */
Insn(Iimul_r,   "\timul%t %r\n",                Use(.l={1},.r={Ral}),           Def(.r={Rax}))
Insn(Imul,      "\tmul%t %r\n",                 Use(.l={1},.r={Reax}),          Def(.r={Reax,Redx}))
Insn(Idiv,      "\tdiv%t %r\n",                 Use(.l={1},.r={Reax,Redx}),     Def(.r={Reax,Redx}))
Insn(Ineg,      "\tneg%t %r\n",                 Use(.l={1}),                    Def(.l={1}))
Insn(Iand,      "\tand%t %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
Insn(Ior,       "\tor%t  %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
Insn(Ixor,      "\txor%t %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
Insn(Inot,      "\tnot%t %v\n",                 Use(.l={1}),                    Def(.l={1}))
Insn(Ishl,      "\tsal%2t %u,%r\n",             Use(.l={1,2}),                  Def(.l={2}))
Insn(Isar,      "\tsar%2t %u,%r\n",             Use(.l={1,2}),                  Def(.l={2}))
Insn(Ishr,      "\tshr%2t %u,%r\n",             Use(.l={1,2}),                  Def(.l={2}))

Insn(Itest,     "\ttest%t %x,%r\n",             Use(.l={1,2}),                  Def(None))
Insn(Icmp,      "\tcmp%t  %x,%r\n",             Use(.l={1,2}),                  Def(None))

Insn(Ipush,     "\tpush%t %r\n",                Use(.l={1}),                    Def(None))
Insn(Ipop,      "\tpop%t %r\n",                 Use(.l={1}),                    Def(None))

/* branch instructions */
Insn(Isetz,     "\tsetz  %v\n",                 Use(None),  Def(.l={1}))
Insn(Isetnz,    "\tsetnz %v\n",                 Use(None),  Def(.l={1}))
Insn(Isetl,     "\tsetl  %v\n",                 Use(None),  Def(.l={1}))
Insn(Isetle,    "\tsetle %v\n",                 Use(None),  Def(.l={1}))
Insn(Isetg,     "\tsetg %v\n",                  Use(None),  Def(.l={1}))
Insn(Isetge,    "\tsetge %v\n",                 Use(None),  Def(.l={1}))
Insn(Isetb,     "\tsetb  %v\n",                 Use(None),  Def(.l={1}))
Insn(Isetbe,    "\tsetbe %v\n",                 Use(None),  Def(.l={1}))
Insn(Iseta,     "\tseta %v\n",                  Use(None),  Def(.l={1}))
Insn(Isetae,    "\tsetae %v\n",                 Use(None),  Def(.l={1}))

/* fp specific instructions */
Insn(Imovs,      "\tmovs%1t %x,%x\n",           Use(.l={1}),                    Def(.l={2}))
Insn(Icvttsd2si, "\tcvttsd2si%2t %x,%r\n",      Use(.l={1}),                    Def(.l={2}))
Insn(Icvttsi2sd, "\tcvttsi2sd%2t %x,%f\n",      Use(.l={1}),                    Def(.l={2}))
Insn(Icvttsd2ss, "\tcvtsd2ss %x,%f\n",          Use(.l={1}),                    Def(.l={2}))
Insn(Icvttss2sd, "\tcvtss2sd %x,%f\n",          Use(.l={1}),                    Def(.l={2}))
Insn(Iadds,      "\tadds%t %x,%f\n",            Use(.l={1,2}),                  Def(.l={2}))
Insn(Isubs,      "\tsubs%t %x,%f\n",            Use(.l={1,2}),                  Def(.l={2}))
Insn(Imuls,      "\tmuls%t %x,%f\n",            Use(.l={1,2}),                  Def(.l={2}))
Insn(Idivs,      "\tdivs%t %x,%f\n",            Use(.l={1,2}),                  Def(.l={2}))
Insn(Icomis,     "\tcomis%t %x,%f\n",           Use(.l={1,2}),                  Def(None))
Insn(Ixorp,      "\tmuls%t %x,%f\n",            Use(.l={1,2}),                  Def(.l={2}))

/* branch instructions */
Insn(Icall,     "\tcall %v\n",                  Use(.l={1}), Def(.r={Rrax,Reax,Rax,Ral,Rah}))
Insn(Icallind,  "\tcall *%v\n",                 Use(.l={1}), Def(.r={Rrax,Reax,Rax,Ral,Rah}))
Insn(Ijmp,      "\tjmp %v\n",                   Use(.l={1}), Def(None))
Insn(Ijz,       "\tjz %v\n",                    Use(.l={1}), Def(None))
Insn(Ijnz,      "\tjnz %v\n",                   Use(.l={1}), Def(None))
Insn(Ijl,       "\tjl %v\n",                    Use(.l={1}), Def(None))
Insn(Ijle,      "\tjle %v\n",                   Use(.l={1}), Def(None))
Insn(Ijg,       "\tjg %v\n",                    Use(.l={1}), Def(None))
Insn(Ijge,      "\tjge %v\n",                   Use(.l={1}), Def(None))
Insn(Ijb,       "\tjb %v\n",                    Use(.l={1}), Def(None))
Insn(Ijbe,      "\tjbe %v\n",                   Use(.l={1}), Def(None))
Insn(Ija,       "\tja %v\n",                    Use(.l={1}), Def(None))
Insn(Ijae,      "\tjae %v\n",                   Use(.l={1}), Def(None))
Insn(Iret,      "\tret\n",                      Use(.r={Rrax,Rxmm0d}), Def(None))

/* not really an insn... */
Insn(Ilbl,      "%v:\n",                        Use(None), Def(None))