| 1 |
//===-- X86InstrSystem.td - System Instructions ------------*- tablegen -*-===// |
| 2 |
// |
| 3 |
// The LLVM Compiler Infrastructure |
| 4 |
// |
| 5 |
// This file is distributed under the University of Illinois Open Source |
| 6 |
// License. See LICENSE.TXT for details. |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 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 |
|
| 16 |
let SchedRW = [WriteSystem] in { |
| 17 |
let Defs = [RAX, RDX] in |
| 18 |
def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>, TB; |
| 19 |
|
| 20 |
let Defs = [RAX, RCX, RDX] in |
| 21 |
def RDTSCP : I<0x01, MRM_F9, (outs), (ins), "rdtscp", [(X86rdtscp)]>, TB; |
| 22 |
|
| 23 |
// CPU flow control instructions |
| 24 |
|
| 25 |
let mayLoad = 1, mayStore = 0, hasSideEffects = 1, isTrap = 1 in { |
| 26 |
def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB; |
| 27 |
|
| 28 |
def UD1Wm : I<0xB9, MRMSrcMem, (outs), (ins GR16:$src1, i16mem:$src2), |
| 29 |
"ud1{w} {$src2, $src1|$src1, $src2}", []>, TB, OpSize16; |
| 30 |
def UD1Lm : I<0xB9, MRMSrcMem, (outs), (ins GR32:$src1, i32mem:$src2), |
| 31 |
"ud1{l} {$src2, $src1|$src1, $src2}", []>, TB, OpSize32; |
| 32 |
def UD1Qm : RI<0xB9, MRMSrcMem, (outs), (ins GR64:$src1, i64mem:$src2), |
| 33 |
"ud1{q} {$src2, $src1|$src1, $src2}", []>, TB; |
| 34 |
|
| 35 |
def UD1Wr : I<0xB9, MRMSrcReg, (outs), (ins GR16:$src1, GR16:$src2), |
| 36 |
"ud1{w} {$src2, $src1|$src1, $src2}", []>, TB, OpSize16; |
| 37 |
def UD1Lr : I<0xB9, MRMSrcReg, (outs), (ins GR32:$src1, GR32:$src2), |
| 38 |
"ud1{l} {$src2, $src1|$src1, $src2}", []>, TB, OpSize32; |
| 39 |
def UD1Qr : RI<0xB9, MRMSrcReg, (outs), (ins GR64:$src1, GR64:$src2), |
| 40 |
"ud1{q} {$src2, $src1|$src1, $src2}", []>, TB; |
| 41 |
} |
| 42 |
|
| 43 |
def HLT : I<0xF4, RawFrm, (outs), (ins), "hlt", []>; |
| 44 |
def RSM : I<0xAA, RawFrm, (outs), (ins), "rsm", []>, TB; |
| 45 |
|
| 46 |
// Interrupt and SysCall Instructions. |
| 47 |
let Uses = [EFLAGS] in |
| 48 |
def INTO : I<0xce, RawFrm, (outs), (ins), "into", []>, Requires<[Not64BitMode]>; |
| 49 |
|
| 50 |
def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3", [(int_x86_int (i8 3))]>; |
| 51 |
} // SchedRW |
| 52 |
|
| 53 |
// The long form of "int $3" turns into int3 as a size optimization. |
| 54 |
// FIXME: This doesn't work because InstAlias can't match immediate constants. |
| 55 |
//// def : InstAlias<"int\t$3", (INT3)>; |
| 56 |
|
| 57 |
let SchedRW = [WriteSystem] in { |
| 58 |
|
| 59 |
def INT : Ii8<0xcd, RawFrm, (outs), (ins u8imm:$trap), "int\t$trap", |
| 60 |
[(int_x86_int imm:$trap)]>; |
| 61 |
|
| 62 |
|
| 63 |
def SYSCALL : I<0x05, RawFrm, (outs), (ins), "syscall", []>, TB; |
| 64 |
def SYSRET : I<0x07, RawFrm, (outs), (ins), "sysret{l}", []>, TB; |
| 65 |
def SYSRET64 :RI<0x07, RawFrm, (outs), (ins), "sysretq", []>, TB, |
| 66 |
Requires<[In64BitMode]>; |
| 67 |
|
| 68 |
def SYSENTER : I<0x34, RawFrm, (outs), (ins), "sysenter", []>, TB; |
| 69 |
|
| 70 |
def SYSEXIT : I<0x35, RawFrm, (outs), (ins), "sysexit{l}", []>, TB; |
| 71 |
def SYSEXIT64 :RI<0x35, RawFrm, (outs), (ins), "sysexitq", []>, TB, |
| 72 |
Requires<[In64BitMode]>; |
| 73 |
} // SchedRW |
| 74 |
|
| 75 |
def : Pat<(debugtrap), |
| 76 |
(INT3)>, Requires<[NotPS4]>; |
| 77 |
def : Pat<(debugtrap), |
| 78 |
(INT (i8 0x41))>, Requires<[IsPS4]>; |
| 79 |
|
| 80 |
//===----------------------------------------------------------------------===// |
| 81 |
// Input/Output Instructions. |
| 82 |
// |
| 83 |
let SchedRW = [WriteSystem] in { |
| 84 |
let Defs = [AL], Uses = [DX] in |
| 85 |
def IN8rr : I<0xEC, RawFrm, (outs), (ins), "in{b}\t{%dx, %al|al, dx}", []>; |
| 86 |
let Defs = [AX], Uses = [DX] in |
| 87 |
def IN16rr : I<0xED, RawFrm, (outs), (ins), "in{w}\t{%dx, %ax|ax, dx}", []>, |
| 88 |
OpSize16; |
| 89 |
let Defs = [EAX], Uses = [DX] in |
| 90 |
def IN32rr : I<0xED, RawFrm, (outs), (ins), "in{l}\t{%dx, %eax|eax, dx}", []>, |
| 91 |
OpSize32; |
| 92 |
|
| 93 |
let Defs = [AL] in |
| 94 |
def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins u8imm:$port), |
| 95 |
"in{b}\t{$port, %al|al, $port}", []>; |
| 96 |
let Defs = [AX] in |
| 97 |
def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins u8imm:$port), |
| 98 |
"in{w}\t{$port, %ax|ax, $port}", []>, OpSize16; |
| 99 |
let Defs = [EAX] in |
| 100 |
def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins u8imm:$port), |
| 101 |
"in{l}\t{$port, %eax|eax, $port}", []>, OpSize32; |
| 102 |
|
| 103 |
let Uses = [DX, AL] in |
| 104 |
def OUT8rr : I<0xEE, RawFrm, (outs), (ins), "out{b}\t{%al, %dx|dx, al}", []>; |
| 105 |
let Uses = [DX, AX] in |
| 106 |
def OUT16rr : I<0xEF, RawFrm, (outs), (ins), "out{w}\t{%ax, %dx|dx, ax}", []>, |
| 107 |
OpSize16; |
| 108 |
let Uses = [DX, EAX] in |
| 109 |
def OUT32rr : I<0xEF, RawFrm, (outs), (ins), "out{l}\t{%eax, %dx|dx, eax}", []>, |
| 110 |
OpSize32; |
| 111 |
|
| 112 |
let Uses = [AL] in |
| 113 |
def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins u8imm:$port), |
| 114 |
"out{b}\t{%al, $port|$port, al}", []>; |
| 115 |
let Uses = [AX] in |
| 116 |
def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins u8imm:$port), |
| 117 |
"out{w}\t{%ax, $port|$port, ax}", []>, OpSize16; |
| 118 |
let Uses = [EAX] in |
| 119 |
def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins u8imm:$port), |
| 120 |
"out{l}\t{%eax, $port|$port, eax}", []>, OpSize32; |
| 121 |
|
| 122 |
} // SchedRW |
| 123 |
|
| 124 |
//===----------------------------------------------------------------------===// |
| 125 |
// Moves to and from debug registers |
| 126 |
|
| 127 |
let SchedRW = [WriteSystem] in { |
| 128 |
def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src), |
| 129 |
"mov{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 130 |
Requires<[Not64BitMode]>; |
| 131 |
def MOV64rd : I<0x21, MRMDestReg, (outs GR64:$dst), (ins DEBUG_REG:$src), |
| 132 |
"mov{q}\t{$src, $dst|$dst, $src}", []>, TB, |
| 133 |
Requires<[In64BitMode]>; |
| 134 |
|
| 135 |
def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src), |
| 136 |
"mov{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 137 |
Requires<[Not64BitMode]>; |
| 138 |
def MOV64dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR64:$src), |
| 139 |
"mov{q}\t{$src, $dst|$dst, $src}", []>, TB, |
| 140 |
Requires<[In64BitMode]>; |
| 141 |
} // SchedRW |
| 142 |
|
| 143 |
//===----------------------------------------------------------------------===// |
| 144 |
// Moves to and from control registers |
| 145 |
|
| 146 |
let SchedRW = [WriteSystem] in { |
| 147 |
def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG:$src), |
| 148 |
"mov{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 149 |
Requires<[Not64BitMode]>; |
| 150 |
def MOV64rc : I<0x20, MRMDestReg, (outs GR64:$dst), (ins CONTROL_REG:$src), |
| 151 |
"mov{q}\t{$src, $dst|$dst, $src}", []>, TB, |
| 152 |
Requires<[In64BitMode]>; |
| 153 |
|
| 154 |
def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR32:$src), |
| 155 |
"mov{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 156 |
Requires<[Not64BitMode]>; |
| 157 |
def MOV64cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR64:$src), |
| 158 |
"mov{q}\t{$src, $dst|$dst, $src}", []>, TB, |
| 159 |
Requires<[In64BitMode]>; |
| 160 |
} // SchedRW |
| 161 |
|
| 162 |
//===----------------------------------------------------------------------===// |
| 163 |
// Segment override instruction prefixes |
| 164 |
|
| 165 |
//let SchedRW = [WriteNop] in { |
| 166 |
//def CS_PREFIX : I<0x2E, RawFrm, (outs), (ins), "cs", []>; |
| 167 |
//def SS_PREFIX : I<0x36, RawFrm, (outs), (ins), "ss", []>; |
| 168 |
//def DS_PREFIX : I<0x3E, RawFrm, (outs), (ins), "ds", []>; |
| 169 |
//def ES_PREFIX : I<0x26, RawFrm, (outs), (ins), "es", []>; |
| 170 |
//def FS_PREFIX : I<0x64, RawFrm, (outs), (ins), "fs", []>; |
| 171 |
//def GS_PREFIX : I<0x65, RawFrm, (outs), (ins), "gs", []>; |
| 172 |
//} // SchedRW |
| 173 |
|
| 174 |
//===----------------------------------------------------------------------===// |
| 175 |
// Moves to and from segment registers. |
| 176 |
// |
| 177 |
|
| 178 |
let SchedRW = [WriteMove] in { |
| 179 |
def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src), |
| 180 |
"mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize16; |
| 181 |
def MOV32rs : I<0x8C, MRMDestReg, (outs GR32:$dst), (ins SEGMENT_REG:$src), |
| 182 |
"mov{l}\t{$src, $dst|$dst, $src}", []>, OpSize32; |
| 183 |
def MOV64rs : RI<0x8C, MRMDestReg, (outs GR64:$dst), (ins SEGMENT_REG:$src), |
| 184 |
"mov{q}\t{$src, $dst|$dst, $src}", []>; |
| 185 |
let mayStore = 1 in { |
| 186 |
def MOV16ms : I<0x8C, MRMDestMem, (outs), (ins i16mem:$dst, SEGMENT_REG:$src), |
| 187 |
"mov{w}\t{$src, $dst|$dst, $src}", []>; |
| 188 |
} |
| 189 |
def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src), |
| 190 |
"mov{w}\t{$src, $dst|$dst, $src}", []>, OpSize16; |
| 191 |
def MOV32sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR32:$src), |
| 192 |
"mov{l}\t{$src, $dst|$dst, $src}", []>, OpSize32; |
| 193 |
def MOV64sr : RI<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR64:$src), |
| 194 |
"mov{q}\t{$src, $dst|$dst, $src}", []>; |
| 195 |
let mayLoad = 1 in { |
| 196 |
def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src), |
| 197 |
"mov{w}\t{$src, $dst|$dst, $src}", []>; |
| 198 |
} |
| 199 |
} // SchedRW |
| 200 |
|
| 201 |
//===----------------------------------------------------------------------===// |
| 202 |
// Segmentation support instructions. |
| 203 |
|
| 204 |
let SchedRW = [WriteSystem] in { |
| 205 |
def SWAPGS : I<0x01, MRM_F8, (outs), (ins), "swapgs", []>, TB; |
| 206 |
|
| 207 |
let mayLoad = 1 in |
| 208 |
def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 209 |
"lar{w}\t{$src, $dst|$dst, $src}", []>, TB, |
| 210 |
OpSize16, NotMemoryFoldable; |
| 211 |
def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 212 |
"lar{w}\t{$src, $dst|$dst, $src}", []>, TB, |
| 213 |
OpSize16, NotMemoryFoldable; |
| 214 |
|
| 215 |
// i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo. |
| 216 |
let mayLoad = 1 in |
| 217 |
def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
| 218 |
"lar{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 219 |
OpSize32, NotMemoryFoldable; |
| 220 |
def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 221 |
"lar{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 222 |
OpSize32, NotMemoryFoldable; |
| 223 |
// i16mem operand in LAR64rm and GR32 operand in LAR64rr is not a typo. |
| 224 |
let mayLoad = 1 in |
| 225 |
def LAR64rm : RI<0x02, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src), |
| 226 |
"lar{q}\t{$src, $dst|$dst, $src}", []>, TB, NotMemoryFoldable; |
| 227 |
def LAR64rr : RI<0x02, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src), |
| 228 |
"lar{q}\t{$src, $dst|$dst, $src}", []>, TB, NotMemoryFoldable; |
| 229 |
|
| 230 |
// i16mem operand in LSL32rm and GR32 operand in LSL32rr is not a typo. |
| 231 |
let mayLoad = 1 in |
| 232 |
def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
| 233 |
"lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, |
| 234 |
OpSize16, NotMemoryFoldable; |
| 235 |
def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
| 236 |
"lsl{w}\t{$src, $dst|$dst, $src}", []>, TB, |
| 237 |
OpSize16, NotMemoryFoldable; |
| 238 |
// i16mem operand in LSL64rm and GR32 operand in LSL64rr is not a typo. |
| 239 |
let mayLoad = 1 in |
| 240 |
def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
| 241 |
"lsl{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 242 |
OpSize32, NotMemoryFoldable; |
| 243 |
def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
| 244 |
"lsl{l}\t{$src, $dst|$dst, $src}", []>, TB, |
| 245 |
OpSize32, NotMemoryFoldable; |
| 246 |
let mayLoad = 1 in |
| 247 |
def LSL64rm : RI<0x03, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src), |
| 248 |
"lsl{q}\t{$src, $dst|$dst, $src}", []>, TB, NotMemoryFoldable; |
| 249 |
def LSL64rr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src), |
| 250 |
"lsl{q}\t{$src, $dst|$dst, $src}", []>, TB, NotMemoryFoldable; |
| 251 |
|
| 252 |
def INVLPG : I<0x01, MRM7m, (outs), (ins i8mem:$addr), "invlpg\t$addr", []>, TB; |
| 253 |
|
| 254 |
def STR16r : I<0x00, MRM1r, (outs GR16:$dst), (ins), |
| 255 |
"str{w}\t$dst", []>, TB, OpSize16; |
| 256 |
def STR32r : I<0x00, MRM1r, (outs GR32:$dst), (ins), |
| 257 |
"str{l}\t$dst", []>, TB, OpSize32; |
| 258 |
def STR64r : RI<0x00, MRM1r, (outs GR64:$dst), (ins), |
| 259 |
"str{q}\t$dst", []>, TB; |
| 260 |
let mayStore = 1 in |
| 261 |
def STRm : I<0x00, MRM1m, (outs), (ins i16mem:$dst), "str{w}\t$dst", []>, TB; |
| 262 |
|
| 263 |
def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src), "ltr{w}\t$src", []>, TB, NotMemoryFoldable; |
| 264 |
let mayLoad = 1 in |
| 265 |
def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src), "ltr{w}\t$src", []>, TB, NotMemoryFoldable; |
| 266 |
|
| 267 |
def PUSHCS16 : I<0x0E, RawFrm, (outs), (ins), "push{w}\t{%cs|cs}", []>, |
| 268 |
OpSize16, Requires<[Not64BitMode]>; |
| 269 |
def PUSHCS32 : I<0x0E, RawFrm, (outs), (ins), "push{l}\t{%cs|cs}", []>, |
| 270 |
OpSize32, Requires<[Not64BitMode]>; |
| 271 |
def PUSHSS16 : I<0x16, RawFrm, (outs), (ins), "push{w}\t{%ss|ss}", []>, |
| 272 |
OpSize16, Requires<[Not64BitMode]>; |
| 273 |
def PUSHSS32 : I<0x16, RawFrm, (outs), (ins), "push{l}\t{%ss|ss}", []>, |
| 274 |
OpSize32, Requires<[Not64BitMode]>; |
| 275 |
def PUSHDS16 : I<0x1E, RawFrm, (outs), (ins), "push{w}\t{%ds|ds}", []>, |
| 276 |
OpSize16, Requires<[Not64BitMode]>; |
| 277 |
def PUSHDS32 : I<0x1E, RawFrm, (outs), (ins), "push{l}\t{%ds|ds}", []>, |
| 278 |
OpSize32, Requires<[Not64BitMode]>; |
| 279 |
def PUSHES16 : I<0x06, RawFrm, (outs), (ins), "push{w}\t{%es|es}", []>, |
| 280 |
OpSize16, Requires<[Not64BitMode]>; |
| 281 |
def PUSHES32 : I<0x06, RawFrm, (outs), (ins), "push{l}\t{%es|es}", []>, |
| 282 |
OpSize32, Requires<[Not64BitMode]>; |
| 283 |
def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins), "push{w}\t{%fs|fs}", []>, |
| 284 |
OpSize16, TB; |
| 285 |
def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins), "push{l}\t{%fs|fs}", []>, TB, |
| 286 |
OpSize32, Requires<[Not64BitMode]>; |
| 287 |
def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins), "push{w}\t{%gs|gs}", []>, |
| 288 |
OpSize16, TB; |
| 289 |
def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins), "push{l}\t{%gs|gs}", []>, TB, |
| 290 |
OpSize32, Requires<[Not64BitMode]>; |
| 291 |
def PUSHFS64 : I<0xa0, RawFrm, (outs), (ins), "push{q}\t{%fs|fs}", []>, TB, |
| 292 |
OpSize32, Requires<[In64BitMode]>; |
| 293 |
def PUSHGS64 : I<0xa8, RawFrm, (outs), (ins), "push{q}\t{%gs|gs}", []>, TB, |
| 294 |
OpSize32, Requires<[In64BitMode]>; |
| 295 |
|
| 296 |
// No "pop cs" instruction. |
| 297 |
def POPSS16 : I<0x17, RawFrm, (outs), (ins), "pop{w}\t{%ss|ss}", []>, |
| 298 |
OpSize16, Requires<[Not64BitMode]>; |
| 299 |
def POPSS32 : I<0x17, RawFrm, (outs), (ins), "pop{l}\t{%ss|ss}", []>, |
| 300 |
OpSize32, Requires<[Not64BitMode]>; |
| 301 |
|
| 302 |
def POPDS16 : I<0x1F, RawFrm, (outs), (ins), "pop{w}\t{%ds|ds}", []>, |
| 303 |
OpSize16, Requires<[Not64BitMode]>; |
| 304 |
def POPDS32 : I<0x1F, RawFrm, (outs), (ins), "pop{l}\t{%ds|ds}", []>, |
| 305 |
OpSize32, Requires<[Not64BitMode]>; |
| 306 |
|
| 307 |
def POPES16 : I<0x07, RawFrm, (outs), (ins), "pop{w}\t{%es|es}", []>, |
| 308 |
OpSize16, Requires<[Not64BitMode]>; |
| 309 |
def POPES32 : I<0x07, RawFrm, (outs), (ins), "pop{l}\t{%es|es}", []>, |
| 310 |
OpSize32, Requires<[Not64BitMode]>; |
| 311 |
|
| 312 |
def POPFS16 : I<0xa1, RawFrm, (outs), (ins), "pop{w}\t{%fs|fs}", []>, |
| 313 |
OpSize16, TB; |
| 314 |
def POPFS32 : I<0xa1, RawFrm, (outs), (ins), "pop{l}\t{%fs|fs}", []>, TB, |
| 315 |
OpSize32, Requires<[Not64BitMode]>; |
| 316 |
def POPFS64 : I<0xa1, RawFrm, (outs), (ins), "pop{q}\t{%fs|fs}", []>, TB, |
| 317 |
OpSize32, Requires<[In64BitMode]>; |
| 318 |
|
| 319 |
def POPGS16 : I<0xa9, RawFrm, (outs), (ins), "pop{w}\t{%gs|gs}", []>, |
| 320 |
OpSize16, TB; |
| 321 |
def POPGS32 : I<0xa9, RawFrm, (outs), (ins), "pop{l}\t{%gs|gs}", []>, TB, |
| 322 |
OpSize32, Requires<[Not64BitMode]>; |
| 323 |
def POPGS64 : I<0xa9, RawFrm, (outs), (ins), "pop{q}\t{%gs|gs}", []>, TB, |
| 324 |
OpSize32, Requires<[In64BitMode]>; |
| 325 |
|
| 326 |
def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaquemem:$src), |
| 327 |
"lds{w}\t{$src, $dst|$dst, $src}", []>, OpSize16, |
| 328 |
Requires<[Not64BitMode]>; |
| 329 |
def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaquemem:$src), |
| 330 |
"lds{l}\t{$src, $dst|$dst, $src}", []>, OpSize32, |
| 331 |
Requires<[Not64BitMode]>; |
| 332 |
|
| 333 |
def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaquemem:$src), |
| 334 |
"lss{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize16; |
| 335 |
def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaquemem:$src), |
| 336 |
"lss{l}\t{$src, $dst|$dst, $src}", []>, TB, OpSize32; |
| 337 |
def LSS64rm : RI<0xb2, MRMSrcMem, (outs GR64:$dst), (ins opaquemem:$src), |
| 338 |
"lss{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 339 |
|
| 340 |
def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaquemem:$src), |
| 341 |
"les{w}\t{$src, $dst|$dst, $src}", []>, OpSize16, |
| 342 |
Requires<[Not64BitMode]>; |
| 343 |
def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaquemem:$src), |
| 344 |
"les{l}\t{$src, $dst|$dst, $src}", []>, OpSize32, |
| 345 |
Requires<[Not64BitMode]>; |
| 346 |
|
| 347 |
def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaquemem:$src), |
| 348 |
"lfs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize16; |
| 349 |
def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaquemem:$src), |
| 350 |
"lfs{l}\t{$src, $dst|$dst, $src}", []>, TB, OpSize32; |
| 351 |
def LFS64rm : RI<0xb4, MRMSrcMem, (outs GR64:$dst), (ins opaquemem:$src), |
| 352 |
"lfs{q}\t{$src, $dst|$dst, $src}", []>, TB; |
| 353 |
|
| 354 |
def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaquemem:$src), |
| 355 |
"lgs{w}\t{$src, $dst|$dst, $src}", []>, TB, OpSize16; |
| 356 |
def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaquemem:$src), |
| 357 |
"lgs{l}\t{$src, $dst|$dst, $src}", []>, TB, OpSize32; |
| 358 |
|
| 359 |
def LGS64rm : RI<0xb5, MRMSrcMem, (outs GR64:$dst), (ins opaquemem:$src), |
| 360 |
"lgs\t{$src, $dst|$dst, $src}", []>, TB; |
| 361 |
|
| 362 |
def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg), "verr\t$seg", []>, TB, NotMemoryFoldable; |
| 363 |
def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg), "verw\t$seg", []>, TB, NotMemoryFoldable; |
| 364 |
let mayLoad = 1 in { |
| 365 |
def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg), "verr\t$seg", []>, TB, NotMemoryFoldable; |
| 366 |
def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg), "verw\t$seg", []>, TB, NotMemoryFoldable; |
| 367 |
} |
| 368 |
} // SchedRW |
| 369 |
|
| 370 |
//===----------------------------------------------------------------------===// |
| 371 |
// Descriptor-table support instructions |
| 372 |
|
| 373 |
let SchedRW = [WriteSystem] in { |
| 374 |
def SGDT16m : I<0x01, MRM0m, (outs), (ins opaquemem:$dst), |
| 375 |
"sgdt{w}\t$dst", []>, TB, OpSize16, Requires<[Not64BitMode]>; |
| 376 |
def SGDT32m : I<0x01, MRM0m, (outs), (ins opaquemem:$dst), |
| 377 |
"sgdt{l}\t$dst", []>, OpSize32, TB, Requires <[Not64BitMode]>; |
| 378 |
def SGDT64m : I<0x01, MRM0m, (outs), (ins opaquemem:$dst), |
| 379 |
"sgdt{q}\t$dst", []>, TB, Requires <[In64BitMode]>; |
| 380 |
def SIDT16m : I<0x01, MRM1m, (outs), (ins opaquemem:$dst), |
| 381 |
"sidt{w}\t$dst", []>, TB, OpSize16, Requires<[Not64BitMode]>; |
| 382 |
def SIDT32m : I<0x01, MRM1m, (outs), (ins opaquemem:$dst), |
| 383 |
"sidt{l}\t$dst", []>, OpSize32, TB, Requires <[Not64BitMode]>; |
| 384 |
def SIDT64m : I<0x01, MRM1m, (outs), (ins opaquemem:$dst), |
| 385 |
"sidt{q}\t$dst", []>, TB, Requires <[In64BitMode]>; |
| 386 |
def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins), |
| 387 |
"sldt{w}\t$dst", []>, TB, OpSize16; |
| 388 |
let mayStore = 1 in |
| 389 |
def SLDT16m : I<0x00, MRM0m, (outs), (ins i16mem:$dst), |
| 390 |
"sldt{w}\t$dst", []>, TB; |
| 391 |
def SLDT32r : I<0x00, MRM0r, (outs GR32:$dst), (ins), |
| 392 |
"sldt{l}\t$dst", []>, OpSize32, TB; |
| 393 |
|
| 394 |
// LLDT is not interpreted specially in 64-bit mode because there is no sign |
| 395 |
// extension. |
| 396 |
def SLDT64r : RI<0x00, MRM0r, (outs GR64:$dst), (ins), |
| 397 |
"sldt{q}\t$dst", []>, TB, Requires<[In64BitMode]>; |
| 398 |
|
| 399 |
def LGDT16m : I<0x01, MRM2m, (outs), (ins opaquemem:$src), |
| 400 |
"lgdt{w}\t$src", []>, TB, OpSize16, Requires<[Not64BitMode]>; |
| 401 |
def LGDT32m : I<0x01, MRM2m, (outs), (ins opaquemem:$src), |
| 402 |
"lgdt{l}\t$src", []>, OpSize32, TB, Requires<[Not64BitMode]>; |
| 403 |
def LGDT64m : I<0x01, MRM2m, (outs), (ins opaquemem:$src), |
| 404 |
"lgdt{q}\t$src", []>, TB, Requires<[In64BitMode]>; |
| 405 |
def LIDT16m : I<0x01, MRM3m, (outs), (ins opaquemem:$src), |
| 406 |
"lidt{w}\t$src", []>, TB, OpSize16, Requires<[Not64BitMode]>; |
| 407 |
def LIDT32m : I<0x01, MRM3m, (outs), (ins opaquemem:$src), |
| 408 |
"lidt{l}\t$src", []>, OpSize32, TB, Requires<[Not64BitMode]>; |
| 409 |
def LIDT64m : I<0x01, MRM3m, (outs), (ins opaquemem:$src), |
| 410 |
"lidt{q}\t$src", []>, TB, Requires<[In64BitMode]>; |
| 411 |
def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src), |
| 412 |
"lldt{w}\t$src", []>, TB, NotMemoryFoldable; |
| 413 |
let mayLoad = 1 in |
| 414 |
def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src), |
| 415 |
"lldt{w}\t$src", []>, TB, NotMemoryFoldable; |
| 416 |
} // SchedRW |
| 417 |
|
| 418 |
//===----------------------------------------------------------------------===// |
| 419 |
// Specialized register support |
| 420 |
let SchedRW = [WriteSystem] in { |
| 421 |
let Uses = [EAX, ECX, EDX] in |
| 422 |
def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", []>, TB; |
| 423 |
let Defs = [EAX, EDX], Uses = [ECX] in |
| 424 |
def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", []>, TB; |
| 425 |
|
| 426 |
let Defs = [RAX, RDX], Uses = [ECX] in |
| 427 |
def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", [(X86rdpmc)]>, TB; |
| 428 |
|
| 429 |
def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins), |
| 430 |
"smsw{w}\t$dst", []>, OpSize16, TB; |
| 431 |
def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins), |
| 432 |
"smsw{l}\t$dst", []>, OpSize32, TB; |
| 433 |
// no m form encodable; use SMSW16m |
| 434 |
def SMSW64r : RI<0x01, MRM4r, (outs GR64:$dst), (ins), |
| 435 |
"smsw{q}\t$dst", []>, TB; |
| 436 |
|
| 437 |
// For memory operands, there is only a 16-bit form |
| 438 |
def SMSW16m : I<0x01, MRM4m, (outs), (ins i16mem:$dst), |
| 439 |
"smsw{w}\t$dst", []>, TB; |
| 440 |
|
| 441 |
def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src), |
| 442 |
"lmsw{w}\t$src", []>, TB, NotMemoryFoldable; |
| 443 |
let mayLoad = 1 in |
| 444 |
def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src), |
| 445 |
"lmsw{w}\t$src", []>, TB, NotMemoryFoldable; |
| 446 |
|
| 447 |
let Defs = [EAX, EBX, ECX, EDX], Uses = [EAX, ECX] in |
| 448 |
def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", []>, TB; |
| 449 |
} // SchedRW |
| 450 |
|
| 451 |
//===----------------------------------------------------------------------===// |
| 452 |
// Cache instructions |
| 453 |
let SchedRW = [WriteSystem] in { |
| 454 |
def INVD : I<0x08, RawFrm, (outs), (ins), "invd", []>, TB; |
| 455 |
def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [(int_x86_wbinvd)]>, TB; |
| 456 |
|
| 457 |
// wbnoinvd is like wbinvd, except without invalidation |
| 458 |
// encoding: like wbinvd + an 0xF3 prefix |
| 459 |
def WBNOINVD : I<0x09, RawFrm, (outs), (ins), "wbnoinvd", |
| 460 |
[(int_x86_wbnoinvd)]>, XS, |
| 461 |
Requires<[HasWBNOINVD]>; |
| 462 |
} // SchedRW |
| 463 |
|
| 464 |
//===----------------------------------------------------------------------===// |
| 465 |
// CET instructions |
| 466 |
// Use with caution, availability is not predicated on features. |
| 467 |
let SchedRW = [WriteSystem] in { |
| 468 |
let Uses = [SSP] in { |
| 469 |
let Defs = [SSP] in { |
| 470 |
def INCSSPD : I<0xAE, MRM5r, (outs), (ins GR32:$src), "incsspd\t$src", |
| 471 |
[(int_x86_incsspd GR32:$src)]>, XS; |
| 472 |
def INCSSPQ : RI<0xAE, MRM5r, (outs), (ins GR64:$src), "incsspq\t$src", |
| 473 |
[(int_x86_incsspq GR64:$src)]>, XS; |
| 474 |
} // Defs SSP |
| 475 |
|
| 476 |
let Constraints = "$src = $dst" in { |
| 477 |
def RDSSPD : I<0x1E, MRM1r, (outs GR32:$dst), (ins GR32:$src), |
| 478 |
"rdsspd\t$dst", |
| 479 |
[(set GR32:$dst, (int_x86_rdsspd GR32:$src))]>, XS; |
| 480 |
def RDSSPQ : RI<0x1E, MRM1r, (outs GR64:$dst), (ins GR64:$src), |
| 481 |
"rdsspq\t$dst", |
| 482 |
[(set GR64:$dst, (int_x86_rdsspq GR64:$src))]>, XS; |
| 483 |
} |
| 484 |
|
| 485 |
let Defs = [SSP] in { |
| 486 |
def SAVEPREVSSP : I<0x01, MRM_EA, (outs), (ins), "saveprevssp", |
| 487 |
[(int_x86_saveprevssp)]>, XS; |
| 488 |
def RSTORSSP : I<0x01, MRM5m, (outs), (ins i32mem:$src), |
| 489 |
"rstorssp\t$src", |
| 490 |
[(int_x86_rstorssp addr:$src)]>, XS; |
| 491 |
} // Defs SSP |
| 492 |
} // Uses SSP |
| 493 |
|
| 494 |
def WRSSD : I<0xF6, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
| 495 |
"wrssd\t{$src, $dst|$dst, $src}", |
| 496 |
[(int_x86_wrssd GR32:$src, addr:$dst)]>, T8PS; |
| 497 |
def WRSSQ : RI<0xF6, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src), |
| 498 |
"wrssq\t{$src, $dst|$dst, $src}", |
| 499 |
[(int_x86_wrssq GR64:$src, addr:$dst)]>, T8PS; |
| 500 |
def WRUSSD : I<0xF5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
| 501 |
"wrussd\t{$src, $dst|$dst, $src}", |
| 502 |
[(int_x86_wrussd GR32:$src, addr:$dst)]>, T8PD; |
| 503 |
def WRUSSQ : RI<0xF5, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src), |
| 504 |
"wrussq\t{$src, $dst|$dst, $src}", |
| 505 |
[(int_x86_wrussq GR64:$src, addr:$dst)]>, T8PD; |
| 506 |
|
| 507 |
let Defs = [SSP] in { |
| 508 |
let Uses = [SSP] in { |
| 509 |
def SETSSBSY : I<0x01, MRM_E8, (outs), (ins), "setssbsy", |
| 510 |
[(int_x86_setssbsy)]>, XS; |
| 511 |
} // Uses SSP |
| 512 |
|
| 513 |
def CLRSSBSY : I<0xAE, MRM6m, (outs), (ins i32mem:$src), |
| 514 |
"clrssbsy\t$src", |
| 515 |
[(int_x86_clrssbsy addr:$src)]>, XS; |
| 516 |
} // Defs SSP |
| 517 |
} // SchedRW |
| 518 |
|
| 519 |
let SchedRW = [WriteSystem] in { |
| 520 |
def ENDBR64 : I<0x1E, MRM_FA, (outs), (ins), "endbr64", []>, XS; |
| 521 |
def ENDBR32 : I<0x1E, MRM_FB, (outs), (ins), "endbr32", []>, XS; |
| 522 |
} // SchedRW |
| 523 |
|
| 524 |
//===----------------------------------------------------------------------===// |
| 525 |
// XSAVE instructions |
| 526 |
let SchedRW = [WriteSystem] in { |
| 527 |
let Predicates = [HasXSAVE] in { |
| 528 |
let Defs = [EDX, EAX], Uses = [ECX] in |
| 529 |
def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB; |
| 530 |
|
| 531 |
let Uses = [EDX, EAX, ECX] in |
| 532 |
def XSETBV : I<0x01, MRM_D1, (outs), (ins), |
| 533 |
"xsetbv", |
| 534 |
[(int_x86_xsetbv ECX, EDX, EAX)]>, TB; |
| 535 |
|
| 536 |
} // HasXSAVE |
| 537 |
|
| 538 |
let Uses = [EDX, EAX] in { |
| 539 |
def XSAVE : I<0xAE, MRM4m, (outs), (ins opaquemem:$dst), |
| 540 |
"xsave\t$dst", |
| 541 |
[(int_x86_xsave addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE]>; |
| 542 |
def XSAVE64 : RI<0xAE, MRM4m, (outs), (ins opaquemem:$dst), |
| 543 |
"xsave64\t$dst", |
| 544 |
[(int_x86_xsave64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE, In64BitMode]>; |
| 545 |
def XRSTOR : I<0xAE, MRM5m, (outs), (ins opaquemem:$dst), |
| 546 |
"xrstor\t$dst", |
| 547 |
[(int_x86_xrstor addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE]>; |
| 548 |
def XRSTOR64 : RI<0xAE, MRM5m, (outs), (ins opaquemem:$dst), |
| 549 |
"xrstor64\t$dst", |
| 550 |
[(int_x86_xrstor64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVE, In64BitMode]>; |
| 551 |
def XSAVEOPT : I<0xAE, MRM6m, (outs), (ins opaquemem:$dst), |
| 552 |
"xsaveopt\t$dst", |
| 553 |
[(int_x86_xsaveopt addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVEOPT]>; |
| 554 |
def XSAVEOPT64 : RI<0xAE, MRM6m, (outs), (ins opaquemem:$dst), |
| 555 |
"xsaveopt64\t$dst", |
| 556 |
[(int_x86_xsaveopt64 addr:$dst, EDX, EAX)]>, PS, Requires<[HasXSAVEOPT, In64BitMode]>; |
| 557 |
def XSAVEC : I<0xC7, MRM4m, (outs), (ins opaquemem:$dst), |
| 558 |
"xsavec\t$dst", |
| 559 |
[(int_x86_xsavec addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVEC]>; |
| 560 |
def XSAVEC64 : RI<0xC7, MRM4m, (outs), (ins opaquemem:$dst), |
| 561 |
"xsavec64\t$dst", |
| 562 |
[(int_x86_xsavec64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVEC, In64BitMode]>; |
| 563 |
def XSAVES : I<0xC7, MRM5m, (outs), (ins opaquemem:$dst), |
| 564 |
"xsaves\t$dst", |
| 565 |
[(int_x86_xsaves addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVES]>; |
| 566 |
def XSAVES64 : RI<0xC7, MRM5m, (outs), (ins opaquemem:$dst), |
| 567 |
"xsaves64\t$dst", |
| 568 |
[(int_x86_xsaves64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVE, In64BitMode]>; |
| 569 |
def XRSTORS : I<0xC7, MRM3m, (outs), (ins opaquemem:$dst), |
| 570 |
"xrstors\t$dst", |
| 571 |
[(int_x86_xrstors addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVES]>; |
| 572 |
def XRSTORS64 : RI<0xC7, MRM3m, (outs), (ins opaquemem:$dst), |
| 573 |
"xrstors64\t$dst", |
| 574 |
[(int_x86_xrstors64 addr:$dst, EDX, EAX)]>, TB, Requires<[HasXSAVES, In64BitMode]>; |
| 575 |
} // Uses |
| 576 |
} // SchedRW |
| 577 |
|
| 578 |
//===----------------------------------------------------------------------===// |
| 579 |
// VIA PadLock crypto instructions |
| 580 |
let Defs = [RAX, RDI], Uses = [RDX, RDI], SchedRW = [WriteSystem] in |
| 581 |
def XSTORE : I<0xa7, MRM_C0, (outs), (ins), "xstore", []>, TB; |
| 582 |
|
| 583 |
// def : InstAlias<"xstorerng", (XSTORE)>; |
| 584 |
|
| 585 |
let SchedRW = [WriteSystem] in { |
| 586 |
let Defs = [RSI, RDI], Uses = [RBX, RDX, RSI, RDI] in { |
| 587 |
def XCRYPTECB : I<0xa7, MRM_C8, (outs), (ins), "xcryptecb", []>, TB; |
| 588 |
def XCRYPTCBC : I<0xa7, MRM_D0, (outs), (ins), "xcryptcbc", []>, TB; |
| 589 |
def XCRYPTCTR : I<0xa7, MRM_D8, (outs), (ins), "xcryptctr", []>, TB; |
| 590 |
def XCRYPTCFB : I<0xa7, MRM_E0, (outs), (ins), "xcryptcfb", []>, TB; |
| 591 |
def XCRYPTOFB : I<0xa7, MRM_E8, (outs), (ins), "xcryptofb", []>, TB; |
| 592 |
} |
| 593 |
|
| 594 |
let Defs = [RAX, RSI, RDI], Uses = [RAX, RSI, RDI] in { |
| 595 |
def XSHA1 : I<0xa6, MRM_C8, (outs), (ins), "xsha1", []>, TB; |
| 596 |
def XSHA256 : I<0xa6, MRM_D0, (outs), (ins), "xsha256", []>, TB; |
| 597 |
} |
| 598 |
let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in |
| 599 |
def MONTMUL : I<0xa6, MRM_C0, (outs), (ins), "montmul", []>, TB; |
| 600 |
} // SchedRW |
| 601 |
|
| 602 |
/* |
| 603 |
//==-----------------------------------------------------------------------===// |
| 604 |
// PKU - enable protection key |
| 605 |
let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in { |
| 606 |
def WRPKRU : PseudoI<(outs), (ins GR32:$src), |
| 607 |
[(int_x86_wrpkru GR32:$src)]>; |
| 608 |
def RDPKRU : PseudoI<(outs GR32:$dst), (ins), |
| 609 |
[(set GR32:$dst, (int_x86_rdpkru))]>; |
| 610 |
} |
| 611 |
*/ |
| 612 |
|
| 613 |
let SchedRW = [WriteSystem] in { |
| 614 |
let Defs = [EAX, EDX], Uses = [ECX] in |
| 615 |
def RDPKRUr : I<0x01, MRM_EE, (outs), (ins), "rdpkru", []>, TB; |
| 616 |
let Uses = [EAX, ECX, EDX] in |
| 617 |
def WRPKRUr : I<0x01, MRM_EF, (outs), (ins), "wrpkru", []>, TB; |
| 618 |
} // SchedRW |
| 619 |
|
| 620 |
//===----------------------------------------------------------------------===// |
| 621 |
// FS/GS Base Instructions |
| 622 |
let Predicates = [HasFSGSBase, In64BitMode], SchedRW = [WriteSystem] in { |
| 623 |
def RDFSBASE : I<0xAE, MRM0r, (outs GR32:$dst), (ins), |
| 624 |
"rdfsbase{l}\t$dst", |
| 625 |
[(set GR32:$dst, (int_x86_rdfsbase_32))]>, XS; |
| 626 |
def RDFSBASE64 : RI<0xAE, MRM0r, (outs GR64:$dst), (ins), |
| 627 |
"rdfsbase{q}\t$dst", |
| 628 |
[(set GR64:$dst, (int_x86_rdfsbase_64))]>, XS; |
| 629 |
def RDGSBASE : I<0xAE, MRM1r, (outs GR32:$dst), (ins), |
| 630 |
"rdgsbase{l}\t$dst", |
| 631 |
[(set GR32:$dst, (int_x86_rdgsbase_32))]>, XS; |
| 632 |
def RDGSBASE64 : RI<0xAE, MRM1r, (outs GR64:$dst), (ins), |
| 633 |
"rdgsbase{q}\t$dst", |
| 634 |
[(set GR64:$dst, (int_x86_rdgsbase_64))]>, XS; |
| 635 |
def WRFSBASE : I<0xAE, MRM2r, (outs), (ins GR32:$src), |
| 636 |
"wrfsbase{l}\t$src", |
| 637 |
[(int_x86_wrfsbase_32 GR32:$src)]>, XS; |
| 638 |
def WRFSBASE64 : RI<0xAE, MRM2r, (outs), (ins GR64:$src), |
| 639 |
"wrfsbase{q}\t$src", |
| 640 |
[(int_x86_wrfsbase_64 GR64:$src)]>, XS; |
| 641 |
def WRGSBASE : I<0xAE, MRM3r, (outs), (ins GR32:$src), |
| 642 |
"wrgsbase{l}\t$src", |
| 643 |
[(int_x86_wrgsbase_32 GR32:$src)]>, XS; |
| 644 |
def WRGSBASE64 : RI<0xAE, MRM3r, (outs), (ins GR64:$src), |
| 645 |
"wrgsbase{q}\t$src", |
| 646 |
[(int_x86_wrgsbase_64 GR64:$src)]>, XS; |
| 647 |
} |
| 648 |
|
| 649 |
//===----------------------------------------------------------------------===// |
| 650 |
// INVPCID Instruction |
| 651 |
let SchedRW = [WriteSystem] in { |
| 652 |
def INVPCID32 : I<0x82, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2), |
| 653 |
"invpcid\t{$src2, $src1|$src1, $src2}", |
| 654 |
[(int_x86_invpcid GR32:$src1, addr:$src2)]>, T8PD, |
| 655 |
Requires<[Not64BitMode, HasINVPCID]>; |
| 656 |
def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2), |
| 657 |
"invpcid\t{$src2, $src1|$src1, $src2}", []>, T8PD, |
| 658 |
Requires<[In64BitMode, HasINVPCID]>; |
| 659 |
} // SchedRW |
| 660 |
|
| 661 |
let Predicates = [In64BitMode, HasINVPCID] in { |
| 662 |
// The instruction can only use a 64 bit register as the register argument |
| 663 |
// in 64 bit mode, while the intrinsic only accepts a 32 bit argument |
| 664 |
// corresponding to it. |
| 665 |
// The accepted values for now are 0,1,2,3 anyways (see Intel SDM -- INVCPID |
| 666 |
// type),/ so it doesn't hurt us that one can't supply a 64 bit value here. |
| 667 |
def : Pat<(int_x86_invpcid GR32:$src1, addr:$src2), |
| 668 |
(INVPCID64 |
| 669 |
(SUBREG_TO_REG (i64 0), (MOV32rr GR32:$src1), sub_32bit), |
| 670 |
addr:$src2)>; |
| 671 |
} |
| 672 |
|
| 673 |
|
| 674 |
//===----------------------------------------------------------------------===// |
| 675 |
// SMAP Instruction |
| 676 |
let Defs = [EFLAGS], SchedRW = [WriteSystem] in { |
| 677 |
def CLAC : I<0x01, MRM_CA, (outs), (ins), "clac", []>, TB; |
| 678 |
def STAC : I<0x01, MRM_CB, (outs), (ins), "stac", []>, TB; |
| 679 |
} |
| 680 |
|
| 681 |
//===----------------------------------------------------------------------===// |
| 682 |
// SMX Instruction |
| 683 |
let SchedRW = [WriteSystem] in { |
| 684 |
let Uses = [RAX, RBX, RCX, RDX], Defs = [RAX, RBX, RCX] in { |
| 685 |
def GETSEC : I<0x37, RawFrm, (outs), (ins), "getsec", []>, TB; |
| 686 |
} // Uses, Defs |
| 687 |
} // SchedRW |
| 688 |
|
| 689 |
//===----------------------------------------------------------------------===// |
| 690 |
// TS flag control instruction. |
| 691 |
let SchedRW = [WriteSystem] in { |
| 692 |
def CLTS : I<0x06, RawFrm, (outs), (ins), "clts", []>, TB; |
| 693 |
} |
| 694 |
|
| 695 |
//===----------------------------------------------------------------------===// |
| 696 |
// IF (inside EFLAGS) management instructions. |
| 697 |
let SchedRW = [WriteSystem], Uses = [EFLAGS], Defs = [EFLAGS] in { |
| 698 |
def CLI : I<0xFA, RawFrm, (outs), (ins), "cli", []>; |
| 699 |
def STI : I<0xFB, RawFrm, (outs), (ins), "sti", []>; |
| 700 |
} |
| 701 |
|
| 702 |
//===----------------------------------------------------------------------===// |
| 703 |
// RDPID Instruction |
| 704 |
let SchedRW = [WriteSystem] in { |
| 705 |
def RDPID32 : I<0xC7, MRM7r, (outs GR32:$dst), (ins), |
| 706 |
"rdpid\t$dst", [(set GR32:$dst, (int_x86_rdpid))]>, XS, |
| 707 |
Requires<[Not64BitMode, HasRDPID]>; |
| 708 |
def RDPID64 : I<0xC7, MRM7r, (outs GR64:$dst), (ins), "rdpid\t$dst", []>, XS, |
| 709 |
Requires<[In64BitMode, HasRDPID]>; |
| 710 |
} // SchedRW |
| 711 |
|
| 712 |
let Predicates = [In64BitMode, HasRDPID] in { |
| 713 |
// Due to silly instruction definition, we have to compensate for the |
| 714 |
// instruction outputing a 64-bit register. |
| 715 |
def : Pat<(int_x86_rdpid), |
| 716 |
(EXTRACT_SUBREG (RDPID64), sub_32bit)>; |
| 717 |
} |
| 718 |
|
| 719 |
|
| 720 |
//===----------------------------------------------------------------------===// |
| 721 |
// PTWRITE Instruction - Write Data to a Processor Trace Packet |
| 722 |
let SchedRW = [WriteSystem] in { |
| 723 |
def PTWRITEm: I<0xAE, MRM4m, (outs), (ins i32mem:$dst), |
| 724 |
"ptwrite{l}\t$dst", [(int_x86_ptwrite32 (loadi32 addr:$dst))]>, XS, |
| 725 |
Requires<[HasPTWRITE]>; |
| 726 |
def PTWRITE64m : RI<0xAE, MRM4m, (outs), (ins i64mem:$dst), |
| 727 |
"ptwrite{q}\t$dst", [(int_x86_ptwrite64 (loadi64 addr:$dst))]>, XS, |
| 728 |
Requires<[In64BitMode, HasPTWRITE]>; |
| 729 |
|
| 730 |
def PTWRITEr : I<0xAE, MRM4r, (outs), (ins GR32:$dst), |
| 731 |
"ptwrite{l}\t$dst", [(int_x86_ptwrite32 GR32:$dst)]>, XS, |
| 732 |
Requires<[HasPTWRITE]>; |
| 733 |
def PTWRITE64r : RI<0xAE, MRM4r, (outs), (ins GR64:$dst), |
| 734 |
"ptwrite{q}\t$dst", [(int_x86_ptwrite64 GR64:$dst)]>, XS, |
| 735 |
Requires<[In64BitMode, HasPTWRITE]>; |
| 736 |
} // SchedRW |
| 737 |
|
| 738 |
//===----------------------------------------------------------------------===// |
| 739 |
// Platform Configuration instruction |
| 740 |
|
| 741 |
// From ISA docs: |
| 742 |
// "This instruction is used to execute functions for configuring platform |
| 743 |
// features. |
| 744 |
// EAX: Leaf function to be invoked. |
| 745 |
// RBX/RCX/RDX: Leaf-specific purpose." |
| 746 |
// "Successful execution of the leaf clears RAX (set to zero) and ZF, CF, PF, |
| 747 |
// AF, OF, and SF are cleared. In case of failure, the failure reason is |
| 748 |
// indicated in RAX with ZF set to 1 and CF, PF, AF, OF, and SF are cleared." |
| 749 |
// Thus all these mentioned registers are considered clobbered. |
| 750 |
|
| 751 |
let SchedRW = [WriteSystem] in { |
| 752 |
let Uses = [RAX, RBX, RCX, RDX], Defs = [RAX, RBX, RCX, RDX, EFLAGS] in |
| 753 |
def PCONFIG : I<0x01, MRM_C5, (outs), (ins), "pconfig", []>, TB, |
| 754 |
Requires<[HasPCONFIG]>; |
| 755 |
} // SchedRW |