Skip to content

Commit

Permalink
Merge pull request #8539 from diffblue/smt2-rounding-modes
Browse files Browse the repository at this point in the history
SMT2 parser: add abbreviated versions of the rounding modes
  • Loading branch information
kroening authored Jan 2, 2025
2 parents 6dc6dd5 + 03ac764 commit 1102fa1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/solvers/smt2/smt2_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,25 +1088,49 @@ void smt2_parsert::setup_expressions()
return from_integer(ieee_floatt::ROUND_TO_EVEN, unsignedbv_typet(32));
};

expressions["RNE"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_EVEN, unsignedbv_typet(32));
};

expressions["roundNearestTiesToAway"] = [this]() -> exprt {
throw error("unsupported rounding mode");
};

expressions["RNA"] = [this]() -> exprt {
throw error("unsupported rounding mode");
};

expressions["roundTowardPositive"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_PLUS_INF, unsignedbv_typet(32));
};

expressions["RTP"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_PLUS_INF, unsignedbv_typet(32));
};

expressions["roundTowardNegative"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_MINUS_INF, unsignedbv_typet(32));
};

expressions["RTN"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_MINUS_INF, unsignedbv_typet(32));
};

expressions["roundTowardZero"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_ZERO, unsignedbv_typet(32));
};

expressions["RTZ"] = [] {
// we encode as 32-bit unsignedbv
return from_integer(ieee_floatt::ROUND_TO_ZERO, unsignedbv_typet(32));
};

expressions["lambda"] = [this] { return lambda_expression(); };
expressions["let"] = [this] { return let_expression(); };
expressions["exists"] = [this] { return quantifier_expression(ID_exists); };
Expand Down

0 comments on commit 1102fa1

Please sign in to comment.