Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- X86InstrSystem.td - System Instructions ------------*- tablegen -*-===// |
| 2 | // |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 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. |
Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 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 Defs = [RAX, RDX] in |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 17 | def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)], IIC_RDTSC>, |
| 18 | TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 19 | |
| 20 | let Defs = [RAX, RCX, RDX] in |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 21 | def RDTSCP : I<0x01, MRM_F9, (outs), (ins), "rdtscp", []>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 22 | |
| 23 | // CPU flow control instructions |
| 24 | |
Kevin Enderby | 529b1a4 | 2010-10-27 20:46:49 +0000 | [diff] [blame] | 25 | let isTerminator = 1, isBarrier = 1, hasCtrlDep = 1 in { |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 26 | def TRAP : I<0x0B, RawFrm, (outs), (ins), "ud2", [(trap)]>, TB; |
Kevin Enderby | 529b1a4 | 2010-10-27 20:46:49 +0000 | [diff] [blame] | 27 | def UD2B : I<0xB9, RawFrm, (outs), (ins), "ud2b", []>, TB; |
| 28 | } |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 29 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 30 | def HLT : I<0xF4, RawFrm, (outs), (ins), "hlt", [], IIC_HLT>; |
| 31 | def RSM : I<0xAA, RawFrm, (outs), (ins), "rsm", [], IIC_RSM>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 32 | |
| 33 | // Interrupt and SysCall Instructions. |
| 34 | let Uses = [EFLAGS] in |
| 35 | def INTO : I<0xce, RawFrm, (outs), (ins), "into", []>; |
| 36 | def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3", |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 37 | [(int_x86_int (i8 3))], IIC_INT3>; |
Chris Lattner | 15f8951 | 2011-04-09 19:41:05 +0000 | [diff] [blame] | 38 | |
Dan Gohman | a6063c6 | 2012-05-14 18:58:10 +0000 | [diff] [blame] | 39 | def : Pat<(debugtrap), |
Dan Gohman | d4347e1 | 2012-05-11 00:19:32 +0000 | [diff] [blame] | 40 | (INT3)>; |
| 41 | |
Chris Lattner | 15f8951 | 2011-04-09 19:41:05 +0000 | [diff] [blame] | 42 | // 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 Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 47 | def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap", |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 48 | [(int_x86_int imm:$trap)], IIC_INT>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 49 | |
Chris Lattner | 15f8951 | 2011-04-09 19:41:05 +0000 | [diff] [blame] | 50 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 51 | def SYSCALL : I<0x05, RawFrm, (outs), (ins), "syscall", [], IIC_SYSCALL>, TB; |
| 52 | def SYSRET : I<0x07, RawFrm, (outs), (ins), "sysret{l}", [], IIC_SYSCALL>, TB; |
| 53 | def SYSRET64 :RI<0x07, RawFrm, (outs), (ins), "sysret{q}", [], IIC_SYSCALL>, TB, |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 54 | Requires<[In64BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 55 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 56 | def SYSENTER : I<0x34, RawFrm, (outs), (ins), "sysenter", [], |
| 57 | IIC_SYS_ENTER_EXIT>, TB; |
| 58 | |
| 59 | def SYSEXIT : I<0x35, RawFrm, (outs), (ins), "sysexit{l}", [], |
| 60 | IIC_SYS_ENTER_EXIT>, TB; |
Bill Wendling | e060eb8 | 2012-03-10 07:37:27 +0000 | [diff] [blame] | 61 | def SYSEXIT64 :RI<0x35, RawFrm, (outs), (ins), "sysexit{q}", []>, TB, |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 62 | Requires<[In64BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 63 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 64 | def IRET16 : I<0xcf, RawFrm, (outs), (ins), "iret{w}", [], IIC_IRET>, OpSize; |
| 65 | def IRET32 : I<0xcf, RawFrm, (outs), (ins), "iret{l|d}", [], IIC_IRET>; |
| 66 | def IRET64 : RI<0xcf, RawFrm, (outs), (ins), "iretq", [], IIC_IRET>, |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 67 | Requires<[In64BitMode]>; |
| 68 | |
| 69 | |
| 70 | //===----------------------------------------------------------------------===// |
| 71 | // Input/Output Instructions. |
| 72 | // |
| 73 | let Defs = [AL], Uses = [DX] in |
| 74 | def IN8rr : I<0xEC, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 75 | "in{b}\t{%dx, %al|AL, DX}", [], IIC_IN_RR>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 76 | let Defs = [AX], Uses = [DX] in |
| 77 | def IN16rr : I<0xED, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 78 | "in{w}\t{%dx, %ax|AX, DX}", [], IIC_IN_RR>, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 79 | let Defs = [EAX], Uses = [DX] in |
| 80 | def IN32rr : I<0xED, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 81 | "in{l}\t{%dx, %eax|EAX, DX}", [], IIC_IN_RR>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 82 | |
| 83 | let Defs = [AL] in |
| 84 | def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i8imm:$port), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 85 | "in{b}\t{$port, %al|AL, $port}", [], IIC_IN_RI>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 86 | let Defs = [AX] in |
| 87 | def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 88 | "in{w}\t{$port, %ax|AX, $port}", [], IIC_IN_RI>, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 89 | let Defs = [EAX] in |
| 90 | def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i8imm:$port), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 91 | "in{l}\t{$port, %eax|EAX, $port}", [], IIC_IN_RI>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 92 | |
| 93 | let Uses = [DX, AL] in |
| 94 | def OUT8rr : I<0xEE, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 95 | "out{b}\t{%al, %dx|DX, AL}", [], IIC_OUT_RR>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 96 | let Uses = [DX, AX] in |
| 97 | def OUT16rr : I<0xEF, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 98 | "out{w}\t{%ax, %dx|DX, AX}", [], IIC_OUT_RR>, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 99 | let Uses = [DX, EAX] in |
| 100 | def OUT32rr : I<0xEF, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 101 | "out{l}\t{%eax, %dx|DX, EAX}", [], IIC_OUT_RR>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 102 | |
| 103 | let Uses = [AL] in |
| 104 | def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i8imm:$port), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 105 | "out{b}\t{%al, $port|$port, AL}", [], IIC_OUT_IR>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 106 | let Uses = [AX] in |
| 107 | def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 108 | "out{w}\t{%ax, $port|$port, AX}", [], IIC_OUT_IR>, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 109 | let Uses = [EAX] in |
| 110 | def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i8imm:$port), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 111 | "out{l}\t{%eax, $port|$port, EAX}", [], IIC_OUT_IR>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 112 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 113 | def IN8 : I<0x6C, RawFrm, (outs), (ins), "ins{b}", [], IIC_INS>; |
| 114 | def IN16 : I<0x6D, RawFrm, (outs), (ins), "ins{w}", [], IIC_INS>, OpSize; |
| 115 | def IN32 : I<0x6D, RawFrm, (outs), (ins), "ins{l}", [], IIC_INS>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 116 | |
| 117 | //===----------------------------------------------------------------------===// |
| 118 | // Moves to and from debug registers |
| 119 | |
| 120 | def MOV32rd : I<0x21, MRMDestReg, (outs GR32:$dst), (ins DEBUG_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 121 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_DR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 122 | def MOV64rd : I<0x21, MRMDestReg, (outs GR64:$dst), (ins DEBUG_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 123 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_DR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 124 | |
| 125 | def MOV32dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR32:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 126 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_DR_REG>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 127 | def MOV64dr : I<0x23, MRMSrcReg, (outs DEBUG_REG:$dst), (ins GR64:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 128 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_DR_REG>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 129 | |
| 130 | //===----------------------------------------------------------------------===// |
| 131 | // Moves to and from control registers |
| 132 | |
| 133 | def MOV32rc : I<0x20, MRMDestReg, (outs GR32:$dst), (ins CONTROL_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 134 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_CR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 135 | def MOV64rc : I<0x20, MRMDestReg, (outs GR64:$dst), (ins CONTROL_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 136 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_CR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 137 | |
| 138 | def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR32:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 139 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_CR_REG>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 140 | def MOV64cr : I<0x22, MRMSrcReg, (outs CONTROL_REG:$dst), (ins GR64:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 141 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_CR_REG>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 142 | |
| 143 | //===----------------------------------------------------------------------===// |
| 144 | // Segment override instruction prefixes |
| 145 | |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 146 | def CS_PREFIX : I<0x2E, RawFrm, (outs), (ins), "cs", []>; |
| 147 | def SS_PREFIX : I<0x36, RawFrm, (outs), (ins), "ss", []>; |
| 148 | def DS_PREFIX : I<0x3E, RawFrm, (outs), (ins), "ds", []>; |
| 149 | def ES_PREFIX : I<0x26, RawFrm, (outs), (ins), "es", []>; |
| 150 | def FS_PREFIX : I<0x64, RawFrm, (outs), (ins), "fs", []>; |
| 151 | def GS_PREFIX : I<0x65, RawFrm, (outs), (ins), "gs", []>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 152 | |
| 153 | |
| 154 | //===----------------------------------------------------------------------===// |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 155 | // Moves to and from segment registers. |
| 156 | // |
| 157 | |
| 158 | def MOV16rs : I<0x8C, MRMDestReg, (outs GR16:$dst), (ins SEGMENT_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 159 | "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>, OpSize; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 160 | def MOV32rs : I<0x8C, MRMDestReg, (outs GR32:$dst), (ins SEGMENT_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 161 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 162 | def MOV64rs : RI<0x8C, MRMDestReg, (outs GR64:$dst), (ins SEGMENT_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 163 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_REG_SR>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 164 | |
| 165 | def MOV16ms : I<0x8C, MRMDestMem, (outs i16mem:$dst), (ins SEGMENT_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 166 | "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>, OpSize; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 167 | def MOV32ms : I<0x8C, MRMDestMem, (outs i32mem:$dst), (ins SEGMENT_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 168 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 169 | def MOV64ms : RI<0x8C, MRMDestMem, (outs i64mem:$dst), (ins SEGMENT_REG:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 170 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_MEM_SR>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 171 | |
| 172 | def MOV16sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR16:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 173 | "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>, OpSize; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 174 | def MOV32sr : I<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR32:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 175 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 176 | def MOV64sr : RI<0x8E, MRMSrcReg, (outs SEGMENT_REG:$dst), (ins GR64:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 177 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_REG>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 178 | |
| 179 | def MOV16sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 180 | "mov{w}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>, OpSize; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 181 | def MOV32sm : I<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 182 | "mov{l}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 183 | def MOV64sm : RI<0x8E, MRMSrcMem, (outs SEGMENT_REG:$dst), (ins i64mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 184 | "mov{q}\t{$src, $dst|$dst, $src}", [], IIC_MOV_SR_MEM>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 185 | |
| 186 | //===----------------------------------------------------------------------===// |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 187 | // Segmentation support instructions. |
| 188 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 189 | def SWAPGS : I<0x01, MRM_F8, (outs), (ins), "swapgs", [], IIC_SWAPGS>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 190 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 191 | def LAR16rm : I<0x02, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 192 | "lar{w}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 193 | def LAR16rr : I<0x02, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 194 | "lar{w}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 195 | |
| 196 | // i16mem operand in LAR32rm and GR32 operand in LAR32rr is not a typo. |
| 197 | def LAR32rm : I<0x02, MRMSrcMem, (outs GR32:$dst), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 198 | "lar{l}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 199 | def LAR32rr : I<0x02, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 200 | "lar{l}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 201 | // i16mem operand in LAR64rm and GR32 operand in LAR32rr is not a typo. |
| 202 | def LAR64rm : RI<0x02, MRMSrcMem, (outs GR64:$dst), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 203 | "lar{q}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RM>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 204 | def LAR64rr : RI<0x02, MRMSrcReg, (outs GR64:$dst), (ins GR32:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 205 | "lar{q}\t{$src, $dst|$dst, $src}", [], IIC_LAR_RR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 206 | |
| 207 | def LSL16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 208 | "lsl{w}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 209 | def LSL16rr : I<0x03, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 210 | "lsl{w}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 211 | def LSL32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 212 | "lsl{l}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 213 | def LSL32rr : I<0x03, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 214 | "lsl{l}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 215 | def LSL64rm : RI<0x03, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 216 | "lsl{q}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RM>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 217 | def LSL64rr : RI<0x03, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 218 | "lsl{q}\t{$src, $dst|$dst, $src}", [], IIC_LSL_RR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 219 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 220 | def INVLPG : I<0x01, MRM7m, (outs), (ins i8mem:$addr), "invlpg\t$addr", |
| 221 | [], IIC_INVLPG>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 222 | |
Eli Friedman | ac39bd5 | 2011-03-04 00:10:17 +0000 | [diff] [blame] | 223 | def STR16r : I<0x00, MRM1r, (outs GR16:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 224 | "str{w}\t$dst", [], IIC_STR>, TB, OpSize; |
Eli Friedman | ac39bd5 | 2011-03-04 00:10:17 +0000 | [diff] [blame] | 225 | def STR32r : I<0x00, MRM1r, (outs GR32:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 226 | "str{l}\t$dst", [], IIC_STR>, TB; |
Eli Friedman | ac39bd5 | 2011-03-04 00:10:17 +0000 | [diff] [blame] | 227 | def STR64r : RI<0x00, MRM1r, (outs GR64:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 228 | "str{q}\t$dst", [], IIC_STR>, TB; |
Eli Friedman | ac39bd5 | 2011-03-04 00:10:17 +0000 | [diff] [blame] | 229 | def STRm : I<0x00, MRM1m, (outs i16mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 230 | "str{w}\t$dst", [], IIC_STR>, TB; |
Eli Friedman | ac39bd5 | 2011-03-04 00:10:17 +0000 | [diff] [blame] | 231 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 232 | def LTRr : I<0x00, MRM3r, (outs), (ins GR16:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 233 | "ltr{w}\t$src", [], IIC_LTR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 234 | def LTRm : I<0x00, MRM3m, (outs), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 235 | "ltr{w}\t$src", [], IIC_LTR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 236 | |
| 237 | def PUSHCS16 : I<0x0E, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 238 | "push{w}\t{%cs|CS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>, |
| 239 | OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 240 | def PUSHCS32 : I<0x0E, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 241 | "push{l}\t{%cs|CS}", [], IIC_PUSH_CS>, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 242 | def PUSHSS16 : I<0x16, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 243 | "push{w}\t{%ss|SS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>, |
| 244 | OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 245 | def PUSHSS32 : I<0x16, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 246 | "push{l}\t{%ss|SS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 247 | def PUSHDS16 : I<0x1E, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 248 | "push{w}\t{%ds|DS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>, |
| 249 | OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 250 | def PUSHDS32 : I<0x1E, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 251 | "push{l}\t{%ds|DS}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 252 | def PUSHES16 : I<0x06, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 253 | "push{w}\t{%es|ES}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>, |
| 254 | OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 255 | def PUSHES32 : I<0x06, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 256 | "push{l}\t{%es|ES}", [], IIC_PUSH_SR>, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 257 | |
| 258 | def PUSHFS16 : I<0xa0, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 259 | "push{w}\t{%fs|FS}", [], IIC_PUSH_SR>, OpSize, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 260 | def PUSHFS32 : I<0xa0, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 261 | "push{l}\t{%fs|FS}", [], IIC_PUSH_SR>, TB, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 262 | def PUSHGS16 : I<0xa8, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 263 | "push{w}\t{%gs|GS}", [], IIC_PUSH_SR>, OpSize, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 264 | def PUSHGS32 : I<0xa8, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 265 | "push{l}\t{%gs|GS}", [], IIC_PUSH_SR>, TB, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 266 | |
| 267 | def PUSHFS64 : I<0xa0, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 268 | "push{q}\t{%fs|FS}", [], IIC_PUSH_SR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 269 | def PUSHGS64 : I<0xa8, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 270 | "push{q}\t{%gs|GS}", [], IIC_PUSH_SR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 271 | |
| 272 | // No "pop cs" instruction. |
| 273 | def POPSS16 : I<0x17, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 274 | "pop{w}\t{%ss|SS}", [], IIC_POP_SR_SS>, |
| 275 | OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 276 | def POPSS32 : I<0x17, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 277 | "pop{l}\t{%ss|SS}", [], IIC_POP_SR_SS>, |
| 278 | Requires<[In32BitMode]>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 279 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 280 | def POPDS16 : I<0x1F, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 281 | "pop{w}\t{%ds|DS}", [], IIC_POP_SR>, |
| 282 | OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 283 | def POPDS32 : I<0x1F, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 284 | "pop{l}\t{%ds|DS}", [], IIC_POP_SR>, |
| 285 | Requires<[In32BitMode]>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 286 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 287 | def POPES16 : I<0x07, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 288 | "pop{w}\t{%es|ES}", [], IIC_POP_SR>, |
| 289 | OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 290 | def POPES32 : I<0x07, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 291 | "pop{l}\t{%es|ES}", [], IIC_POP_SR>, |
| 292 | Requires<[In32BitMode]>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 293 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 294 | def POPFS16 : I<0xa1, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 295 | "pop{w}\t{%fs|FS}", [], IIC_POP_SR>, OpSize, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 296 | def POPFS32 : I<0xa1, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 297 | "pop{l}\t{%fs|FS}", [], IIC_POP_SR>, TB, Requires<[In32BitMode]>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 298 | def POPFS64 : I<0xa1, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 299 | "pop{q}\t{%fs|FS}", [], IIC_POP_SR>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 300 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 301 | def POPGS16 : I<0xa9, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 302 | "pop{w}\t{%gs|GS}", [], IIC_POP_SR>, OpSize, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 303 | def POPGS32 : I<0xa9, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 304 | "pop{l}\t{%gs|GS}", [], IIC_POP_SR>, TB, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 305 | def POPGS64 : I<0xa9, RawFrm, (outs), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 306 | "pop{q}\t{%gs|GS}", [], IIC_POP_SR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 307 | |
| 308 | |
| 309 | def LDS16rm : I<0xc5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 310 | "lds{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 311 | def LDS32rm : I<0xc5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 312 | "lds{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 313 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 314 | def LSS16rm : I<0xb2, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 315 | "lss{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 316 | def LSS32rm : I<0xb2, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 317 | "lss{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 318 | def LSS64rm : RI<0xb2, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 319 | "lss{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 320 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 321 | def LES16rm : I<0xc4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 322 | "les{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 323 | def LES32rm : I<0xc4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 324 | "les{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 325 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 326 | def LFS16rm : I<0xb4, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 327 | "lfs{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 328 | def LFS32rm : I<0xb4, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 329 | "lfs{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 330 | def LFS64rm : RI<0xb4, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 331 | "lfs{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 332 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 333 | def LGS16rm : I<0xb5, MRMSrcMem, (outs GR16:$dst), (ins opaque32mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 334 | "lgs{w}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 335 | def LGS32rm : I<0xb5, MRMSrcMem, (outs GR32:$dst), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 336 | "lgs{l}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB; |
Chris Lattner | 87be16a | 2010-10-05 06:04:14 +0000 | [diff] [blame] | 337 | |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 338 | def LGS64rm : RI<0xb5, MRMSrcMem, (outs GR64:$dst), (ins opaque80mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 339 | "lgs{q}\t{$src, $dst|$dst, $src}", [], IIC_LXS>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 340 | |
| 341 | |
| 342 | def VERRr : I<0x00, MRM4r, (outs), (ins GR16:$seg), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 343 | "verr\t$seg", [], IIC_VERR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 344 | def VERRm : I<0x00, MRM4m, (outs), (ins i16mem:$seg), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 345 | "verr\t$seg", [], IIC_VERR>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 346 | def VERWr : I<0x00, MRM5r, (outs), (ins GR16:$seg), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 347 | "verw\t$seg", [], IIC_VERW_MEM>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 348 | def VERWm : I<0x00, MRM5m, (outs), (ins i16mem:$seg), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 349 | "verw\t$seg", [], IIC_VERW_REG>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 350 | |
| 351 | //===----------------------------------------------------------------------===// |
| 352 | // Descriptor-table support instructions |
| 353 | |
Kevin Enderby | 87f4a1a | 2010-10-19 00:01:44 +0000 | [diff] [blame] | 354 | def SGDT16m : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 355 | "sgdtw\t$dst", [], IIC_SGDT>, TB, OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 356 | def SGDTm : I<0x01, MRM0m, (outs opaque48mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 357 | "sgdt\t$dst", [], IIC_SGDT>, TB; |
Kevin Enderby | 87f4a1a | 2010-10-19 00:01:44 +0000 | [diff] [blame] | 358 | def SIDT16m : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 359 | "sidtw\t$dst", [], IIC_SIDT>, TB, OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 360 | def SIDTm : I<0x01, MRM1m, (outs opaque48mem:$dst), (ins), |
| 361 | "sidt\t$dst", []>, TB; |
| 362 | def SLDT16r : I<0x00, MRM0r, (outs GR16:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 363 | "sldt{w}\t$dst", [], IIC_SLDT>, TB, OpSize; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 364 | def SLDT16m : I<0x00, MRM0m, (outs i16mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 365 | "sldt{w}\t$dst", [], IIC_SLDT>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 366 | def SLDT32r : I<0x00, MRM0r, (outs GR32:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 367 | "sldt{l}\t$dst", [], IIC_SLDT>, TB; |
Chris Lattner | 010496c | 2010-10-05 06:22:35 +0000 | [diff] [blame] | 368 | |
| 369 | // LLDT is not interpreted specially in 64-bit mode because there is no sign |
| 370 | // extension. |
| 371 | def SLDT64r : RI<0x00, MRM0r, (outs GR64:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 372 | "sldt{q}\t$dst", [], IIC_SLDT>, TB; |
Chris Lattner | 010496c | 2010-10-05 06:22:35 +0000 | [diff] [blame] | 373 | def SLDT64m : RI<0x00, MRM0m, (outs i16mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 374 | "sldt{q}\t$dst", [], IIC_SLDT>, TB; |
Chris Lattner | 010496c | 2010-10-05 06:22:35 +0000 | [diff] [blame] | 375 | |
Kevin Enderby | 87f4a1a | 2010-10-19 00:01:44 +0000 | [diff] [blame] | 376 | def LGDT16m : I<0x01, MRM2m, (outs), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 377 | "lgdtw\t$src", [], IIC_LGDT>, TB, OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 378 | def LGDTm : I<0x01, MRM2m, (outs), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 379 | "lgdt\t$src", [], IIC_LGDT>, TB; |
Kevin Enderby | 87f4a1a | 2010-10-19 00:01:44 +0000 | [diff] [blame] | 380 | def LIDT16m : I<0x01, MRM3m, (outs), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 381 | "lidtw\t$src", [], IIC_LIDT>, TB, OpSize, Requires<[In32BitMode]>; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 382 | def LIDTm : I<0x01, MRM3m, (outs), (ins opaque48mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 383 | "lidt\t$src", [], IIC_LIDT>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 384 | def LLDT16r : I<0x00, MRM2r, (outs), (ins GR16:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 385 | "lldt{w}\t$src", [], IIC_LLDT_REG>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 386 | def LLDT16m : I<0x00, MRM2m, (outs), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 387 | "lldt{w}\t$src", [], IIC_LLDT_MEM>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 388 | |
| 389 | //===----------------------------------------------------------------------===// |
| 390 | // Specialized register support |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 391 | def WRMSR : I<0x30, RawFrm, (outs), (ins), "wrmsr", [], IIC_WRMSR>, TB; |
| 392 | def RDMSR : I<0x32, RawFrm, (outs), (ins), "rdmsr", [], IIC_RDMSR>, TB; |
| 393 | def RDPMC : I<0x33, RawFrm, (outs), (ins), "rdpmc", [], IIC_RDPMC>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 394 | |
| 395 | def SMSW16r : I<0x01, MRM4r, (outs GR16:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 396 | "smsw{w}\t$dst", [], IIC_SMSW>, OpSize, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 397 | def SMSW32r : I<0x01, MRM4r, (outs GR32:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 398 | "smsw{l}\t$dst", [], IIC_SMSW>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 399 | // no m form encodable; use SMSW16m |
| 400 | def SMSW64r : RI<0x01, MRM4r, (outs GR64:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 401 | "smsw{q}\t$dst", [], IIC_SMSW>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 402 | |
| 403 | // For memory operands, there is only a 16-bit form |
| 404 | def SMSW16m : I<0x01, MRM4m, (outs i16mem:$dst), (ins), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 405 | "smsw{w}\t$dst", [], IIC_SMSW>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 406 | |
| 407 | def LMSW16r : I<0x01, MRM6r, (outs), (ins GR16:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 408 | "lmsw{w}\t$src", [], IIC_LMSW_MEM>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 409 | def LMSW16m : I<0x01, MRM6m, (outs), (ins i16mem:$src), |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 410 | "lmsw{w}\t$src", [], IIC_LMSW_REG>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 411 | |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 412 | def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", [], IIC_CPUID>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 413 | |
| 414 | //===----------------------------------------------------------------------===// |
| 415 | // Cache instructions |
Preston Gurd | 3d142e5 | 2012-05-04 19:26:37 +0000 | [diff] [blame] | 416 | def INVD : I<0x08, RawFrm, (outs), (ins), "invd", [], IIC_INVD>, TB; |
| 417 | def WBINVD : I<0x09, RawFrm, (outs), (ins), "wbinvd", [], IIC_INVD>, TB; |
Chris Lattner | 434c7cb | 2010-10-05 05:32:15 +0000 | [diff] [blame] | 418 | |
Craig Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 419 | //===----------------------------------------------------------------------===// |
| 420 | // XSAVE instructions |
Rafael Espindola | 87ca0e0 | 2011-02-22 00:35:18 +0000 | [diff] [blame] | 421 | let Defs = [RDX, RAX], Uses = [RCX] in |
| 422 | def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB; |
| 423 | |
| 424 | let Uses = [RDX, RAX, RCX] in |
| 425 | def XSETBV : I<0x01, MRM_D1, (outs), (ins), "xsetbv", []>, TB; |
Joerg Sonnenberger | 4a8ac8d | 2011-04-04 16:58:13 +0000 | [diff] [blame] | 426 | |
Craig Topper | 1b526a9 | 2011-10-07 05:53:50 +0000 | [diff] [blame] | 427 | let 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 Sonnenberger | 4a8ac8d | 2011-04-04 16:58:13 +0000 | [diff] [blame] | 442 | //===----------------------------------------------------------------------===// |
| 443 | // VIA PadLock crypto instructions |
| 444 | let Defs = [RAX, RDI], Uses = [RDX, RDI] in |
| 445 | def XSTORE : I<0xc0, RawFrm, (outs), (ins), "xstore", []>, A7; |
| 446 | |
Joerg Sonnenberger | ca0ede7 | 2011-06-30 01:38:03 +0000 | [diff] [blame] | 447 | def : InstAlias<"xstorerng", (XSTORE)>; |
| 448 | |
Joerg Sonnenberger | 4a8ac8d | 2011-04-04 16:58:13 +0000 | [diff] [blame] | 449 | let 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 | |
| 457 | let 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 | } |
| 461 | let Defs = [RAX, RDX, RSI], Uses = [RAX, RSI] in |
| 462 | def MONTMUL : I<0xc0, RawFrm, (outs), (ins), "montmul", []>, A6; |
Craig Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 463 | |
| 464 | //===----------------------------------------------------------------------===// |
| 465 | // FS/GS Base Instructions |
Craig Topper | e7b0550 | 2011-10-30 19:57:21 +0000 | [diff] [blame] | 466 | let Predicates = [HasFSGSBase, In64BitMode] in { |
Craig Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 467 | def RDFSBASE : I<0xAE, MRM0r, (outs GR32:$dst), (ins), |
Craig Topper | e7b0550 | 2011-10-30 19:57:21 +0000 | [diff] [blame] | 468 | "rdfsbase{l}\t$dst", |
| 469 | [(set GR32:$dst, (int_x86_rdfsbase_32))]>, TB, XS; |
Craig Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 470 | def RDFSBASE64 : RI<0xAE, MRM0r, (outs GR64:$dst), (ins), |
Craig Topper | e7b0550 | 2011-10-30 19:57:21 +0000 | [diff] [blame] | 471 | "rdfsbase{q}\t$dst", |
| 472 | [(set GR64:$dst, (int_x86_rdfsbase_64))]>, TB, XS; |
Craig Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 473 | def RDGSBASE : I<0xAE, MRM1r, (outs GR32:$dst), (ins), |
Craig Topper | e7b0550 | 2011-10-30 19:57:21 +0000 | [diff] [blame] | 474 | "rdgsbase{l}\t$dst", |
| 475 | [(set GR32:$dst, (int_x86_rdgsbase_32))]>, TB, XS; |
Craig Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 476 | def RDGSBASE64 : RI<0xAE, MRM1r, (outs GR64:$dst), (ins), |
Craig Topper | e7b0550 | 2011-10-30 19:57:21 +0000 | [diff] [blame] | 477 | "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 Topper | 75fe5f3 | 2011-10-07 07:02:24 +0000 | [diff] [blame] | 491 | } |
Craig Topper | dc479c4 | 2011-10-16 07:05:40 +0000 | [diff] [blame] | 492 | |
| 493 | //===----------------------------------------------------------------------===// |
| 494 | // INVPCID Instruction |
| 495 | def INVPCID32 : I<0x82, MRMSrcMem, (outs), (ins GR32:$src1, i128mem:$src2), |
| 496 | "invpcid {$src2, $src1|$src1, $src2}", []>, OpSize, T8, |
| 497 | Requires<[In32BitMode]>; |
| 498 | def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2), |
| 499 | "invpcid {$src2, $src1|$src1, $src2}", []>, OpSize, T8, |
| 500 | Requires<[In64BitMode]>; |