File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2352,6 +2352,30 @@ exprt c_typecheck_baset::do_special_functions(
2352
2352
2353
2353
return typecast_exprt::conditional_cast (isinf_expr, expr.type ());
2354
2354
}
2355
+ else if (identifier == " __builtin_isinf_sign" )
2356
+ {
2357
+ if (expr.arguments ().size () != 1 )
2358
+ {
2359
+ err_location (f_op);
2360
+ error () << identifier << " expects one operand" << eom;
2361
+ throw 0 ;
2362
+ }
2363
+
2364
+ // returns 1 for +inf and -1 for -inf, and 0 otherwise
2365
+
2366
+ const exprt &fp_value = expr.arguments ().front ();
2367
+
2368
+ isinf_exprt isinf_expr (fp_value);
2369
+ isinf_expr.add_source_location () = source_location;
2370
+
2371
+ return if_exprt (
2372
+ isinf_exprt (fp_value),
2373
+ if_exprt (
2374
+ sign_exprt (fp_value),
2375
+ from_integer (-1 , expr.type ()),
2376
+ from_integer (1 , expr.type ())),
2377
+ from_integer (0 , expr.type ()));
2378
+ }
2355
2379
else if (identifier==CPROVER_PREFIX " isnormalf" ||
2356
2380
identifier==CPROVER_PREFIX " isnormald" ||
2357
2381
identifier==CPROVER_PREFIX " isnormalld" )
You can’t perform that action at this time.
0 commit comments