From 331bfd4e4a648de8aba4fefd8301703a6a3440c9 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 2 Feb 2018 18:02:57 -0500 Subject: Add rounding instructions --- mediumlevelilinstruction.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'mediumlevelilinstruction.cpp') diff --git a/mediumlevelilinstruction.cpp b/mediumlevelilinstruction.cpp index 7e1e663f..c4800837 100644 --- a/mediumlevelilinstruction.cpp +++ b/mediumlevelilinstruction.cpp @@ -215,6 +215,10 @@ unordered_map> {MLIL_FLOAT_TO_INT, {SourceExprMediumLevelOperandUsage}}, {MLIL_INT_TO_FLOAT, {SourceExprMediumLevelOperandUsage}}, {MLIL_FLOAT_CONV, {SourceExprMediumLevelOperandUsage}}, + {MLIL_ROUND_TO_INT, {SourceExprMediumLevelOperandUsage}}, + {MLIL_FLOOR, {SourceExprMediumLevelOperandUsage}}, + {MLIL_CEIL, {SourceExprMediumLevelOperandUsage}}, + {MLIL_FTRUNC, {SourceExprMediumLevelOperandUsage}}, {MLIL_FCMP_E, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}}, {MLIL_FCMP_NE, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}}, {MLIL_FCMP_LT, {LeftExprMediumLevelOperandUsage, RightExprMediumLevelOperandUsage}}, @@ -1300,6 +1304,10 @@ void MediumLevelILInstruction::VisitExprs(const std::functionAddExprWithLocation(operation, *this, size, subExprHandler(AsOneOperand().GetSourceExpr())); case MLIL_ADD: @@ -2731,6 +2743,30 @@ ExprId MediumLevelILFunction::FloatConvert(size_t size, ExprId a, const ILSource } +ExprId MediumLevelILFunction::RoundToInt(size_t size, ExprId a, const ILSourceLocation& loc) +{ + return AddExprWithLocation(MLIL_ROUND_TO_INT, loc, size, a); +} + + +ExprId MediumLevelILFunction::Floor(size_t size, ExprId a, const ILSourceLocation& loc) +{ + return AddExprWithLocation(MLIL_FLOOR, loc, size, a); +} + + +ExprId MediumLevelILFunction::Ceil(size_t size, ExprId a, const ILSourceLocation& loc) +{ + return AddExprWithLocation(MLIL_CEIL, loc, size, a); +} + + +ExprId MediumLevelILFunction::FloatTrunc(size_t size, ExprId a, const ILSourceLocation& loc) +{ + return AddExprWithLocation(MLIL_FTRUNC, loc, size, a); +} + + ExprId MediumLevelILFunction::FloatCompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc) { return AddExprWithLocation(MLIL_FCMP_E, loc, size, a, b); -- cgit v1.3.1