..InstructionOutput::default()
})
}
+
+pub fn cmpd(inputs: InstructionInput) -> InstructionResult {
+ let ra = inputs.try_get_ra()? as i64;
+ let rb = inputs.try_get_rb()? as i64;
+ let so = inputs.try_get_overflow()?.so;
+ let cr0 = ConditionRegister::from_ordering(ra.cmp(&rb), so);
+ Ok(InstructionOutput {
+ cr0: Some(cr0),
+ ..InstructionOutput::default()
+ })
+}
+
+pub fn cmpw(inputs: InstructionInput) -> InstructionResult {
+ let ra = inputs.try_get_ra()? as i32;
+ let rb = inputs.try_get_rb()? as i32;
+ let so = inputs.try_get_overflow()?.so;
+ let cr0 = ConditionRegister::from_ordering(ra.cmp(&rb), so);
+ Ok(InstructionOutput {
+ cr0: Some(cr0),
+ ..InstructionOutput::default()
+ })
+}
+
+pub fn cmpld(inputs: InstructionInput) -> InstructionResult {
+ let ra = inputs.try_get_ra()? as u64;
+ let rb = inputs.try_get_rb()? as u64;
+ let so = inputs.try_get_overflow()?.so;
+ let cr0 = ConditionRegister::from_ordering(ra.cmp(&rb), so);
+ Ok(InstructionOutput {
+ cr0: Some(cr0),
+ ..InstructionOutput::default()
+ })
+}
+
+pub fn cmplw(inputs: InstructionInput) -> InstructionResult {
+ let ra = inputs.try_get_ra()? as u32;
+ let rb = inputs.try_get_rb()? as u32;
+ let so = inputs.try_get_overflow()?.so;
+ let cr0 = ConditionRegister::from_ordering(ra.cmp(&rb), so);
+ Ok(InstructionOutput {
+ cr0: Some(cr0),
+ ..InstructionOutput::default()
+ })
+}
fn cmplwi(Ra, ImmediateU16, Overflow) -> (CR0) {
"cmplwi"
}
+
+ // cmp
+ #[enumerant = CmpD]
+ fn cmpd(Ra, Rb, Overflow) -> (CR0) {
+ "cmpd"
+ }
+ #[enumerant = CmpW]
+ fn cmpw(Ra, Rb, Overflow) -> (CR0) {
+ "cmpw"
+ }
+
+ // cmpl
+ #[enumerant = CmpLD]
+ fn cmpld(Ra, Rb, Overflow) -> (CR0) {
+ "cmpld"
+ }
+ #[enumerant = CmpLW]
+ fn cmplw(Ra, Rb, Overflow) -> (CR0) {
+ "cmplw"
+ }
}
// must be after instrs macro call since it uses a macro definition