From fde1241ce928d38c2031c827ae0ddee5c6f5af0f Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Thu, 4 Jun 2026 16:36:52 -0700 Subject: Add abs, min, and max instructions --- lang/rust/pseudorust.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'lang/rust/pseudorust.cpp') diff --git a/lang/rust/pseudorust.cpp b/lang/rust/pseudorust.cpp index de1acae1..7c831e47 100644 --- a/lang/rust/pseudorust.cpp +++ b/lang/rust/pseudorust.cpp @@ -2434,6 +2434,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe case HLIL_CTZ: case HLIL_RBIT: case HLIL_CLS: + case HLIL_ABS: [&]() { const char* method; switch (instr.operation) @@ -2443,6 +2444,7 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe case HLIL_CLZ: method = "leading_zeros"; break; case HLIL_CTZ: method = "trailing_zeros"; break; case HLIL_RBIT: method = "reverse_bits"; break; + case HLIL_ABS: method = "abs"; break; default: method = "leading_sign_bits"; break; } GetExprText(instr.GetSourceExpr(), tokens, settings, MemberAndFunctionOperatorPrecedence); @@ -2455,6 +2457,30 @@ void PseudoRustFunction::GetExprText(const HighLevelILInstruction& instr, HighLe }(); break; + case HLIL_MINS: + case HLIL_MAXS: + case HLIL_MINU: + case HLIL_MAXU: + [&]() { + const char* method; + switch (instr.operation) + { + case HLIL_MINS: + case HLIL_MINU: method = "min"; break; + default: method = "max"; break; + } + const auto& twoOperand = instr.AsTwoOperand(); + GetExprText(twoOperand.GetLeftExpr(), tokens, settings, MemberAndFunctionOperatorPrecedence); + tokens.Append(TextToken, "."); + tokens.Append(OperationToken, method); + tokens.AppendOpenParen(); + GetExprText(twoOperand.GetRightExpr(), tokens, settings); + tokens.AppendCloseParen(); + if (exprType != InnerExpression) + tokens.AppendSemicolon(); + }(); + break; + case HLIL_FLOAT_CONV: [&]() { const auto srcExpr = instr.GetSourceExpr(); -- cgit v1.3.1