[Bug target/92488] GCC generates calls to __dpd_trunctdsd2 with -mhard-dfp

bergner at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 13 16:14:16 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92488

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> ---
So if I look at what we generate for:

_Decimal64
truncd128 (_Decimal128 d)
{
  return d;
}

and:

_Decimal32
truncd64(_Decimal64 d)
{
  return d;
}

We basically just get a drdpq for the first function and a drsp for the second
function.  Ie, they don't change the rounding mode at all.  If I modify your
test case slightly to insert an intermediate cast to _Decimal64 like so:

_Decimal32
truncd128 (_Decimal128 d)
{
  return (_Decimal64)d;
}

...then we get:

        drdpq 12,2
        fmr 1,12
        drsp 1,1
        blr

So is changing the rounding mode really required here when we go from
_Decimal128 directly to _Decimal32?  If so, do the other casts also need to be
inserting rounding mode changes too?  If not, why not?


More information about the Gcc-bugs mailing list