machinst x64: implement float-to-int and int-to-float conversions;

This commit is contained in:
Benjamin Bouvier
2020-07-16 18:09:29 +02:00
parent 37a09c4ef6
commit cd54f05efd
5 changed files with 950 additions and 46 deletions

View File

@@ -332,7 +332,7 @@ pub(crate) enum InstructionSet {
/// Some scalar SSE operations requiring 2 operands r/m and r.
/// TODO: Below only includes scalar operations. To be seen if packed will be added here.
#[derive(Clone, PartialEq)]
#[derive(Clone, Copy, PartialEq)]
pub enum SseOpcode {
Addss,
Addsd,
@@ -797,3 +797,26 @@ impl BranchTarget {
}
}
}
/// An operand's size in bits.
#[derive(Clone, Copy, PartialEq)]
pub enum OperandSize {
Size32,
Size64,
}
impl OperandSize {
pub(crate) fn to_bytes(&self) -> u8 {
match self {
Self::Size32 => 4,
Self::Size64 => 8,
}
}
pub(crate) fn to_bits(&self) -> u8 {
match self {
Self::Size32 => 32,
Self::Size64 => 64,
}
}
}