Add an icmp_imm instruction.
Compare a scalar integer to an immediate constant. Both Intel and RISC-V ISAs have this operation. This requires the addition of a new IntCompareImm instruction format.
This commit is contained in:
@@ -216,11 +216,12 @@ impl<'a> Context<'a> {
|
||||
InstructionData::UnaryIeee32 { .. } |
|
||||
InstructionData::UnaryIeee64 { .. } => {}
|
||||
|
||||
InstructionData::Unary { ref mut arg, .. } |
|
||||
InstructionData::UnarySplit { ref mut arg, .. } |
|
||||
InstructionData::BinaryImm { ref mut arg, .. } |
|
||||
InstructionData::BranchTable { ref mut arg, .. } |
|
||||
InstructionData::ExtractLane { ref mut arg, .. } |
|
||||
InstructionData::BranchTable { ref mut arg, .. } => {
|
||||
InstructionData::IntCompareImm { ref mut arg, .. } |
|
||||
InstructionData::Unary { ref mut arg, .. } |
|
||||
InstructionData::UnarySplit { ref mut arg, .. } => {
|
||||
self.map.rewrite_value(arg, loc)?;
|
||||
}
|
||||
|
||||
@@ -1557,6 +1558,20 @@ impl<'a> Parser<'a> {
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
InstructionFormat::IntCompareImm => {
|
||||
let cond = self.match_enum("expected intcc condition code")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let lhs = self.match_value("expected SSA value first operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_imm64("expected immediate second operand")?;
|
||||
InstructionData::IntCompareImm {
|
||||
opcode: opcode,
|
||||
ty: VOID,
|
||||
cond: cond,
|
||||
arg: lhs,
|
||||
imm: rhs,
|
||||
}
|
||||
}
|
||||
InstructionFormat::FloatCompare => {
|
||||
let cond = self.match_enum("expected floatcc condition code")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
|
||||
Reference in New Issue
Block a user