namespace theory {
namespace fp {
-namespace removeToFPGeneric {
-
-Node removeToFPGeneric(TNode node)
-{
- Assert(node.getKind() == kind::FLOATINGPOINT_TO_FP_GENERIC);
-
- FloatingPointToFPGeneric info =
- node.getOperator().getConst<FloatingPointToFPGeneric>();
-
- size_t children = node.getNumChildren();
-
- Node op;
- NodeManager* nm = NodeManager::currentNM();
-
- if (children == 1)
- {
- op = nm->mkConst(FloatingPointToFPIEEEBitVector(info));
- return nm->mkNode(op, node[0]);
- }
- Assert(children == 2);
- Assert(node[0].getType().isRoundingMode());
-
- TypeNode t = node[1].getType();
-
- if (t.isFloatingPoint())
- {
- op = nm->mkConst(FloatingPointToFPFloatingPoint(info));
- }
- else if (t.isReal())
- {
- op = nm->mkConst(FloatingPointToFPReal(info));
- }
- else
- {
- Assert(t.isBitVector());
- op = nm->mkConst(FloatingPointToFPSignedBitVector(info));
- }
-
- return nm->mkNode(op, node[0], node[1]);
-}
-} // namespace removeToFPGeneric
-
FpExpandDefs::FpExpandDefs(context::UserContext* u)
:
Node res = node;
Kind kind = node.getKind();
- if (kind == kind::FLOATINGPOINT_TO_FP_GENERIC)
- {
- res = removeToFPGeneric::removeToFPGeneric(node);
- }
- else if (kind == kind::FLOATINGPOINT_MIN)
+ if (kind == kind::FLOATINGPOINT_MIN)
{
res = NodeManager::currentNM()->mkNode(
kind::FLOATINGPOINT_MIN_TOTAL, node[0], node[1], minUF(node));
<< ") found in expression?";
}
+ RewriteResponse removeToFPGeneric(TNode node, bool isPreRewrite)
+ {
+ Assert(!isPreRewrite);
+ Assert(node.getKind() == kind::FLOATINGPOINT_TO_FP_GENERIC);
+
+ FloatingPointToFPGeneric info =
+ node.getOperator().getConst<FloatingPointToFPGeneric>();
+
+ uint32_t children = node.getNumChildren();
+
+ Node op;
+ NodeManager* nm = NodeManager::currentNM();
+
+ if (children == 1)
+ {
+ op = nm->mkConst(FloatingPointToFPIEEEBitVector(info));
+ return RewriteResponse(REWRITE_AGAIN, nm->mkNode(op, node[0]));
+ }
+ Assert(children == 2);
+ Assert(node[0].getType().isRoundingMode());
+
+ TypeNode t = node[1].getType();
+
+ if (t.isFloatingPoint())
+ {
+ op = nm->mkConst(FloatingPointToFPFloatingPoint(info));
+ }
+ else if (t.isReal())
+ {
+ op = nm->mkConst(FloatingPointToFPReal(info));
+ }
+ else
+ {
+ Assert(t.isBitVector());
+ op = nm->mkConst(FloatingPointToFPSignedBitVector(info));
+ }
+
+ return RewriteResponse(REWRITE_AGAIN, nm->mkNode(op, node[0], node[1]));
+ }
+
RewriteResponse removeDoubleNegation(TNode node, bool isPreRewrite)
{
Assert(node.getKind() == kind::FLOATINGPOINT_NEG);
rewrite::toFPSignedBV;
d_postRewriteTable[kind::FLOATINGPOINT_TO_FP_UNSIGNED_BITVECTOR] =
rewrite::identity;
- d_postRewriteTable[kind::FLOATINGPOINT_TO_FP_GENERIC] = rewrite::identity;
+ d_postRewriteTable[kind::FLOATINGPOINT_TO_FP_GENERIC] =
+ rewrite::removeToFPGeneric;
d_postRewriteTable[kind::FLOATINGPOINT_TO_UBV] = rewrite::identity;
d_postRewriteTable[kind::FLOATINGPOINT_TO_SBV] = rewrite::identity;
d_postRewriteTable[kind::FLOATINGPOINT_TO_REAL] = rewrite::identity;
regress0/fp/issue3619.smt2
regress0/fp/issue4277-assign-func.smt2
regress0/fp/issue5511.smt2
+ regress0/fp/issue5734.smt2
regress0/fp/issue6164.smt2
regress0/fp/rti_3_5_bug.smt2
regress0/fp/simple.smt2
+; REQUIRES: symfpu
; EXPECT: unsat
(set-logic QF_FP)
(declare-fun bv () (_ BitVec 1))
+; REQUIRES: symfpu
; EXPECT: sat
(set-logic QF_FP)
(declare-fun a () (_ FloatingPoint 53 11))
--- /dev/null
+; REQUIRES: symfpu
+; EXPECT: sat
+(set-logic QF_FP)
+(declare-fun a () RoundingMode)
+(declare-fun b () (_ FloatingPoint 8 24))
+(assert (= b (fp.add a b (fp.add a ((_ to_fp 8 24) a ((_ to_fp 8 24) a 0)) b))))
+(check-sat)
+; REQUIRES: symfpu
; EXPECT: sat
; EXPECT: ((((_ to_fp 5 11) roundNearestTiesToAway (/ 1 10)) (fp #b0 #b01011 #b1001100110)))
(set-logic ALL)