properly selecting li instructions for integer sizes

This commit is contained in:
Jakub Doka 2024-10-25 15:29:17 +02:00
parent 2bab16d3ce
commit 62a7c61cdc
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143

View file

@ -1430,9 +1430,12 @@ impl ItemCtx {
self.emit(instrs::jmp(0)); self.emit(instrs::jmp(0));
} }
} }
Kind::CInt { value } => { Kind::CInt { value } => self.emit(match tys.size_of(node.ty) {
self.emit(instrs::li64(atr(allocs[0]), value as _)); 1 => instrs::li8(atr(allocs[0]), value as _),
} 2 => instrs::li16(atr(allocs[0]), value as _),
4 => instrs::li32(atr(allocs[0]), value as _),
_ => instrs::li64(atr(allocs[0]), value as _),
}),
Kind::Extend => { Kind::Extend => {
let base = fuc.nodes[node.inputs[1]].ty; let base = fuc.nodes[node.inputs[1]].ty;
let dest = node.ty; let dest = node.ty;