|
|
|
@ -306,6 +306,39 @@ impl OpTrait for ArithOp { |
|
|
|
|
state.update_status(res); |
|
|
|
|
state.write(dst, res)?; |
|
|
|
|
} |
|
|
|
|
ArithOp::SignExtend32 { dst, src } => { |
|
|
|
|
state.clear_status(); |
|
|
|
|
let val = state.read(src)?; |
|
|
|
|
let res = if 0 != (val & 0x8000_0000) { |
|
|
|
|
0xFFFF_FFFF_0000_0000 | val |
|
|
|
|
} else { |
|
|
|
|
val |
|
|
|
|
}; |
|
|
|
|
state.update_status(res); |
|
|
|
|
state.write(dst, res)?; |
|
|
|
|
} |
|
|
|
|
ArithOp::SignExtend16 { dst, src } => { |
|
|
|
|
state.clear_status(); |
|
|
|
|
let val = state.read(src)?; |
|
|
|
|
let res = if 0 != (val & 0x8000) { |
|
|
|
|
0xFFFF_FFFF_FFFF_0000 | val |
|
|
|
|
} else { |
|
|
|
|
val |
|
|
|
|
}; |
|
|
|
|
state.update_status(res); |
|
|
|
|
state.write(dst, res)?; |
|
|
|
|
} |
|
|
|
|
ArithOp::SignExtend8 { dst, src } => { |
|
|
|
|
state.clear_status(); |
|
|
|
|
let val = state.read(src)?; |
|
|
|
|
let res = if 0 != (val & 0x80) { |
|
|
|
|
0xFFFF_FFFF_FFFF_FF00 | val |
|
|
|
|
} else { |
|
|
|
|
val |
|
|
|
|
}; |
|
|
|
|
state.update_status(res); |
|
|
|
|
state.write(dst, res)?; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Ok(eres) |
|
|
|
@ -362,6 +395,9 @@ impl OpTrait for ArithOp { |
|
|
|
|
ArithOp::Clo32 { dst, src } => to_sexp_1_or_2("clo32", dst, src), |
|
|
|
|
ArithOp::Clo16 { dst, src } => to_sexp_1_or_2("clo16", dst, src), |
|
|
|
|
ArithOp::Clo8 { dst, src } => to_sexp_1_or_2("clo8", dst, src), |
|
|
|
|
ArithOp::SignExtend32 { dst, src } => to_sexp_1_or_2("se32", dst, src), |
|
|
|
|
ArithOp::SignExtend16 { dst, src } => to_sexp_1_or_2("se16", dst, src), |
|
|
|
|
ArithOp::SignExtend8 { dst, src } => to_sexp_1_or_2("se8", dst, src), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|