};
}
-// create_instr_variants_ov_cr!(add, addo, add_, addo_, i64);
-//
-// pub fn addo(inputs: InstructionInput) -> InstructionResult {
-// let ra = inputs.ra as i64;
-// let rb = inputs.rb as i64;
-// let (result, overflow) = ra.overflowing_add(rb);
-// let result = result as u64;
-// InstructionResult {
-// rt: Some(result),
-// overflow: Some(OverflowFlags::from_overflow(overflow)),
-// ..InstructionResult::default()
-// }
-// }
+create_instr_variants_ov_cr!(add, addo, add_, addo_, i64);
+
+pub fn addo(inputs: InstructionInput) -> InstructionResult {
+ let ra = inputs.ra as i64;
+ let rb = inputs.rb as i64;
+ let (result, ov) = ra.overflowing_add(rb);
+ let result = result as u64;
+ let ov32 = (ra as i32).overflowing_add(rb as i32).1;
+ InstructionResult {
+ rt: Some(result),
+ overflow: Some(OverflowFlags { so: ov, ov, ov32 }),
+ ..InstructionResult::default()
+ }
+}
create_instr_variants_ov_cr!(divde, divdeo, divde_, divdeo_, i64);
}
instrs! {
- // // add
- // #[enumerant = Add]
- // fn add(ra, rb) -> (rt) {
- // "add"
- // }
- // #[enumerant = AddO]
- // fn addo(ra, rb) -> (rt, ov) {
- // "addo"
- // }
- // #[enumerant = Add_]
- // fn add_(ra, rb) -> (rt, cr0) {
- // "add."
- // }
- // #[enumerant = AddO_]
- // fn addo_(ra, rb) -> (rt, ov, cr0) {
- // "addo."
- // }
+ // add
+ #[enumerant = Add]
+ fn add(ra, rb) -> (rt) {
+ "add"
+ }
+ #[enumerant = AddO]
+ fn addo(ra, rb) -> (rt, ov) {
+ "addo"
+ }
+ #[enumerant = Add_]
+ fn add_(ra, rb) -> (rt, cr0) {
+ "add."
+ }
+ #[enumerant = AddO_]
+ fn addo_(ra, rb) -> (rt, ov, cr0) {
+ "addo."
+ }
// divde
#[enumerant = DivDE]