This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[GSoC-19] Implementing narrowing functions like fadd
- From: Tejas Joshi <tejasjoshi9673 at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Martin Jambor <mjambor at suse dot cz>, hubicka at ucw dot cz, joseph at codesourcery dot com
- Date: Wed, 3 Jul 2019 18:29:26 +0530
- Subject: [GSoC-19] Implementing narrowing functions like fadd
Hello.
Functions like fadd, faddl take two arguments, do the addition and
return the answer in narrower precision than the argument type. The
thing that might be helpful is using the do_add function directly, if
appropriate?
The thing to consider about narrowed down return type is how it can be
achieved. The functions that operate on real numbers like real_round
and so on, do not consider the return type and do calculations on the
entire real number representation. So just defining these functions
and their return type in builtins.def and other appropriate places
would do the trick?
like:
BT_FN_FLOAT_DOUBLE_DOUBLE as return and argument type for FADD
Or it has to be narrowed down by zeroing down the trailing
out-of-precision bits?
Also, if the addition or any one of the argument exceeds the return
size, the integer part of the addition would not fit in the narrowed
type. Like, 2^32 would easily fit in double but will lose its least
significant bit in float and become 2^31. How these types are supposed
to be handled?
Thanks,
-Tejas