summaryrefslogtreecommitdiff
path: root/lang/rust
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2026-06-04 16:36:52 -0700
committerMark Rowe <mark@vector35.com>2026-06-05 13:01:46 -0700
commitfde1241ce928d38c2031c827ae0ddee5c6f5af0f (patch)
tree6711a47863332712eb5324e2c3ef1dffb843bb5d /lang/rust
parentfa09f36b5f47ed690dc029fe9f1ed9ad4ebce7c8 (diff)
Add abs, min, and max instructions
Diffstat (limited to 'lang/rust')
-rw-r--r--lang/rust/pseudorust.cpp26
1 files changed, 26 insertions, 0 deletions
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<HLIL_FLOAT_CONV>();