]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000, add overloaded DFP quantize support
authorCarl Love <cel@us.ibm.com>
Tue, 29 Aug 2023 15:19:40 +0000 (11:19 -0400)
committerCarl Love <cel@us.ibm.com>
Tue, 29 Aug 2023 15:20:35 +0000 (11:20 -0400)
commit14a3839c63d550957556d70e824a8293938646e6
tree99190c65d6e0f47651f48036c42f1226ca1b238e
parentf687fc1ff6d4a44db87a35e9e3be7f20425bdacc
rs6000, add overloaded DFP quantize support

Add decimal floating point (DFP) quantize built-ins for both 64-bit DFP
and 128-DFP operands.  In each case, there is an immediate version and a
variable version of the built-in.  The RM value is a 2-bit constant int
which specifies the rounding mode to use.  For the immediate versions of
the built-in, the TE field is a 5-bit constant that specifies the value of
the ideal exponent for the result.  The built-in specifications are:

  __Decimal64 builtin_dfp_quantize (_Decimal64, _Decimal64,
    const int RM)
  __Decimal64 builtin_dfp_quantize (const int TE, _Decimal64,
    const int RM)
  __Decimal128 builtin_dfp_quantize (_Decimal128, _Decimal128,
     const int RM)
  __Decimal128 builtin_dfp_quantize (const int TE, _Decimal128,
     const int RM)

A testcase is added for the new built-in definitions.

gcc/ChangeLog:
* config/rs6000/dfp.md (UNSPEC_DQUAN): New unspec.
(dfp_dqua_<mode>, dfp_dquai_<mode>): New define_insn.
* config/rs6000/rs6000-builtins.def (__builtin_dfp_dqua,
__builtin_dfp_dquai, __builtin_dfp_dquaq, __builtin_dfp_dquaqi):
New buit-in definitions.
* config/rs6000/rs6000-overload.def (__builtin_dfp_quantize): New
overloaded definition.
* doc/extend.texi: Add documentation for __builtin_dfp_quantize.

gcc/testsuite/
* gcc.target/powerpc/pr93448.c: New test case.

PR target/93448
gcc/config/rs6000/dfp.md
gcc/config/rs6000/rs6000-builtins.def
gcc/config/rs6000/rs6000-overload.def
gcc/doc/extend.texi
gcc/testsuite/gcc.target/powerpc/pr93448.c [new file with mode: 0644]