2012-02-18 12:03:15 +00:00
|
|
|
//===-- X86InstrCMovSetCC.td - Conditional Move and SetCC --*- tablegen -*-===//
|
|
|
|
//
|
2010-10-05 06:33:16 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2012-02-18 12:03:15 +00:00
|
|
|
//
|
2010-10-05 06:33:16 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the X86 conditional move and set on condition
|
|
|
|
// instructions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-10-05 22:01:02 +00:00
|
|
|
|
|
|
|
// SetCC instructions.
|
|
|
|
multiclass CMOV<bits<8> opc, string Mnemonic, PatLeaf CondNode> {
|
|
|
|
let Uses = [EFLAGS], Predicates = [HasCMov], Constraints = "$src1 = $dst",
|
2013-03-19 23:23:26 +00:00
|
|
|
isCommutable = 1, SchedRW = [WriteALU] in {
|
2013-01-07 05:26:58 +00:00
|
|
|
def NAME#16rr
|
2010-10-05 23:00:14 +00:00
|
|
|
: I<opc, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
|
|
|
|
!strconcat(Mnemonic, "{w}\t{$src2, $dst|$dst, $src2}"),
|
|
|
|
[(set GR16:$dst,
|
2012-02-01 23:20:51 +00:00
|
|
|
(X86cmov GR16:$src1, GR16:$src2, CondNode, EFLAGS))],
|
2014-02-02 09:25:09 +00:00
|
|
|
IIC_CMOV16_RR>, TB, OpSize16;
|
2013-01-07 05:26:58 +00:00
|
|
|
def NAME#32rr
|
2010-10-05 23:00:14 +00:00
|
|
|
: I<opc, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
|
|
|
|
!strconcat(Mnemonic, "{l}\t{$src2, $dst|$dst, $src2}"),
|
|
|
|
[(set GR32:$dst,
|
2012-02-01 23:20:51 +00:00
|
|
|
(X86cmov GR32:$src1, GR32:$src2, CondNode, EFLAGS))],
|
2014-02-02 09:25:09 +00:00
|
|
|
IIC_CMOV32_RR>, TB, OpSize32;
|
2013-01-07 05:26:58 +00:00
|
|
|
def NAME#64rr
|
2010-10-05 23:00:14 +00:00
|
|
|
:RI<opc, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2),
|
|
|
|
!strconcat(Mnemonic, "{q}\t{$src2, $dst|$dst, $src2}"),
|
|
|
|
[(set GR64:$dst,
|
2012-02-01 23:20:51 +00:00
|
|
|
(X86cmov GR64:$src1, GR64:$src2, CondNode, EFLAGS))],
|
|
|
|
IIC_CMOV32_RR>, TB;
|
2010-10-05 22:01:02 +00:00
|
|
|
}
|
|
|
|
|
2013-03-19 23:23:26 +00:00
|
|
|
let Uses = [EFLAGS], Predicates = [HasCMov], Constraints = "$src1 = $dst",
|
|
|
|
SchedRW = [WriteALULd, ReadAfterLd] in {
|
2013-01-07 05:26:58 +00:00
|
|
|
def NAME#16rm
|
2010-10-05 23:00:14 +00:00
|
|
|
: I<opc, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2),
|
|
|
|
!strconcat(Mnemonic, "{w}\t{$src2, $dst|$dst, $src2}"),
|
|
|
|
[(set GR16:$dst, (X86cmov GR16:$src1, (loadi16 addr:$src2),
|
2012-02-01 23:20:51 +00:00
|
|
|
CondNode, EFLAGS))], IIC_CMOV16_RM>,
|
2014-02-02 09:25:09 +00:00
|
|
|
TB, OpSize16;
|
2013-01-07 05:26:58 +00:00
|
|
|
def NAME#32rm
|
2010-10-05 23:00:14 +00:00
|
|
|
: I<opc, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2),
|
|
|
|
!strconcat(Mnemonic, "{l}\t{$src2, $dst|$dst, $src2}"),
|
|
|
|
[(set GR32:$dst, (X86cmov GR32:$src1, (loadi32 addr:$src2),
|
2014-01-08 12:57:40 +00:00
|
|
|
CondNode, EFLAGS))], IIC_CMOV32_RM>,
|
2014-02-02 09:25:09 +00:00
|
|
|
TB, OpSize32;
|
2013-01-07 05:26:58 +00:00
|
|
|
def NAME#64rm
|
2010-10-05 23:00:14 +00:00
|
|
|
:RI<opc, MRMSrcMem, (outs GR64:$dst), (ins GR64:$src1, i64mem:$src2),
|
|
|
|
!strconcat(Mnemonic, "{q}\t{$src2, $dst|$dst, $src2}"),
|
|
|
|
[(set GR64:$dst, (X86cmov GR64:$src1, (loadi64 addr:$src2),
|
2012-02-01 23:20:51 +00:00
|
|
|
CondNode, EFLAGS))], IIC_CMOV32_RM>, TB;
|
2010-10-05 22:01:02 +00:00
|
|
|
} // Uses = [EFLAGS], Predicates = [HasCMov], Constraints = "$src1 = $dst"
|
|
|
|
} // end multiclass
|
|
|
|
|
2010-10-05 22:23:58 +00:00
|
|
|
|
|
|
|
// Conditional Moves.
|
2010-10-05 23:09:10 +00:00
|
|
|
defm CMOVO : CMOV<0x40, "cmovo" , X86_COND_O>;
|
|
|
|
defm CMOVNO : CMOV<0x41, "cmovno", X86_COND_NO>;
|
|
|
|
defm CMOVB : CMOV<0x42, "cmovb" , X86_COND_B>;
|
|
|
|
defm CMOVAE : CMOV<0x43, "cmovae", X86_COND_AE>;
|
|
|
|
defm CMOVE : CMOV<0x44, "cmove" , X86_COND_E>;
|
|
|
|
defm CMOVNE : CMOV<0x45, "cmovne", X86_COND_NE>;
|
2010-10-05 22:23:58 +00:00
|
|
|
defm CMOVBE : CMOV<0x46, "cmovbe", X86_COND_BE>;
|
2010-10-05 23:09:10 +00:00
|
|
|
defm CMOVA : CMOV<0x47, "cmova" , X86_COND_A>;
|
|
|
|
defm CMOVS : CMOV<0x48, "cmovs" , X86_COND_S>;
|
|
|
|
defm CMOVNS : CMOV<0x49, "cmovns", X86_COND_NS>;
|
|
|
|
defm CMOVP : CMOV<0x4A, "cmovp" , X86_COND_P>;
|
|
|
|
defm CMOVNP : CMOV<0x4B, "cmovnp", X86_COND_NP>;
|
|
|
|
defm CMOVL : CMOV<0x4C, "cmovl" , X86_COND_L>;
|
|
|
|
defm CMOVGE : CMOV<0x4D, "cmovge", X86_COND_GE>;
|
|
|
|
defm CMOVLE : CMOV<0x4E, "cmovle", X86_COND_LE>;
|
|
|
|
defm CMOVG : CMOV<0x4F, "cmovg" , X86_COND_G>;
|
2010-10-05 06:33:16 +00:00
|
|
|
|
|
|
|
|
2010-10-05 21:34:29 +00:00
|
|
|
// SetCC instructions.
|
|
|
|
multiclass SETCC<bits<8> opc, string Mnemonic, PatLeaf OpNode> {
|
|
|
|
let Uses = [EFLAGS] in {
|
2014-02-10 06:55:41 +00:00
|
|
|
def r : I<opc, MRMXr, (outs GR8:$dst), (ins),
|
2010-10-05 21:34:29 +00:00
|
|
|
!strconcat(Mnemonic, "\t$dst"),
|
2012-02-01 23:20:51 +00:00
|
|
|
[(set GR8:$dst, (X86setcc OpNode, EFLAGS))],
|
2013-03-19 23:23:26 +00:00
|
|
|
IIC_SET_R>, TB, Sched<[WriteALU]>;
|
2014-02-10 06:55:41 +00:00
|
|
|
def m : I<opc, MRMXm, (outs), (ins i8mem:$dst),
|
2010-10-05 21:34:29 +00:00
|
|
|
!strconcat(Mnemonic, "\t$dst"),
|
2012-02-01 23:20:51 +00:00
|
|
|
[(store (X86setcc OpNode, EFLAGS), addr:$dst)],
|
2013-03-19 23:23:26 +00:00
|
|
|
IIC_SET_M>, TB, Sched<[WriteALU, WriteStore]>;
|
2010-10-05 21:34:29 +00:00
|
|
|
} // Uses = [EFLAGS]
|
|
|
|
}
|
2010-10-05 06:33:16 +00:00
|
|
|
|
2010-10-05 21:34:29 +00:00
|
|
|
defm SETO : SETCC<0x90, "seto", X86_COND_O>; // is overflow bit set
|
|
|
|
defm SETNO : SETCC<0x91, "setno", X86_COND_NO>; // is overflow bit not set
|
|
|
|
defm SETB : SETCC<0x92, "setb", X86_COND_B>; // unsigned less than
|
|
|
|
defm SETAE : SETCC<0x93, "setae", X86_COND_AE>; // unsigned greater or equal
|
|
|
|
defm SETE : SETCC<0x94, "sete", X86_COND_E>; // equal to
|
|
|
|
defm SETNE : SETCC<0x95, "setne", X86_COND_NE>; // not equal to
|
|
|
|
defm SETBE : SETCC<0x96, "setbe", X86_COND_BE>; // unsigned less than or equal
|
|
|
|
defm SETA : SETCC<0x97, "seta", X86_COND_A>; // unsigned greater than
|
|
|
|
defm SETS : SETCC<0x98, "sets", X86_COND_S>; // is signed bit set
|
|
|
|
defm SETNS : SETCC<0x99, "setns", X86_COND_NS>; // is not signed
|
|
|
|
defm SETP : SETCC<0x9A, "setp", X86_COND_P>; // is parity bit set
|
|
|
|
defm SETNP : SETCC<0x9B, "setnp", X86_COND_NP>; // is parity bit not set
|
|
|
|
defm SETL : SETCC<0x9C, "setl", X86_COND_L>; // signed less than
|
|
|
|
defm SETGE : SETCC<0x9D, "setge", X86_COND_GE>; // signed greater or equal
|
|
|
|
defm SETLE : SETCC<0x9E, "setle", X86_COND_LE>; // signed less than or equal
|
|
|
|
defm SETG : SETCC<0x9F, "setg", X86_COND_G>; // signed greater than
|
2010-10-05 06:33:16 +00:00
|
|
|
|