@@ -96,6 +96,12 @@ static smt_sortt convert_type_to_smt_sort(const array_typet &type)
9696 convert_type_to_smt_sort (type.element_type ())};
9797}
9898
99+ static smt_sortt convert_type_to_smt_sort (const floatbv_typet &type)
100+ {
101+ // Convert floating-point to bitvector for bit-blasting
102+ return smt_bit_vector_sortt{type.get_width ()};
103+ }
104+
99105smt_sortt convert_type_to_smt_sort (const typet &type)
100106{
101107 if (const auto bool_type = type_try_dynamic_cast<bool_typet>(type))
@@ -104,6 +110,10 @@ smt_sortt convert_type_to_smt_sort(const typet &type)
104110 }
105111 if (const auto bitvector_type = type_try_dynamic_cast<bitvector_typet>(type))
106112 {
113+ if (const auto floatbv_type = type_try_dynamic_cast<floatbv_typet>(type))
114+ {
115+ return convert_type_to_smt_sort (*floatbv_type);
116+ }
107117 return convert_type_to_smt_sort (*bitvector_type);
108118 }
109119 if (const auto array_type = type_try_dynamic_cast<array_typet>(type))
@@ -182,13 +192,8 @@ static smt_termt make_bitvector_resize_cast(
182192 " type: " +
183193 to_type.pretty ());
184194 }
185- if (type_try_dynamic_cast<floatbv_typet>(to_type))
186- {
187- UNIMPLEMENTED_FEATURE (
188- " Generation of SMT formula for type cast to floating-point bitvector "
189- " type: " +
190- to_type.pretty ());
191- }
195+ // After float lowering, floatbv types are treated as bitvectors.
196+ // Same-width casts (e.g., from float_bvt::pack) are handled below.
192197 const std::size_t from_width = from_type.get_width ();
193198 const std::size_t to_width = to_type.get_width ();
194199 if (to_width == from_width)
@@ -272,8 +277,11 @@ static smt_termt convert_expr_to_smt(
272277 const floatbv_typecast_exprt &float_cast,
273278 const sub_expression_mapt &converted)
274279{
275- UNIMPLEMENTED_FEATURE (
276- " Generation of SMT formula for floating point type cast expression: " +
280+ // Floating-point operations should be lowered to bitvector operations
281+ // before reaching this point. If we get here, it means the lowering failed.
282+ UNREACHABLE_BECAUSE (
283+ " Floating point type cast expression should have been lowered to "
284+ " bitvector operations: " +
277285 float_cast.pretty ());
278286}
279287
@@ -535,17 +543,19 @@ static smt_termt convert_expr_to_smt(
535543 const ieee_float_equal_exprt &float_equal,
536544 const sub_expression_mapt &converted)
537545{
538- UNIMPLEMENTED_FEATURE (
539- " Generation of SMT formula for floating point equality expression: " +
546+ UNREACHABLE_BECAUSE (
547+ " Floating point equality expression should have been lowered to "
548+ " bitvector operations: " +
540549 float_equal.pretty ());
541550}
542551
543552static smt_termt convert_expr_to_smt (
544553 const ieee_float_notequal_exprt &float_not_equal,
545554 const sub_expression_mapt &converted)
546555{
547- UNIMPLEMENTED_FEATURE (
548- " Generation of SMT formula for floating point not equal expression: " +
556+ UNREACHABLE_BECAUSE (
557+ " Floating point not equal expression should have been lowered to "
558+ " bitvector operations: " +
549559 float_not_equal.pretty ());
550560}
551561
@@ -785,8 +795,9 @@ static smt_termt convert_expr_to_smt(
785795{
786796 // This case includes the floating point plus, minus, division and
787797 // multiplication operations.
788- UNIMPLEMENTED_FEATURE (
789- " Generation of SMT formula for floating point operation expression: " +
798+ UNREACHABLE_BECAUSE (
799+ " Floating point operation expression should have been lowered to "
800+ " bitvector operations: " +
790801 float_operation.pretty ());
791802}
792803
@@ -1158,35 +1169,39 @@ static smt_termt convert_expr_to_smt(
11581169 const isnan_exprt &is_nan_expr,
11591170 const sub_expression_mapt &converted)
11601171{
1161- UNIMPLEMENTED_FEATURE (
1162- " Generation of SMT formula for is not a number expression: " +
1172+ UNREACHABLE_BECAUSE (
1173+ " Is not a number expression should have been lowered to "
1174+ " bitvector operations: " +
11631175 is_nan_expr.pretty ());
11641176}
11651177
11661178static smt_termt convert_expr_to_smt (
11671179 const isfinite_exprt &is_finite_expr,
11681180 const sub_expression_mapt &converted)
11691181{
1170- UNIMPLEMENTED_FEATURE (
1171- " Generation of SMT formula for is finite expression: " +
1182+ UNREACHABLE_BECAUSE (
1183+ " Is finite expression should have been lowered to "
1184+ " bitvector operations: " +
11721185 is_finite_expr.pretty ());
11731186}
11741187
11751188static smt_termt convert_expr_to_smt (
11761189 const isinf_exprt &is_infinite_expr,
11771190 const sub_expression_mapt &converted)
11781191{
1179- UNIMPLEMENTED_FEATURE (
1180- " Generation of SMT formula for is infinite expression: " +
1192+ UNREACHABLE_BECAUSE (
1193+ " Is infinite expression should have been lowered to "
1194+ " bitvector operations: " +
11811195 is_infinite_expr.pretty ());
11821196}
11831197
11841198static smt_termt convert_expr_to_smt (
11851199 const isnormal_exprt &is_normal_expr,
11861200 const sub_expression_mapt &converted)
11871201{
1188- UNIMPLEMENTED_FEATURE (
1189- " Generation of SMT formula for is infinite expression: " +
1202+ UNREACHABLE_BECAUSE (
1203+ " Is normal expression should have been lowered to "
1204+ " bitvector operations: " +
11901205 is_normal_expr.pretty ());
11911206}
11921207
0 commit comments