blob: f1ca114c4c933a2290b4a3a0e1027cd6ef5766db [file] [log] [blame]
Jia Liu31d157a2012-02-18 12:03:15 +00001//===-- X86InstrSystem.td - System Instructions ------------*- tablegen -*-===//
2//
Chris Lattner434c7cb2010-10-05 05:32:15 +00003// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liu31d157a2012-02-18 12:03:15 +00007//
Chris Lattner434c7cb2010-10-05 05:32:15 +00008//===----------------------------------------------------------------------===//
9//
10// This file describes the X86 instructions that are generally used in
11// privileged modes. These are not typically used by the compiler, but are
12// supported for the assembler and disassembler.
13//
14//===----------------------------------------------------------------------===//
15
16let Defs = [RAX, RDX] in
Preston Gurd3d142e52012-05-04 19:26:37 +000017 def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)], IIC_RDTSC>,
18 TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +000019
20let Defs = [RAX, RCX, RDX] in
Chris Lattner87be16a2010-10-05 06:04:14 +000021 def RDTSCP : I<0x01, MRM_F9, (outs), (ins), "rdtscp", []>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +000022
23// CPU flow control instructions
24
Kevin Enderby529b1a42010-10-27 20:46:49 +000025let isTerminator = 1, isBarrier = 1, hasCtrlDep = 1 in {
Chris Lattner87be16a2010-10-05 06:04:14 +000026 def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB;
Kevin Enderby529b1a42010-10-27 20:46:49 +000027 def UD2B : I<0xB9, RawFrm, (outs), (ins), "ud2b", []>, TB;
28}
Chris Lattner434c7cb2010-10-05 05:32:15 +000029
Preston Gurd3d142e52012-05-04 19:26:37 +000030def HLT : I<0xF4, RawFrm, (outs), (ins), "hlt", [], IIC_HLT>;
31def RSM : I<0xAA, RawFrm, (outs), (ins), "rsm", [], IIC_RSM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +000032
33// Interrupt and SysCall Instructions.
34let Uses = [EFLAGS] in
35 def INTO : I<0xce, RawFrm, (outs), (ins), "into", []>;
36def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3",
Preston Gurd3d142e52012-05-04 19:26:37 +000037 [(int_x86_int (i8 3))], IIC_INT3>;
Chris Lattner15f89512011-04-09 19:41:05 +000038
39// The long form of "int $3" turns into int3 as a size optimization.
40// FIXME: This doesn't work because InstAlias can't match immediate constants.
41//def : InstAlias<"int\t$3", (INT3)>;
42
43
Chris Lattner434c7cb2010-10-05 05:32:15 +000044def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap",
Preston Gurd3d142e52012-05-04 19:26:37 +000045 [(int_x86_int imm:$trap)], IIC_INT>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000046
Chris Lattner15f89512011-04-09 19:41:05 +000047
Preston Gurd3d142e52012-05-04 19:26:37 +000048def SYSCALL : I<0x05, RawFrm, (outs), (ins), "syscall", [], IIC_SYSCALL>, TB;
49def SYSRET : I<0x07, RawFrm, (outs), (ins), "sysret{l}", [], IIC_SYSCALL>, TB;
50def SYSRET64 :RI<0x07, RawFrm, (outs), (ins), "sysret{q}", [], IIC_SYSCALL>, TB,
Chris Lattner87be16a2010-10-05 06:04:14 +000051 Requires<[In64BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000052
Preston Gurd3d142e52012-05-04 19:26:37 +000053def SYSENTER : I<0x34, RawFrm, (outs), (ins), "sysenter", [],
54 IIC_SYS_ENTER_EXIT>, TB;
55
56def SYSEXIT : I<0x35, RawFrm, (outs), (ins), "sysexit{l}", [],
57 IIC_SYS_ENTER_EXIT>, TB;
Bill Wendlinge060eb82012-03-10 07:37:27 +000058def SYSEXIT64 :RI<0x35, RawFrm, (outs), (ins), "sysexit{q}", []>, TB,
Chris Lattner87be16a2010-10-05 06:04:14 +000059 Requires<[In64BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000060
Preston Gurd3d142e52012-05-04 19:26:37 +000061def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iret{w}", [], IIC_IRET>, OpSize;
62def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l|d}", [], IIC_IRET>;
63def IRET64 : RI<0xcf, RawFrm, (outs), (ins), "iretq", [], IIC_IRET>,
Chris Lattner434c7cb2010-10-05 05:32:15 +000064 Requires<[In64BitMode]>;
65
66
67//===----------------------------------------------------------------------===//
68// Input/Output Instructions.
69//
70let Defs = [AL], Uses = [DX] in
71def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000072 "in{b}\t{%dx, %al|AL, DX}", [], IIC_IN_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000073let Defs = [AX], Uses = [DX] in
74def IN16rr : I<0xED, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000075 "in{w}\t{%dx, %ax|AX, DX}", [], IIC_IN_RR>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +000076let Defs = [EAX], Uses = [DX] in
77def IN32rr : I<0xED, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000078 "in{l}\t{%dx, %eax|EAX, DX}", [], IIC_IN_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000079
80let Defs = [AL] in
81def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +000082 "in{b}\t{$port, %al|AL, $port}", [], IIC_IN_RI>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000083let Defs = [AX] in
84def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +000085 "in{w}\t{$port, %ax|AX, $port}", [], IIC_IN_RI>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +000086let Defs = [EAX] in
87def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +000088 "in{l}\t{$port, %eax|EAX, $port}", [], IIC_IN_RI>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000089
90let Uses = [DX, AL] in
91def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000092 "out{b}\t{%al, %dx|DX, AL}", [], IIC_OUT_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000093let Uses = [DX, AX] in
94def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000095 "out{w}\t{%ax, %dx|DX, AX}", [], IIC_OUT_RR>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +000096let Uses = [DX, EAX] in
97def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000098 "out{l}\t{%eax, %dx|DX, EAX}", [], IIC_OUT_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000099
100let Uses = [AL] in
101def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +0000102 "out{b}\t{%al, $port|$port, AL}", [], IIC_OUT_IR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000103let Uses = [AX] in
104def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +0000105 "out{w}\t{%ax, $port|$port, AX}", [], IIC_OUT_IR>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000106let Uses = [EAX] in
107def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +0000108 "out{l}\t{%eax, $port|$port, EAX}", [], IIC_OUT_IR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000109
Preston Gurd3d142e52012-05-04 19:26:37 +0000110def IN8 : I<0x6C, RawFrm, (outs), (ins), "ins{b}", [], IIC_INS>;
111def IN16 : I<0x6D, RawFrm, (outs), (ins), "ins{w}", [], IIC_INS>, OpSize;
112def IN32 : I<0x6D, RawFrm, (outs), (ins), "ins{l}", [], IIC_INS>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000113
114//===----------------------------------------------------------------------===//
115// Moves to and from debug registers
116
117def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000118 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_DR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000119def MOV64rd : I<0x21, MRMDestReg, (outs GR64:$dst), (ins DEBUG_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000120 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_DR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000121
122def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000123 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_DR_REG>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000124def MOV64dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000125 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_DR_REG>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000126
127//===----------------------------------------------------------------------===//
128// Moves to and from control registers
129
130def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000131 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_CR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000132def MOV64rc : I<0x20, MRMDestReg, (outs GR64:$dst), (ins CONTROL_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000133 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_CR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000134
135def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000136 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_CR_REG>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000137def MOV64cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000138 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_CR_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000139
140//===----------------------------------------------------------------------===//
141// Segment override instruction prefixes
142
Chris Lattner87be16a2010-10-05 06:04:14 +0000143def CS_PREFIX : I<0x2E, RawFrm, (outs), (ins), "cs", []>;
144def SS_PREFIX : I<0x36, RawFrm, (outs), (ins), "ss", []>;
145def DS_PREFIX : I<0x3E, RawFrm, (outs), (ins), "ds", []>;
146def ES_PREFIX : I<0x26, RawFrm, (outs), (ins), "es", []>;
147def FS_PREFIX : I<0x64, RawFrm, (outs), (ins), "fs", []>;
148def GS_PREFIX : I<0x65, RawFrm, (outs), (ins), "gs", []>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000149
150
151//===----------------------------------------------------------------------===//
Chris Lattner87be16a2010-10-05 06:04:14 +0000152// Moves to and from segment registers.
153//
154
155def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000156 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000157def MOV32rs : I<0x8C, MRMDestReg, (outs GR32:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000158 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000159def MOV64rs : RI<0x8C, MRMDestReg, (outs GR64:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000160 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000161
162def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000163 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000164def MOV32ms : I<0x8C, MRMDestMem, (outs i32mem:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000165 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000166def MOV64ms : RI<0x8C, MRMDestMem, (outs i64mem:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000167 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000168
169def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000170 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000171def MOV32sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000172 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000173def MOV64sr : RI<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000174 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000175
176def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000177 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000178def MOV32sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000179 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000180def MOV64sm : RI<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i64mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000181 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000182
183//===----------------------------------------------------------------------===//
Chris Lattner434c7cb2010-10-05 05:32:15 +0000184// Segmentation support instructions.
185
Preston Gurd3d142e52012-05-04 19:26:37 +0000186def SWAPGS : I<0x01, MRM_F8, (outs), (ins), "swapgs", [], IIC_SWAPGS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000187
Chris Lattner434c7cb2010-10-05 05:32:15 +0000188def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000189 "lar{w}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000190def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000191 "lar{w}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000192
193// i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo.
194def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000195 "lar{l}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000196def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000197 "lar{l}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000198// i16mem operand in LAR64rm and GR32 operand in LAR32rr is not a typo.
199def LAR64rm : RI<0x02, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000200 "lar{q}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000201def LAR64rr : RI<0x02, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000202 "lar{q}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000203
204def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000205 "lsl{w}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000206def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000207 "lsl{w}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000208def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000209 "lsl{l}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000210def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000211 "lsl{l}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000212def LSL64rm : RI<0x03, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000213 "lsl{q}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000214def LSL64rr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000215 "lsl{q}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000216
Preston Gurd3d142e52012-05-04 19:26:37 +0000217def INVLPG : I<0x01, MRM7m, (outs), (ins i8mem:$addr), "invlpg\t$addr",
218 [], IIC_INVLPG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000219
Eli Friedmanac39bd52011-03-04 00:10:17 +0000220def STR16r : I<0x00, MRM1r, (outs GR16:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000221 "str{w}\t$dst", [], IIC_STR>, TB, OpSize;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000222def STR32r : I<0x00, MRM1r, (outs GR32:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000223 "str{l}\t$dst", [], IIC_STR>, TB;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000224def STR64r : RI<0x00, MRM1r, (outs GR64:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000225 "str{q}\t$dst", [], IIC_STR>, TB;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000226def STRm : I<0x00, MRM1m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000227 "str{w}\t$dst", [], IIC_STR>, TB;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000228
Chris Lattner434c7cb2010-10-05 05:32:15 +0000229def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000230 "ltr{w}\t$src", [], IIC_LTR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000231def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000232 "ltr{w}\t$src", [], IIC_LTR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000233
234def PUSHCS16 : I<0x0E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000235 "push{w}\t{%cs|CS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
236 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000237def PUSHCS32 : I<0x0E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000238 "push{l}\t{%cs|CS}", [], IIC_PUSH_CS>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000239def PUSHSS16 : I<0x16, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000240 "push{w}\t{%ss|SS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
241 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000242def PUSHSS32 : I<0x16, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000243 "push{l}\t{%ss|SS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000244def PUSHDS16 : I<0x1E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000245 "push{w}\t{%ds|DS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
246 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000247def PUSHDS32 : I<0x1E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000248 "push{l}\t{%ds|DS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000249def PUSHES16 : I<0x06, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000250 "push{w}\t{%es|ES}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
251 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000252def PUSHES32 : I<0x06, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000253 "push{l}\t{%es|ES}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000254
255def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000256 "push{w}\t{%fs|FS}", [], IIC_PUSH_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000257def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000258 "push{l}\t{%fs|FS}", [], IIC_PUSH_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000259def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000260 "push{w}\t{%gs|GS}", [], IIC_PUSH_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000261def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000262 "push{l}\t{%gs|GS}", [], IIC_PUSH_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000263
264def PUSHFS64 : I<0xa0, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000265 "push{q}\t{%fs|FS}", [], IIC_PUSH_SR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000266def PUSHGS64 : I<0xa8, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000267 "push{q}\t{%gs|GS}", [], IIC_PUSH_SR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000268
269// No "pop cs" instruction.
270def POPSS16 : I<0x17, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000271 "pop{w}\t{%ss|SS}", [], IIC_POP_SR_SS>,
272 OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000273def POPSS32 : I<0x17, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000274 "pop{l}\t{%ss|SS}", [], IIC_POP_SR_SS>,
275 Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000276
Chris Lattner434c7cb2010-10-05 05:32:15 +0000277def POPDS16 : I<0x1F, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000278 "pop{w}\t{%ds|DS}", [], IIC_POP_SR>,
279 OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000280def POPDS32 : I<0x1F, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000281 "pop{l}\t{%ds|DS}", [], IIC_POP_SR>,
282 Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000283
Chris Lattner434c7cb2010-10-05 05:32:15 +0000284def POPES16 : I<0x07, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000285 "pop{w}\t{%es|ES}", [], IIC_POP_SR>,
286 OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000287def POPES32 : I<0x07, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000288 "pop{l}\t{%es|ES}", [], IIC_POP_SR>,
289 Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000290
Chris Lattner434c7cb2010-10-05 05:32:15 +0000291def POPFS16 : I<0xa1, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000292 "pop{w}\t{%fs|FS}", [], IIC_POP_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000293def POPFS32 : I<0xa1, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000294 "pop{l}\t{%fs|FS}", [], IIC_POP_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000295def POPFS64 : I<0xa1, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000296 "pop{q}\t{%fs|FS}", [], IIC_POP_SR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000297
Chris Lattner434c7cb2010-10-05 05:32:15 +0000298def POPGS16 : I<0xa9, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000299 "pop{w}\t{%gs|GS}", [], IIC_POP_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000300def POPGS32 : I<0xa9, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000301 "pop{l}\t{%gs|GS}", [], IIC_POP_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000302def POPGS64 : I<0xa9, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000303 "pop{q}\t{%gs|GS}", [], IIC_POP_SR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000304
305
306def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000307 "lds{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000308def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000309 "lds{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000310
Chris Lattner434c7cb2010-10-05 05:32:15 +0000311def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000312 "lss{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000313def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000314 "lss{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000315def LSS64rm : RI<0xb2, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000316 "lss{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000317
Chris Lattner434c7cb2010-10-05 05:32:15 +0000318def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000319 "les{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000320def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000321 "les{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000322
Chris Lattner434c7cb2010-10-05 05:32:15 +0000323def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000324 "lfs{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000325def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000326 "lfs{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000327def LFS64rm : RI<0xb4, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000328 "lfs{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000329
Chris Lattner434c7cb2010-10-05 05:32:15 +0000330def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000331 "lgs{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000332def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000333 "lgs{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000334
Chris Lattner434c7cb2010-10-05 05:32:15 +0000335def LGS64rm : RI<0xb5, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000336 "lgs{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000337
338
339def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000340 "verr\t$seg", [], IIC_VERR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000341def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000342 "verr\t$seg", [], IIC_VERR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000343def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000344 "verw\t$seg", [], IIC_VERW_MEM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000345def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000346 "verw\t$seg", [], IIC_VERW_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000347
348//===----------------------------------------------------------------------===//
349// Descriptor-table support instructions
350
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000351def SGDT16m : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000352 "sgdtw\t$dst", [], IIC_SGDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000353def SGDTm : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000354 "sgdt\t$dst", [], IIC_SGDT>, TB;
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000355def SIDT16m : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000356 "sidtw\t$dst", [], IIC_SIDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000357def SIDTm : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins),
358 "sidt\t$dst", []>, TB;
359def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000360 "sldt{w}\t$dst", [], IIC_SLDT>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000361def SLDT16m : I<0x00, MRM0m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000362 "sldt{w}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000363def SLDT32r : I<0x00, MRM0r, (outs GR32:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000364 "sldt{l}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000365
366// LLDT is not interpreted specially in 64-bit mode because there is no sign
367// extension.
368def SLDT64r : RI<0x00, MRM0r, (outs GR64:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000369 "sldt{q}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000370def SLDT64m : RI<0x00, MRM0m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000371 "sldt{q}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000372
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000373def LGDT16m : I<0x01, MRM2m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000374 "lgdtw\t$src", [], IIC_LGDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000375def LGDTm : I<0x01, MRM2m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000376 "lgdt\t$src", [], IIC_LGDT>, TB;
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000377def LIDT16m : I<0x01, MRM3m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000378 "lidtw\t$src", [], IIC_LIDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000379def LIDTm : I<0x01, MRM3m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000380 "lidt\t$src", [], IIC_LIDT>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000381def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000382 "lldt{w}\t$src", [], IIC_LLDT_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000383def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000384 "lldt{w}\t$src", [], IIC_LLDT_MEM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000385
386//===----------------------------------------------------------------------===//
387// Specialized register support
Preston Gurd3d142e52012-05-04 19:26:37 +0000388def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", [], IIC_WRMSR>, TB;
389def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", [], IIC_RDMSR>, TB;
390def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", [], IIC_RDPMC>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000391
392def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000393 "smsw{w}\t$dst", [], IIC_SMSW>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000394def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000395 "smsw{l}\t$dst", [], IIC_SMSW>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000396// no m form encodable; use SMSW16m
397def SMSW64r : RI<0x01, MRM4r, (outs GR64:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000398 "smsw{q}\t$dst", [], IIC_SMSW>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000399
400// For memory operands, there is only a 16-bit form
401def SMSW16m : I<0x01, MRM4m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000402 "smsw{w}\t$dst", [], IIC_SMSW>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000403
404def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000405 "lmsw{w}\t$src", [], IIC_LMSW_MEM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000406def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000407 "lmsw{w}\t$src", [], IIC_LMSW_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000408
Preston Gurd3d142e52012-05-04 19:26:37 +0000409def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", [], IIC_CPUID>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000410
411//===----------------------------------------------------------------------===//
412// Cache instructions
Preston Gurd3d142e52012-05-04 19:26:37 +0000413def INVD : I<0x08, RawFrm, (outs), (ins), "invd", [], IIC_INVD>, TB;
414def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [], IIC_INVD>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000415
Craig Topper75fe5f32011-10-07 07:02:24 +0000416//===----------------------------------------------------------------------===//
417// XSAVE instructions
Rafael Espindola87ca0e02011-02-22 00:35:18 +0000418let Defs = [RDX, RAX], Uses = [RCX] in
419 def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB;
420
421let Uses = [RDX, RAX, RCX] in
422 def XSETBV : I<0x01, MRM_D1, (outs), (ins), "xsetbv", []>, TB;
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000423
Craig Topper1b526a92011-10-07 05:53:50 +0000424let Uses = [RDX, RAX] in {
425 def XSAVE : I<0xAE, MRM4m, (outs opaque512mem:$dst), (ins),
426 "xsave\t$dst", []>, TB;
427 def XSAVE64 : I<0xAE, MRM4m, (outs opaque512mem:$dst), (ins),
428 "xsaveq\t$dst", []>, TB, REX_W, Requires<[In64BitMode]>;
429 def XRSTOR : I<0xAE, MRM5m, (outs), (ins opaque512mem:$dst),
430 "xrstor\t$dst", []>, TB;
431 def XRSTOR64 : I<0xAE, MRM5m, (outs), (ins opaque512mem:$dst),
432 "xrstorq\t$dst", []>, TB, REX_W, Requires<[In64BitMode]>;
433 def XSAVEOPT : I<0xAE, MRM6m, (outs opaque512mem:$dst), (ins),
434 "xsaveopt\t$dst", []>, TB;
435 def XSAVEOPT64 : I<0xAE, MRM6m, (outs opaque512mem:$dst), (ins),
436 "xsaveoptq\t$dst", []>, TB, REX_W, Requires<[In64BitMode]>;
437}
438
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000439//===----------------------------------------------------------------------===//
440// VIA PadLock crypto instructions
441let Defs = [RAX, RDI], Uses = [RDX, RDI] in
442 def XSTORE : I<0xc0, RawFrm, (outs), (ins), "xstore", []>, A7;
443
Joerg Sonnenbergerca0ede72011-06-30 01:38:03 +0000444def : InstAlias<"xstorerng", (XSTORE)>;
445
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000446let Defs = [RSI, RDI], Uses = [RBX, RDX, RSI, RDI] in {
447 def XCRYPTECB : I<0xc8, RawFrm, (outs), (ins), "xcryptecb", []>, A7;
448 def XCRYPTCBC : I<0xd0, RawFrm, (outs), (ins), "xcryptcbc", []>, A7;
449 def XCRYPTCTR : I<0xd8, RawFrm, (outs), (ins), "xcryptctr", []>, A7;
450 def XCRYPTCFB : I<0xe0, RawFrm, (outs), (ins), "xcryptcfb", []>, A7;
451 def XCRYPTOFB : I<0xe8, RawFrm, (outs), (ins), "xcryptofb", []>, A7;
452}
453
454let Defs = [RAX, RSI, RDI], Uses = [RAX, RSI, RDI] in {
455 def XSHA1 : I<0xc8, RawFrm, (outs), (ins), "xsha1", []>, A6;
456 def XSHA256 : I<0xd0, RawFrm, (outs), (ins), "xsha256", []>, A6;
457}
458let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in
459 def MONTMUL : I<0xc0, RawFrm, (outs), (ins), "montmul", []>, A6;
Craig Topper75fe5f32011-10-07 07:02:24 +0000460
461//===----------------------------------------------------------------------===//
462// FS/GS Base Instructions
Craig Toppere7b05502011-10-30 19:57:21 +0000463let Predicates = [HasFSGSBase, In64BitMode] in {
Craig Topper75fe5f32011-10-07 07:02:24 +0000464 def RDFSBASE : I<0xAE, MRM0r, (outs GR32:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000465 "rdfsbase{l}\t$dst",
466 [(set GR32:$dst, (int_x86_rdfsbase_32))]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000467 def RDFSBASE64 : RI<0xAE, MRM0r, (outs GR64:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000468 "rdfsbase{q}\t$dst",
469 [(set GR64:$dst, (int_x86_rdfsbase_64))]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000470 def RDGSBASE : I<0xAE, MRM1r, (outs GR32:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000471 "rdgsbase{l}\t$dst",
472 [(set GR32:$dst, (int_x86_rdgsbase_32))]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000473 def RDGSBASE64 : RI<0xAE, MRM1r, (outs GR64:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000474 "rdgsbase{q}\t$dst",
475 [(set GR64:$dst, (int_x86_rdgsbase_64))]>, TB, XS;
476 def WRFSBASE : I<0xAE, MRM2r, (outs), (ins GR32:$src),
477 "wrfsbase{l}\t$src",
478 [(int_x86_wrfsbase_32 GR32:$src)]>, TB, XS;
479 def WRFSBASE64 : RI<0xAE, MRM2r, (outs), (ins GR64:$src),
480 "wrfsbase{q}\t$src",
481 [(int_x86_wrfsbase_64 GR64:$src)]>, TB, XS;
482 def WRGSBASE : I<0xAE, MRM3r, (outs), (ins GR32:$src),
483 "wrgsbase{l}\t$src",
484 [(int_x86_wrgsbase_32 GR32:$src)]>, TB, XS;
485 def WRGSBASE64 : RI<0xAE, MRM3r, (outs), (ins GR64:$src),
486 "wrgsbase{q}\t$src",
487 [(int_x86_wrgsbase_64 GR64:$src)]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000488}
Craig Topperdc479c42011-10-16 07:05:40 +0000489
490//===----------------------------------------------------------------------===//
491// INVPCID Instruction
492def INVPCID32 : I<0x82, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
493 "invpcid {$src2, $src1|$src1, $src2}", []>, OpSize, T8,
494 Requires<[In32BitMode]>;
495def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
496 "invpcid {$src2, $src1|$src1, $src2}", []>, OpSize, T8,
497 Requires<[In64BitMode]>;