Encode iconst.i32 for RISC-V.
For large constants with the low 12 bits clear, we already have the "lui" encoding. Add "addi %x0" encodings for signed 12-bit constants.
This commit is contained in:
@@ -160,6 +160,18 @@ fn recipe_i<CS: CodeSink + ?Sized>(func: &Function, inst: Inst, sink: &mut CS) {
|
||||
}
|
||||
}
|
||||
|
||||
fn recipe_iz<CS: CodeSink + ?Sized>(func: &Function, inst: Inst, sink: &mut CS) {
|
||||
if let InstructionData::UnaryImm { imm, .. } = func.dfg[inst] {
|
||||
put_i(func.encodings[inst].bits(),
|
||||
0,
|
||||
imm.into(),
|
||||
func.locations[func.dfg.first_result(inst)].unwrap_reg(),
|
||||
sink);
|
||||
} else {
|
||||
panic!("Expected UnaryImm format: {:?}", func.dfg[inst]);
|
||||
}
|
||||
}
|
||||
|
||||
fn recipe_iicmp<CS: CodeSink + ?Sized>(func: &Function, inst: Inst, sink: &mut CS) {
|
||||
if let InstructionData::IntCompareImm { arg, imm, .. } = func.dfg[inst] {
|
||||
put_i(func.encodings[inst].bits(),
|
||||
|
||||
Reference in New Issue
Block a user