Skip to content

Commit b50c8c9

Browse files
committed
Implement arity and string conversions to FP operations
1 parent b2e7442 commit b50c8c9

1 file changed

Lines changed: 66 additions & 2 deletions

File tree

src/ops.cpp

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,39 @@ const std::unordered_map<PrimOp, std::string> primop2str(
106106
{ Exists, "exists" },
107107
{ Apply_Selector, "apply_selector" },
108108
{ Apply_Tester, "apply_tester" },
109-
{ Apply_Constructor, "apply_constructor" } });
109+
{ Apply_Constructor, "apply_constructor" },
110+
{ FPEq, "fp.eq" },
111+
{ FPAbs, "fp.abs" },
112+
{ FPNeg, "fp.neg" },
113+
{ FPAdd, "fp.add" },
114+
{ FPSub, "fp.sub" },
115+
{ FPMul, "fp.mul" },
116+
{ FPDiv, "fp.div" },
117+
{ FPFma, "fp.fma" },
118+
{ FPSqrt, "fp.sqrt" },
119+
{ FPRem, "fp.rem" },
120+
{ FPRti, "fp.roundToIntegral" },
121+
{ FPMin, "fp.min" },
122+
{ FPMax, "fp.max" },
123+
{ FPLeq, "fp.leq" },
124+
{ FPLt, "fp.lt" },
125+
{ FPGeq, "fp.geq" },
126+
{ FPGt, "fp.gt" },
127+
{ FPIsNormal, "fp.isNormal" },
128+
{ FPIsSubNormal, "fp.isSubnormal" },
129+
{ FPIsZero, "fp.isZero" },
130+
{ FPIsInf, "fp.isInfinite" },
131+
{ FPIsNan, "fp.isNaN" },
132+
{ FPIsNeg, "fp.isNegative" },
133+
{ FPIsPos, "fp.isPositive" },
134+
{ IEEEBV_To_FP, "to_fp" },
135+
{ FP_To_FP, "to_fp" },
136+
{ Real_To_FP, "to_fp" },
137+
{ SBV_To_FP, "to_fp" },
138+
{ UBV_To_FP, "to_fp_unsigned" },
139+
{ FP_To_UBV, "fp.to_ubv" },
140+
{ FP_To_SBV, "fp.to_sbv" },
141+
{ FP_To_REAL, "fp.to_real" } });
110142

111143
// a map from PrimOp to <minimum arity, maximum arity>
112144
// TODO: support INT_MAX arity for those that allow it in SMT-LIB
@@ -207,7 +239,39 @@ const std::unordered_map<PrimOp, std::pair<size_t, size_t>> primop2arity(
207239
{ Exists, { 2, 2 } },
208240
{ Apply_Selector, { 2, 2 } },
209241
{ Apply_Tester, { 2, 2 } },
210-
{ Apply_Constructor, { 2, INT_MAX } } });
242+
{ Apply_Constructor, { 2, INT_MAX } },
243+
{ FPEq, {2, 2} },
244+
{ FPAbs, {1, 1} },
245+
{ FPNeg, {1, 1} },
246+
{ FPAdd, {3, 3} },
247+
{ FPSub, {3, 3} },
248+
{ FPMul, {3, 3} },
249+
{ FPDiv, {3, 3} },
250+
{ FPFma, {4, 4} },
251+
{ FPSqrt, {2, 2} },
252+
{ FPRem, {2, 2} },
253+
{ FPRti, {2, 2} },
254+
{ FPMin, {2, 2} },
255+
{ FPMax, {2, 2} },
256+
{ FPLeq, {2, 2} },
257+
{ FPLt, {2, 2} },
258+
{ FPGeq, {2, 2} },
259+
{ FPGt, {2, 2} },
260+
{ FPIsNormal, {1, 1} },
261+
{ FPIsSubNormal, {1, 1} },
262+
{ FPIsZero, {1, 1} },
263+
{ FPIsInf, {1, 1} },
264+
{ FPIsNan, {1, 1} },
265+
{ FPIsNeg, {1, 1} },
266+
{ FPIsPos, {1, 1} },
267+
{ IEEEBV_To_FP, {2, 2} },
268+
{ FP_To_FP, {2, 2} },
269+
{ Real_To_FP, {2, 2} },
270+
{ SBV_To_FP, {2, 2} },
271+
{ UBV_To_FP, {2, 2} },
272+
{ FP_To_UBV, {2, 2} },
273+
{ FP_To_SBV, {2, 2} },
274+
{ FP_To_REAL, {1, 1} } });
211275

212276
std::string to_string(PrimOp op)
213277
{

0 commit comments

Comments
 (0)