1 //===-- X86InstrMPX.td - MPX Instruction Set ---------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the X86 MPX instruction set, defining the
11 // instructions, and properties of the instructions which are needed for code
12 // generation, machine code emission, and analysis.
14 //===----------------------------------------------------------------------===//
16 // FIXME: Investigate a better scheduler itinerary once MPX is used inside LLVM.
17 let SchedRW = [WriteSystem] in {
19 multiclass mpx_bound_make<bits<8> opc, string OpcodeStr> {
21 def 32rm: I<opc, MRMSrcMem, (outs BNDR:$dst), (ins i32mem:$src),
22 OpcodeStr#"\t{$src, $dst|$dst, $src}", [], IIC_MPX>,
23 Requires<[HasMPX, Not64BitMode]>;
24 def 64rm: RI<opc, MRMSrcMem, (outs BNDR:$dst), (ins i64mem:$src),
25 OpcodeStr#"\t{$src, $dst|$dst, $src}", [], IIC_MPX>,
26 Requires<[HasMPX, In64BitMode]>;
30 defm BNDMK : mpx_bound_make<0x1B, "bndmk">, XS;
32 multiclass mpx_bound_check<bits<8> opc, string OpcodeStr> {
34 def 32rm: I<opc, MRMSrcMem, (outs), (ins BNDR:$src1, i32mem:$src2),
35 OpcodeStr#"\t{$src2, $src1|$src1, $src2}", [], IIC_MPX>,
36 Requires<[HasMPX, Not64BitMode]>;
37 def 64rm: RI<opc, MRMSrcMem, (outs), (ins BNDR:$src1, i64mem:$src2),
38 OpcodeStr#"\t{$src2, $src1|$src1, $src2}", [], IIC_MPX>,
39 Requires<[HasMPX, In64BitMode]>;
41 def 32rr: I<opc, MRMSrcReg, (outs), (ins BNDR:$src1, GR32:$src2),
42 OpcodeStr#"\t{$src2, $src1|$src1, $src2}", [], IIC_MPX>,
43 Requires<[HasMPX, Not64BitMode]>;
44 def 64rr: RI<opc, MRMSrcReg, (outs), (ins BNDR:$src1, GR64:$src2),
45 OpcodeStr#"\t{$src2, $src1|$src1, $src2}", [], IIC_MPX>,
46 Requires<[HasMPX, In64BitMode]>;
48 defm BNDCL : mpx_bound_check<0x1A, "bndcl">, XS;
49 defm BNDCU : mpx_bound_check<0x1A, "bndcu">, XD;
50 defm BNDCN : mpx_bound_check<0x1B, "bndcn">, XD;
52 def BNDMOVRMrr : I<0x1A, MRMSrcReg, (outs BNDR:$dst), (ins BNDR:$src),
53 "bndmov\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PD,
56 def BNDMOVRM32rm : I<0x1A, MRMSrcMem, (outs BNDR:$dst), (ins i64mem:$src),
57 "bndmov\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PD,
58 Requires<[HasMPX, Not64BitMode]>;
59 def BNDMOVRM64rm : RI<0x1A, MRMSrcMem, (outs BNDR:$dst), (ins i128mem:$src),
60 "bndmov\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PD,
61 Requires<[HasMPX, In64BitMode]>;
63 def BNDMOVMRrr : I<0x1B, MRMDestReg, (outs BNDR:$dst), (ins BNDR:$src),
64 "bndmov\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PD,
67 def BNDMOVMR32mr : I<0x1B, MRMDestMem, (outs), (ins i64mem:$dst, BNDR:$src),
68 "bndmov\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PD,
69 Requires<[HasMPX, Not64BitMode]>;
70 def BNDMOVMR64mr : RI<0x1B, MRMDestMem, (outs), (ins i128mem:$dst, BNDR:$src),
71 "bndmov\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PD,
72 Requires<[HasMPX, In64BitMode]>;
74 def BNDSTXmr: I<0x1B, MRMDestMem, (outs), (ins i64mem:$dst, BNDR:$src),
75 "bndstx\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PS,
79 def BNDLDXrm: I<0x1A, MRMSrcMem, (outs BNDR:$dst), (ins anymem:$src),
80 "bndldx\t{$src, $dst|$dst, $src}", [], IIC_MPX>, PS,