From dd56b5fb73f85bcb73094097cfe35a402c1d8628 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 25 Oct 2021 00:52:58 -0700 Subject: csneg/csinv aliases --- src/armv8/a64.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/armv8/a64.rs b/src/armv8/a64.rs index 9e2afcc..52c90bc 100644 --- a/src/armv8/a64.rs +++ b/src/armv8/a64.rs @@ -736,6 +736,13 @@ impl Display for Instruction { write!(fmt, "csel")?; } Opcode::CSNEG => { + if let (Operand::Register(size, rn), Operand::Register(_size, rm), Operand::ConditionCode(cond)) = (self.operands[1], self.operands[2], self.operands[3]) { + if rn == rm { + return write!(fmt, "cneg {}, {}, {}", self.operands[0], self.operands[2], Operand::ConditionCode(cond ^ 0x01)); + } + } else { + unreachable!("operands 2 and 3 are always registers"); + } write!(fmt, "csneg")?; } Opcode::CSINC => { @@ -758,6 +765,8 @@ impl Display for Instruction { (Operand::Register(_, n), Operand::Register(_, m), Operand::ConditionCode(cond)) => { if n == m && n != 31 && cond < 0b1110 { return write!(fmt, "cinv {}, {}, {}", self.operands[0], self.operands[1], Operand::ConditionCode(cond ^ 0x01)) + } else if n == m && n == 31 { + return write!(fmt, "csetm {}, {}", self.operands[0], Operand::ConditionCode(cond ^ 0x01)); } } _ => {} -- cgit v1.1