blob: ea716bfd6bd862df69b06acff7dc325812ed3bba [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
Dan Gohmana6063c62012-05-14 18:58:10 +000039def : Pat<(debugtrap),
Dan Gohmand4347e12012-05-11 00:19:32 +000040 (INT3)>;
41
Chris Lattner15f89512011-04-09 19:41:05 +000042// The long form of "int $3" turns into int3 as a size optimization.
43// FIXME: This doesn't work because InstAlias can't match immediate constants.
44//def : InstAlias<"int\t$3", (INT3)>;
45
46
Chris Lattner434c7cb2010-10-05 05:32:15 +000047def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap",
Preston Gurd3d142e52012-05-04 19:26:37 +000048 [(int_x86_int imm:$trap)], IIC_INT>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000049
Chris Lattner15f89512011-04-09 19:41:05 +000050
Preston Gurd3d142e52012-05-04 19:26:37 +000051def SYSCALL : I<0x05, RawFrm, (outs), (ins), "syscall", [], IIC_SYSCALL>, TB;
52def SYSRET : I<0x07, RawFrm, (outs), (ins), "sysret{l}", [], IIC_SYSCALL>, TB;
53def SYSRET64 :RI<0x07, RawFrm, (outs), (ins), "sysret{q}", [], IIC_SYSCALL>, TB,
Chris Lattner87be16a2010-10-05 06:04:14 +000054 Requires<[In64BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000055
Preston Gurd3d142e52012-05-04 19:26:37 +000056def SYSENTER : I<0x34, RawFrm, (outs), (ins), "sysenter", [],
57 IIC_SYS_ENTER_EXIT>, TB;
58
59def SYSEXIT : I<0x35, RawFrm, (outs), (ins), "sysexit{l}", [],
60 IIC_SYS_ENTER_EXIT>, TB;
Bill Wendlinge060eb82012-03-10 07:37:27 +000061def SYSEXIT64 :RI<0x35, RawFrm, (outs), (ins), "sysexit{q}", []>, TB,
Chris Lattner87be16a2010-10-05 06:04:14 +000062 Requires<[In64BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000063
Preston Gurd3d142e52012-05-04 19:26:37 +000064def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iret{w}", [], IIC_IRET>, OpSize;
65def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l|d}", [], IIC_IRET>;
66def IRET64 : RI<0xcf, RawFrm, (outs), (ins), "iretq", [], IIC_IRET>,
Chris Lattner434c7cb2010-10-05 05:32:15 +000067 Requires<[In64BitMode]>;
68
69
70//===----------------------------------------------------------------------===//
71// Input/Output Instructions.
72//
73let Defs = [AL], Uses = [DX] in
74def IN8rr : I<0xEC, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000075 "in{b}\t{%dx, %al|AL, DX}", [], IIC_IN_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000076let Defs = [AX], Uses = [DX] in
77def IN16rr : I<0xED, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000078 "in{w}\t{%dx, %ax|AX, DX}", [], IIC_IN_RR>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +000079let Defs = [EAX], Uses = [DX] in
80def IN32rr : I<0xED, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000081 "in{l}\t{%dx, %eax|EAX, DX}", [], IIC_IN_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000082
83let Defs = [AL] in
84def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +000085 "in{b}\t{$port, %al|AL, $port}", [], IIC_IN_RI>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000086let Defs = [AX] in
87def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +000088 "in{w}\t{$port, %ax|AX, $port}", [], IIC_IN_RI>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +000089let Defs = [EAX] in
90def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +000091 "in{l}\t{$port, %eax|EAX, $port}", [], IIC_IN_RI>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000092
93let Uses = [DX, AL] in
94def OUT8rr : I<0xEE, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000095 "out{b}\t{%al, %dx|DX, AL}", [], IIC_OUT_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +000096let Uses = [DX, AX] in
97def OUT16rr : I<0xEF, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +000098 "out{w}\t{%ax, %dx|DX, AX}", [], IIC_OUT_RR>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +000099let Uses = [DX, EAX] in
100def OUT32rr : I<0xEF, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000101 "out{l}\t{%eax, %dx|DX, EAX}", [], IIC_OUT_RR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000102
103let Uses = [AL] in
104def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +0000105 "out{b}\t{%al, $port|$port, AL}", [], IIC_OUT_IR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000106let Uses = [AX] in
107def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +0000108 "out{w}\t{%ax, $port|$port, AX}", [], IIC_OUT_IR>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000109let Uses = [EAX] in
110def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port),
Preston Gurd3d142e52012-05-04 19:26:37 +0000111 "out{l}\t{%eax, $port|$port, EAX}", [], IIC_OUT_IR>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000112
Preston Gurd3d142e52012-05-04 19:26:37 +0000113def IN8 : I<0x6C, RawFrm, (outs), (ins), "ins{b}", [], IIC_INS>;
114def IN16 : I<0x6D, RawFrm, (outs), (ins), "ins{w}", [], IIC_INS>, OpSize;
115def IN32 : I<0x6D, RawFrm, (outs), (ins), "ins{l}", [], IIC_INS>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000116
117//===----------------------------------------------------------------------===//
118// Moves to and from debug registers
119
120def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000121 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_DR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000122def MOV64rd : I<0x21, MRMDestReg, (outs GR64:$dst), (ins DEBUG_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000123 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_DR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000124
125def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000126 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_DR_REG>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000127def MOV64dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000128 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_DR_REG>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000129
130//===----------------------------------------------------------------------===//
131// Moves to and from control registers
132
133def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000134 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_CR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000135def MOV64rc : I<0x20, MRMDestReg, (outs GR64:$dst), (ins CONTROL_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000136 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_CR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000137
138def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000139 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_CR_REG>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000140def MOV64cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000141 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_CR_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000142
143//===----------------------------------------------------------------------===//
144// Segment override instruction prefixes
145
Chris Lattner87be16a2010-10-05 06:04:14 +0000146def CS_PREFIX : I<0x2E, RawFrm, (outs), (ins), "cs", []>;
147def SS_PREFIX : I<0x36, RawFrm, (outs), (ins), "ss", []>;
148def DS_PREFIX : I<0x3E, RawFrm, (outs), (ins), "ds", []>;
149def ES_PREFIX : I<0x26, RawFrm, (outs), (ins), "es", []>;
150def FS_PREFIX : I<0x64, RawFrm, (outs), (ins), "fs", []>;
151def GS_PREFIX : I<0x65, RawFrm, (outs), (ins), "gs", []>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000152
153
154//===----------------------------------------------------------------------===//
Chris Lattner87be16a2010-10-05 06:04:14 +0000155// Moves to and from segment registers.
156//
157
158def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000159 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000160def MOV32rs : I<0x8C, MRMDestReg, (outs GR32:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000161 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000162def MOV64rs : RI<0x8C, MRMDestReg, (outs GR64:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000163 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000164
165def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000166 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000167def MOV32ms : I<0x8C, MRMDestMem, (outs i32mem:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000168 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000169def MOV64ms : RI<0x8C, MRMDestMem, (outs i64mem:$dst), (ins SEGMENT_REG:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000170 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000171
172def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000173 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000174def MOV32sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000175 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000176def MOV64sr : RI<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000177 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000178
179def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000180 "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>, OpSize;
Chris Lattner87be16a2010-10-05 06:04:14 +0000181def MOV32sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000182 "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000183def MOV64sm : RI<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i64mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000184 "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000185
186//===----------------------------------------------------------------------===//
Chris Lattner434c7cb2010-10-05 05:32:15 +0000187// Segmentation support instructions.
188
Preston Gurd3d142e52012-05-04 19:26:37 +0000189def SWAPGS : I<0x01, MRM_F8, (outs), (ins), "swapgs", [], IIC_SWAPGS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000190
Chris Lattner434c7cb2010-10-05 05:32:15 +0000191def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000192 "lar{w}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000193def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000194 "lar{w}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000195
196// i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo.
197def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000198 "lar{l}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000199def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000200 "lar{l}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000201// i16mem operand in LAR64rm and GR32 operand in LAR32rr is not a typo.
202def LAR64rm : RI<0x02, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000203 "lar{q}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000204def LAR64rr : RI<0x02, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000205 "lar{q}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000206
207def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000208 "lsl{w}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000209def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000210 "lsl{w}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000211def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000212 "lsl{l}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000213def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000214 "lsl{l}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000215def LSL64rm : RI<0x03, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000216 "lsl{q}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000217def LSL64rr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000218 "lsl{q}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000219
Preston Gurd3d142e52012-05-04 19:26:37 +0000220def INVLPG : I<0x01, MRM7m, (outs), (ins i8mem:$addr), "invlpg\t$addr",
221 [], IIC_INVLPG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000222
Eli Friedmanac39bd52011-03-04 00:10:17 +0000223def STR16r : I<0x00, MRM1r, (outs GR16:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000224 "str{w}\t$dst", [], IIC_STR>, TB, OpSize;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000225def STR32r : I<0x00, MRM1r, (outs GR32:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000226 "str{l}\t$dst", [], IIC_STR>, TB;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000227def STR64r : RI<0x00, MRM1r, (outs GR64:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000228 "str{q}\t$dst", [], IIC_STR>, TB;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000229def STRm : I<0x00, MRM1m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000230 "str{w}\t$dst", [], IIC_STR>, TB;
Eli Friedmanac39bd52011-03-04 00:10:17 +0000231
Chris Lattner434c7cb2010-10-05 05:32:15 +0000232def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000233 "ltr{w}\t$src", [], IIC_LTR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000234def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000235 "ltr{w}\t$src", [], IIC_LTR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000236
237def PUSHCS16 : I<0x0E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000238 "push{w}\t{%cs|CS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
239 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000240def PUSHCS32 : I<0x0E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000241 "push{l}\t{%cs|CS}", [], IIC_PUSH_CS>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000242def PUSHSS16 : I<0x16, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000243 "push{w}\t{%ss|SS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
244 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000245def PUSHSS32 : I<0x16, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000246 "push{l}\t{%ss|SS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000247def PUSHDS16 : I<0x1E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000248 "push{w}\t{%ds|DS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
249 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000250def PUSHDS32 : I<0x1E, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000251 "push{l}\t{%ds|DS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000252def PUSHES16 : I<0x06, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000253 "push{w}\t{%es|ES}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>,
254 OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000255def PUSHES32 : I<0x06, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000256 "push{l}\t{%es|ES}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000257
258def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000259 "push{w}\t{%fs|FS}", [], IIC_PUSH_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000260def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000261 "push{l}\t{%fs|FS}", [], IIC_PUSH_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000262def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000263 "push{w}\t{%gs|GS}", [], IIC_PUSH_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000264def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000265 "push{l}\t{%gs|GS}", [], IIC_PUSH_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000266
267def PUSHFS64 : I<0xa0, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000268 "push{q}\t{%fs|FS}", [], IIC_PUSH_SR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000269def PUSHGS64 : I<0xa8, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000270 "push{q}\t{%gs|GS}", [], IIC_PUSH_SR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000271
272// No "pop cs" instruction.
273def POPSS16 : I<0x17, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000274 "pop{w}\t{%ss|SS}", [], IIC_POP_SR_SS>,
275 OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000276def POPSS32 : I<0x17, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000277 "pop{l}\t{%ss|SS}", [], IIC_POP_SR_SS>,
278 Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000279
Chris Lattner434c7cb2010-10-05 05:32:15 +0000280def POPDS16 : I<0x1F, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000281 "pop{w}\t{%ds|DS}", [], IIC_POP_SR>,
282 OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000283def POPDS32 : I<0x1F, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000284 "pop{l}\t{%ds|DS}", [], IIC_POP_SR>,
285 Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000286
Chris Lattner434c7cb2010-10-05 05:32:15 +0000287def POPES16 : I<0x07, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000288 "pop{w}\t{%es|ES}", [], IIC_POP_SR>,
289 OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000290def POPES32 : I<0x07, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000291 "pop{l}\t{%es|ES}", [], IIC_POP_SR>,
292 Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000293
Chris Lattner434c7cb2010-10-05 05:32:15 +0000294def POPFS16 : I<0xa1, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000295 "pop{w}\t{%fs|FS}", [], IIC_POP_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000296def POPFS32 : I<0xa1, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000297 "pop{l}\t{%fs|FS}", [], IIC_POP_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000298def POPFS64 : I<0xa1, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000299 "pop{q}\t{%fs|FS}", [], IIC_POP_SR>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000300
Chris Lattner434c7cb2010-10-05 05:32:15 +0000301def POPGS16 : I<0xa9, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000302 "pop{w}\t{%gs|GS}", [], IIC_POP_SR>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000303def POPGS32 : I<0xa9, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000304 "pop{l}\t{%gs|GS}", [], IIC_POP_SR>, TB, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000305def POPGS64 : I<0xa9, RawFrm, (outs), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000306 "pop{q}\t{%gs|GS}", [], IIC_POP_SR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000307
308
309def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000310 "lds{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000311def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000312 "lds{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000313
Chris Lattner434c7cb2010-10-05 05:32:15 +0000314def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000315 "lss{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000316def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000317 "lss{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000318def LSS64rm : RI<0xb2, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000319 "lss{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000320
Chris Lattner434c7cb2010-10-05 05:32:15 +0000321def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000322 "les{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000323def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000324 "les{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>;
Chris Lattner87be16a2010-10-05 06:04:14 +0000325
Chris Lattner434c7cb2010-10-05 05:32:15 +0000326def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000327 "lfs{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000328def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000329 "lfs{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000330def LFS64rm : RI<0xb4, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000331 "lfs{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000332
Chris Lattner434c7cb2010-10-05 05:32:15 +0000333def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000334 "lgs{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000335def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000336 "lgs{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner87be16a2010-10-05 06:04:14 +0000337
Chris Lattner434c7cb2010-10-05 05:32:15 +0000338def LGS64rm : RI<0xb5, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000339 "lgs{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000340
341
342def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000343 "verr\t$seg", [], IIC_VERR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000344def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000345 "verr\t$seg", [], IIC_VERR>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000346def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000347 "verw\t$seg", [], IIC_VERW_MEM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000348def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg),
Preston Gurd3d142e52012-05-04 19:26:37 +0000349 "verw\t$seg", [], IIC_VERW_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000350
351//===----------------------------------------------------------------------===//
352// Descriptor-table support instructions
353
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000354def SGDT16m : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000355 "sgdtw\t$dst", [], IIC_SGDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000356def SGDTm : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000357 "sgdt\t$dst", [], IIC_SGDT>, TB;
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000358def SIDT16m : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000359 "sidtw\t$dst", [], IIC_SIDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000360def SIDTm : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins),
361 "sidt\t$dst", []>, TB;
362def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000363 "sldt{w}\t$dst", [], IIC_SLDT>, TB, OpSize;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000364def SLDT16m : I<0x00, MRM0m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000365 "sldt{w}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000366def SLDT32r : I<0x00, MRM0r, (outs GR32:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000367 "sldt{l}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000368
369// LLDT is not interpreted specially in 64-bit mode because there is no sign
370// extension.
371def SLDT64r : RI<0x00, MRM0r, (outs GR64:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000372 "sldt{q}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000373def SLDT64m : RI<0x00, MRM0m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000374 "sldt{q}\t$dst", [], IIC_SLDT>, TB;
Chris Lattner010496c2010-10-05 06:22:35 +0000375
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000376def LGDT16m : I<0x01, MRM2m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000377 "lgdtw\t$src", [], IIC_LGDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000378def LGDTm : I<0x01, MRM2m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000379 "lgdt\t$src", [], IIC_LGDT>, TB;
Kevin Enderby87f4a1a2010-10-19 00:01:44 +0000380def LIDT16m : I<0x01, MRM3m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000381 "lidtw\t$src", [], IIC_LIDT>, TB, OpSize, Requires<[In32BitMode]>;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000382def LIDTm : I<0x01, MRM3m, (outs), (ins opaque48mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000383 "lidt\t$src", [], IIC_LIDT>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000384def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000385 "lldt{w}\t$src", [], IIC_LLDT_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000386def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000387 "lldt{w}\t$src", [], IIC_LLDT_MEM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000388
389//===----------------------------------------------------------------------===//
390// Specialized register support
Preston Gurd3d142e52012-05-04 19:26:37 +0000391def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", [], IIC_WRMSR>, TB;
392def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", [], IIC_RDMSR>, TB;
393def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", [], IIC_RDPMC>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000394
395def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000396 "smsw{w}\t$dst", [], IIC_SMSW>, OpSize, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000397def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000398 "smsw{l}\t$dst", [], IIC_SMSW>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000399// no m form encodable; use SMSW16m
400def SMSW64r : RI<0x01, MRM4r, (outs GR64:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000401 "smsw{q}\t$dst", [], IIC_SMSW>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000402
403// For memory operands, there is only a 16-bit form
404def SMSW16m : I<0x01, MRM4m, (outs i16mem:$dst), (ins),
Preston Gurd3d142e52012-05-04 19:26:37 +0000405 "smsw{w}\t$dst", [], IIC_SMSW>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000406
407def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000408 "lmsw{w}\t$src", [], IIC_LMSW_MEM>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000409def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src),
Preston Gurd3d142e52012-05-04 19:26:37 +0000410 "lmsw{w}\t$src", [], IIC_LMSW_REG>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000411
Preston Gurd3d142e52012-05-04 19:26:37 +0000412def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", [], IIC_CPUID>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000413
414//===----------------------------------------------------------------------===//
415// Cache instructions
Preston Gurd3d142e52012-05-04 19:26:37 +0000416def INVD : I<0x08, RawFrm, (outs), (ins), "invd", [], IIC_INVD>, TB;
417def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [], IIC_INVD>, TB;
Chris Lattner434c7cb2010-10-05 05:32:15 +0000418
Craig Topper75fe5f32011-10-07 07:02:24 +0000419//===----------------------------------------------------------------------===//
420// XSAVE instructions
Rafael Espindola87ca0e02011-02-22 00:35:18 +0000421let Defs = [RDX, RAX], Uses = [RCX] in
422 def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB;
423
424let Uses = [RDX, RAX, RCX] in
425 def XSETBV : I<0x01, MRM_D1, (outs), (ins), "xsetbv", []>, TB;
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000426
Craig Topper1b526a92011-10-07 05:53:50 +0000427let Uses = [RDX, RAX] in {
428 def XSAVE : I<0xAE, MRM4m, (outs opaque512mem:$dst), (ins),
429 "xsave\t$dst", []>, TB;
430 def XSAVE64 : I<0xAE, MRM4m, (outs opaque512mem:$dst), (ins),
431 "xsaveq\t$dst", []>, TB, REX_W, Requires<[In64BitMode]>;
432 def XRSTOR : I<0xAE, MRM5m, (outs), (ins opaque512mem:$dst),
433 "xrstor\t$dst", []>, TB;
434 def XRSTOR64 : I<0xAE, MRM5m, (outs), (ins opaque512mem:$dst),
435 "xrstorq\t$dst", []>, TB, REX_W, Requires<[In64BitMode]>;
436 def XSAVEOPT : I<0xAE, MRM6m, (outs opaque512mem:$dst), (ins),
437 "xsaveopt\t$dst", []>, TB;
438 def XSAVEOPT64 : I<0xAE, MRM6m, (outs opaque512mem:$dst), (ins),
439 "xsaveoptq\t$dst", []>, TB, REX_W, Requires<[In64BitMode]>;
440}
441
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000442//===----------------------------------------------------------------------===//
443// VIA PadLock crypto instructions
444let Defs = [RAX, RDI], Uses = [RDX, RDI] in
445 def XSTORE : I<0xc0, RawFrm, (outs), (ins), "xstore", []>, A7;
446
Joerg Sonnenbergerca0ede72011-06-30 01:38:03 +0000447def : InstAlias<"xstorerng", (XSTORE)>;
448
Joerg Sonnenberger4a8ac8d2011-04-04 16:58:13 +0000449let Defs = [RSI, RDI], Uses = [RBX, RDX, RSI, RDI] in {
450 def XCRYPTECB : I<0xc8, RawFrm, (outs), (ins), "xcryptecb", []>, A7;
451 def XCRYPTCBC : I<0xd0, RawFrm, (outs), (ins), "xcryptcbc", []>, A7;
452 def XCRYPTCTR : I<0xd8, RawFrm, (outs), (ins), "xcryptctr", []>, A7;
453 def XCRYPTCFB : I<0xe0, RawFrm, (outs), (ins), "xcryptcfb", []>, A7;
454 def XCRYPTOFB : I<0xe8, RawFrm, (outs), (ins), "xcryptofb", []>, A7;
455}
456
457let Defs = [RAX, RSI, RDI], Uses = [RAX, RSI, RDI] in {
458 def XSHA1 : I<0xc8, RawFrm, (outs), (ins), "xsha1", []>, A6;
459 def XSHA256 : I<0xd0, RawFrm, (outs), (ins), "xsha256", []>, A6;
460}
461let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in
462 def MONTMUL : I<0xc0, RawFrm, (outs), (ins), "montmul", []>, A6;
Craig Topper75fe5f32011-10-07 07:02:24 +0000463
464//===----------------------------------------------------------------------===//
465// FS/GS Base Instructions
Craig Toppere7b05502011-10-30 19:57:21 +0000466let Predicates = [HasFSGSBase, In64BitMode] in {
Craig Topper75fe5f32011-10-07 07:02:24 +0000467 def RDFSBASE : I<0xAE, MRM0r, (outs GR32:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000468 "rdfsbase{l}\t$dst",
469 [(set GR32:$dst, (int_x86_rdfsbase_32))]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000470 def RDFSBASE64 : RI<0xAE, MRM0r, (outs GR64:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000471 "rdfsbase{q}\t$dst",
472 [(set GR64:$dst, (int_x86_rdfsbase_64))]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000473 def RDGSBASE : I<0xAE, MRM1r, (outs GR32:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000474 "rdgsbase{l}\t$dst",
475 [(set GR32:$dst, (int_x86_rdgsbase_32))]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000476 def RDGSBASE64 : RI<0xAE, MRM1r, (outs GR64:$dst), (ins),
Craig Toppere7b05502011-10-30 19:57:21 +0000477 "rdgsbase{q}\t$dst",
478 [(set GR64:$dst, (int_x86_rdgsbase_64))]>, TB, XS;
479 def WRFSBASE : I<0xAE, MRM2r, (outs), (ins GR32:$src),
480 "wrfsbase{l}\t$src",
481 [(int_x86_wrfsbase_32 GR32:$src)]>, TB, XS;
482 def WRFSBASE64 : RI<0xAE, MRM2r, (outs), (ins GR64:$src),
483 "wrfsbase{q}\t$src",
484 [(int_x86_wrfsbase_64 GR64:$src)]>, TB, XS;
485 def WRGSBASE : I<0xAE, MRM3r, (outs), (ins GR32:$src),
486 "wrgsbase{l}\t$src",
487 [(int_x86_wrgsbase_32 GR32:$src)]>, TB, XS;
488 def WRGSBASE64 : RI<0xAE, MRM3r, (outs), (ins GR64:$src),
489 "wrgsbase{q}\t$src",
490 [(int_x86_wrgsbase_64 GR64:$src)]>, TB, XS;
Craig Topper75fe5f32011-10-07 07:02:24 +0000491}
Craig Topperdc479c42011-10-16 07:05:40 +0000492
493//===----------------------------------------------------------------------===//
494// INVPCID Instruction
495def INVPCID32 : I<0x82, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2),
496 "invpcid {$src2, $src1|$src1, $src2}", []>, OpSize, T8,
497 Requires<[In32BitMode]>;
498def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
499 "invpcid {$src2, $src1|$src1, $src2}", []>, OpSize, T8,
500 Requires<[In64BitMode]>;