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

            Bug ID: 117163
           Summary: Missing macro to round to nearest floating-point value
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paul at hpkfft dot com
  Target Milestone: ---

Created attachment 59357
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59357&action=edit
Patch to add _MM_FROUND_TO_NEAREST_TIES_EVEN macro

A macro definition is needed to specify rounding to the nearest floating-point
value with ties rounding to even.  I suggest:
`_MM_FROUND_TO_NEAREST_TIES_EVEN`.

    Intrinsics such as `_mm512_add_round_ps` take a rounding mode argument to
specify the floating point rounding mode. This and similar instructions do NOT
round their result to an integer. Thus it is inappropriate for user code to
specify the existing `_MM_FROUND_TO_NEAREST_INT` when desiring to round to the
nearest floating point number.

    Note that some few instructions, e.g., `ROUNDPS`, do round to an integer,
so the existing macro definition ought not be deprecated.

    Note that IEEE Std 754-2019 for floating-point arithmetic specifies two
rounding direction attributes to nearest: `roundTiesToEven` and
`roundTiesToAway`. Also, it specifies three directed rounding attributes:
`roundTowardPositive`, `roundTowardNegative`, and `roundTowardZero`.

Reply via email to