Add the br_icmp instruction.

This instruction behaves like icmp fused with brnz, and it can be used
to represent fused compare+branch instruction on Intel when optimizing
for macro-op fusion.

RISC-V provides compare-and-branch instructions directly, and it is
needed there too.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-03 13:44:15 -07:00
parent 0530e822d4
commit 1b6a6f4e48
8 changed files with 73 additions and 23 deletions

View File

@@ -200,6 +200,13 @@ pub enum InstructionData {
destination: Ebb,
args: ValueList,
},
BranchIcmp {
opcode: Opcode,
ty: Type,
cond: IntCC,
destination: Ebb,
args: ValueList,
},
BranchTable {
opcode: Opcode,
ty: Type,
@@ -303,6 +310,9 @@ impl InstructionData {
&InstructionData::Branch { destination, ref args, .. } => {
BranchInfo::SingleDest(destination, &args.as_slice(pool)[1..])
}
&InstructionData::BranchIcmp { destination, ref args, .. } => {
BranchInfo::SingleDest(destination, &args.as_slice(pool)[2..])
}
&InstructionData::BranchTable { table, .. } => BranchInfo::Table(table),
_ => BranchInfo::NotABranch,
}