Define icmp and fcmp comparison instructions.
Add new intcc and floatcc operand types for the immediate condition codes on these instructions. Add new IntCompare and FloatCompare instruction formats. Add a generic match_enum() parser function that can match any identifier-like enumerated operand kind that implements FromStr. Define the icmp and fcmp instructions in case.py. Include documentation for the condition codes with these two instructions.
This commit is contained in:
@@ -11,6 +11,7 @@ use std::str::FromStr;
|
||||
|
||||
use entities::*;
|
||||
use immediates::*;
|
||||
use condcodes::*;
|
||||
use types::{self, Type};
|
||||
|
||||
// Include code generated by `meta/gen_instr.py`. This file contains:
|
||||
@@ -175,6 +176,18 @@ pub enum InstructionData {
|
||||
lane: u8,
|
||||
arg: Value,
|
||||
},
|
||||
IntCompare {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
cond: IntCC,
|
||||
args: [Value; 2],
|
||||
},
|
||||
FloatCompare {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
cond: FloatCC,
|
||||
args: [Value; 2],
|
||||
},
|
||||
Jump {
|
||||
opcode: Opcode,
|
||||
ty: Type,
|
||||
|
||||
@@ -197,6 +197,8 @@ pub fn write_instruction(w: &mut Write, func: &Function, inst: Inst) -> Result {
|
||||
Select { args, .. } => writeln!(w, " {}, {}, {}", args[0], args[1], args[2]),
|
||||
InsertLane { lane, args, .. } => writeln!(w, " {}, {}, {}", args[0], lane, args[1]),
|
||||
ExtractLane { lane, arg, .. } => writeln!(w, " {}, {}", arg, lane),
|
||||
IntCompare { cond, args, .. } => writeln!(w, " {}, {}, {}", cond, args[0], args[1]),
|
||||
FloatCompare { cond, args, .. } => writeln!(w, " {}, {}, {}", cond, args[0], args[1]),
|
||||
Jump { ref data, .. } => writeln!(w, " {}", data),
|
||||
Branch { ref data, .. } => writeln!(w, " {}", data),
|
||||
BranchTable { arg, table, .. } => writeln!(w, " {}, {}", arg, table),
|
||||
|
||||
Reference in New Issue
Block a user