llvm.org GIT mirror llvm / 02d2e61
Add CLAC/STAC instruction encoding/decoding support As these two instructions in AVX extension are privileged instructions for special purpose, it's only expected to be used in inlined assembly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179266 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Liao 7 years ago
8 changed file(s) with 89 addition(s) and 51 deletion(s). Raw diff Collapse all Expand all
273273
274274 //// MRM_XX - A mod/rm byte of exactly 0xXX.
275275 MRM_C1 = 33, MRM_C2 = 34, MRM_C3 = 35, MRM_C4 = 36,
276 MRM_C8 = 37, MRM_C9 = 38, MRM_E8 = 39, MRM_F0 = 40,
277 MRM_F8 = 41, MRM_F9 = 42, MRM_D0 = 45, MRM_D1 = 46,
278 MRM_D4 = 47, MRM_D5 = 48, MRM_D6 = 49, MRM_D8 = 50,
279 MRM_D9 = 51, MRM_DA = 52, MRM_DB = 53, MRM_DC = 54,
280 MRM_DD = 55, MRM_DE = 56, MRM_DF = 57,
276 MRM_C8 = 37, MRM_C9 = 38, MRM_CA = 39, MRM_CB = 40,
277 MRM_E8 = 41, MRM_F0 = 42, MRM_F8 = 45, MRM_F9 = 46,
278 MRM_D0 = 47, MRM_D1 = 48, MRM_D4 = 49, MRM_D5 = 50,
279 MRM_D6 = 51, MRM_D8 = 52, MRM_D9 = 53, MRM_DA = 54,
280 MRM_DB = 55, MRM_DC = 56, MRM_DD = 57, MRM_DE = 58,
281 MRM_DF = 59,
281282
282283 /// RawFrmImm8 - This is used for the ENTER instruction, which has two
283284 /// immediates, the first of which is a 16-bit immediate (specified by
595596 }
596597 case X86II::MRM_C1: case X86II::MRM_C2: case X86II::MRM_C3:
597598 case X86II::MRM_C4: case X86II::MRM_C8: case X86II::MRM_C9:
598 case X86II::MRM_E8: case X86II::MRM_F0: case X86II::MRM_F8:
599 case X86II::MRM_F9: case X86II::MRM_D0: case X86II::MRM_D1:
600 case X86II::MRM_D4: case X86II::MRM_D5: case X86II::MRM_D6:
601 case X86II::MRM_D8: case X86II::MRM_D9: case X86II::MRM_DA:
602 case X86II::MRM_DB: case X86II::MRM_DC: case X86II::MRM_DD:
603 case X86II::MRM_DE: case X86II::MRM_DF:
599 case X86II::MRM_CA: case X86II::MRM_CB: case X86II::MRM_E8:
600 case X86II::MRM_F0: case X86II::MRM_F8: case X86II::MRM_F9:
601 case X86II::MRM_D0: case X86II::MRM_D1: case X86II::MRM_D4:
602 case X86II::MRM_D5: case X86II::MRM_D6: case X86II::MRM_D8:
603 case X86II::MRM_D9: case X86II::MRM_DA: case X86II::MRM_DB:
604 case X86II::MRM_DC: case X86II::MRM_DD: case X86II::MRM_DE:
605 case X86II::MRM_DF:
604606 return -1;
605607 }
606608 }
11271127 break;
11281128 case X86II::MRM_C1: case X86II::MRM_C2: case X86II::MRM_C3:
11291129 case X86II::MRM_C4: case X86II::MRM_C8: case X86II::MRM_C9:
1130 case X86II::MRM_D0: case X86II::MRM_D1: case X86II::MRM_D4:
1131 case X86II::MRM_D5: case X86II::MRM_D6: case X86II::MRM_D8:
1132 case X86II::MRM_D9: case X86II::MRM_DA: case X86II::MRM_DB:
1133 case X86II::MRM_DC: case X86II::MRM_DD: case X86II::MRM_DE:
1134 case X86II::MRM_DF: case X86II::MRM_E8: case X86II::MRM_F0:
1135 case X86II::MRM_F8: case X86II::MRM_F9:
1130 case X86II::MRM_CA: case X86II::MRM_CB: case X86II::MRM_D0:
1131 case X86II::MRM_D1: case X86II::MRM_D4: case X86II::MRM_D5:
1132 case X86II::MRM_D6: case X86II::MRM_D8: case X86II::MRM_D9:
1133 case X86II::MRM_DA: case X86II::MRM_DB: case X86II::MRM_DC:
1134 case X86II::MRM_DD: case X86II::MRM_DE: case X86II::MRM_DF:
1135 case X86II::MRM_E8: case X86II::MRM_F0: case X86II::MRM_F8:
1136 case X86II::MRM_F9:
11361137 EmitByte(BaseOpcode, CurByte, OS);
11371138
11381139 unsigned char MRM;
11441145 case X86II::MRM_C4: MRM = 0xC4; break;
11451146 case X86II::MRM_C8: MRM = 0xC8; break;
11461147 case X86II::MRM_C9: MRM = 0xC9; break;
1148 case X86II::MRM_CA: MRM = 0xCA; break;
1149 case X86II::MRM_CB: MRM = 0xCB; break;
11471150 case X86II::MRM_D0: MRM = 0xD0; break;
11481151 case X86II::MRM_D1: MRM = 0xD1; break;
11491152 case X86II::MRM_D4: MRM = 0xD4; break;
14501450 MCE.emitByte(BaseOpcode);
14511451 MCE.emitByte(0xC9);
14521452 break;
1453 case X86II::MRM_CA:
1454 MCE.emitByte(BaseOpcode);
1455 MCE.emitByte(0xCA);
1456 break;
1457 case X86II::MRM_CB:
1458 MCE.emitByte(BaseOpcode);
1459 MCE.emitByte(0xCB);
1460 break;
14531461 case X86II::MRM_E8:
14541462 MCE.emitByte(BaseOpcode);
14551463 MCE.emitByte(0xE8);
3434 def MRM_C4 : Format<36>;
3535 def MRM_C8 : Format<37>;
3636 def MRM_C9 : Format<38>;
37 def MRM_E8 : Format<39>;
38 def MRM_F0 : Format<40>;
39 def MRM_F8 : Format<41>;
40 def MRM_F9 : Format<42>;
37 def MRM_CA : Format<39>;
38 def MRM_CB : Format<40>;
39 def MRM_E8 : Format<41>;
40 def MRM_F0 : Format<42>;
4141 def RawFrmImm8 : Format<43>;
4242 def RawFrmImm16 : Format<44>;
43 def MRM_D0 : Format<45>;
44 def MRM_D1 : Format<46>;
45 def MRM_D4 : Format<47>;
46 def MRM_D5 : Format<48>;
47 def MRM_D6 : Format<49>;
48 def MRM_D8 : Format<50>;
49 def MRM_D9 : Format<51>;
50 def MRM_DA : Format<52>;
51 def MRM_DB : Format<53>;
52 def MRM_DC : Format<54>;
53 def MRM_DD : Format<55>;
54 def MRM_DE : Format<56>;
55 def MRM_DF : Format<57>;
43 def MRM_F8 : Format<45>;
44 def MRM_F9 : Format<46>;
45 def MRM_D0 : Format<47>;
46 def MRM_D1 : Format<48>;
47 def MRM_D4 : Format<49>;
48 def MRM_D5 : Format<50>;
49 def MRM_D6 : Format<51>;
50 def MRM_D8 : Format<52>;
51 def MRM_D9 : Format<53>;
52 def MRM_DA : Format<54>;
53 def MRM_DB : Format<55>;
54 def MRM_DC : Format<56>;
55 def MRM_DD : Format<57>;
56 def MRM_DE : Format<58>;
57 def MRM_DF : Format<59>;
5658
5759 // ImmType - This specifies the immediate type used by an instruction. This is
5860 // part of the ad-hoc solution used to emit machine instruction encodings by our
519519 def INVPCID64 : I<0x82, MRMSrcMem, (outs), (ins GR64:$src1, i128mem:$src2),
520520 "invpcid\t{$src2, $src1|$src1, $src2}", []>, OpSize, T8,
521521 Requires<[In64BitMode]>;
522
523 //===----------------------------------------------------------------------===//
524 // SMAP Instruction
525 let Defs = [EFLAGS], Uses = [EFLAGS] in {
526 def CLAC : I<0x01, MRM_CA, (outs), (ins), "clac", []>, TB;
527 def STAC : I<0x01, MRM_CB, (outs), (ins), "stac", []>, TB;
528 }
120120
121121 # CHECK: xsaveoptq (%rax)
122122 0x48 0x0f 0xae 0x30
123
124 # CHECK: clac
125 0x0f 0x01 0xca
126
127 # CHECK: stac
128 0x0f 0x01 0xcb
12271227 // CHECK: sysexitq
12281228 // CHECK: encoding: [0x48,0x0f,0x35]
12291229 sysexitq
1230
1231 // CHECK: clac
1232 // CHECK: encoding: [0x0f,0x01,0xca]
1233 clac
1234
1235 // CHECK: stac
1236 // CHECK: encoding: [0x0f,0x01,0xcb]
1237 stac
2828 MAP(C4, 36) \
2929 MAP(C8, 37) \
3030 MAP(C9, 38) \
31 MAP(E8, 39) \
32 MAP(F0, 40) \
33 MAP(F8, 41) \
34 MAP(F9, 42) \
35 MAP(D0, 45) \
36 MAP(D1, 46) \
37 MAP(D4, 47) \
38 MAP(D5, 48) \
39 MAP(D6, 49) \
40 MAP(D8, 50) \
41 MAP(D9, 51) \
42 MAP(DA, 52) \
43 MAP(DB, 53) \
44 MAP(DC, 54) \
45 MAP(DD, 55) \
46 MAP(DE, 56) \
47 MAP(DF, 57)
31 MAP(CA, 39) \
32 MAP(CB, 40) \
33 MAP(E8, 41) \
34 MAP(F0, 42) \
35 MAP(F8, 45) \
36 MAP(F9, 46) \
37 MAP(D0, 47) \
38 MAP(D1, 48) \
39 MAP(D4, 49) \
40 MAP(D5, 50) \
41 MAP(D6, 51) \
42 MAP(D8, 52) \
43 MAP(D9, 53) \
44 MAP(DA, 54) \
45 MAP(DB, 55) \
46 MAP(DC, 56) \
47 MAP(DD, 57) \
48 MAP(DE, 58) \
49 MAP(DF, 59)
4850
4951 // A clone of X86 since we can't depend on something that is generated.
5052 namespace X86Local {