Path: blob/main/cranelift/assembler-x64/meta/src/instructions/setcc.rs
1693 views
use crate::dsl::{Eflags::*, Feature::*, Inst, Location::*};1use crate::dsl::{fmt, inst, rex, w};23#[rustfmt::skip] // Keeps instructions on a single line.4pub fn list() -> Vec<Inst> {5vec![6// Note that the Intel manual lists many mnemonics for this family of7// instructions which are duplicates of other mnemonics. The order here8// matches the order in the manual and comments are left when variants9// are omitted due to the instructions being duplicates of another.10//11// Also note that the `digit(0)` annotation here is not mentioned in the12// manual's description for the encoding of these instructions. This is13// due to:14//15// > The reg field of the ModR/M byte is not used for the SETCC16// > instruction and those opcode bits are ignored by the processor.17//18// Here 0 is used in the reg field to match what other assemblers look19// like they're doing of setting the reg bits to zero.20inst("seta", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x97]).digit(0), _64b | compat),21inst("setae", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x93]).digit(0), _64b | compat),22inst("setb", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x92]).digit(0), _64b | compat),23inst("setbe", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x96]).digit(0), _64b | compat),24// NB: setc* is omitted here as it has the same encoding as setb*25inst("sete", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x94]).digit(0), _64b | compat),26inst("setg", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x9f]).digit(0), _64b | compat),27inst("setge", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x9d]).digit(0), _64b | compat),28inst("setl", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x9c]).digit(0), _64b | compat),29inst("setle", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x9e]).digit(0), _64b | compat),30// NB: setna* is omitted here as it has the same encoding as setbe*31// NB: setnae* is omitted here as it has the same encoding as setb*32// NB: setnb* is omitted here as it has the same encoding as setae*33// NB: setnbe* is omitted here as it has the same encoding as seta*34// NB: setnc* is omitted here as it has the same encoding as setae*35inst("setne", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x95]).digit(0), _64b | compat),36// NB: setng* is omitted here as it has the same encoding as setle*37// NB: setnge* is omitted here as it has the same encoding as setl*38// NB: setnl* is omitted here as it has the same encoding as setge*39// NB: setnle* is omitted here as it has the same encoding as setg*40inst("setno", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x91]).digit(0), _64b | compat),41inst("setnp", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x9b]).digit(0), _64b | compat),42inst("setns", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x99]).digit(0), _64b | compat),43// NB: setnz* is omitted here as it has the same encoding as setne*44inst("seto", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x90]).digit(0), _64b | compat),45inst("setp", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x9a]).digit(0), _64b | compat),46// NB: setpe* is omitted here as it has the same encoding as setp*47// NB: setpo* is omitted here as it has the same encoding as setnp*48inst("sets", fmt("M", [w(rm8)]).flags(R), rex([0x0f, 0x98]).digit(0), _64b | compat),49// NB: setz* is omitted here as it has the same encoding as sete*50]51}525354