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

            Bug ID: 126691
           Summary: Add roundeven to the rounding family lists
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: easyhack, missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

Two rules collapse a rounding function applied to an already integral value,
one for the function applied to itself and one for any integer valued
operand.  Both list six of the seven rounding functions.  roundeven, added as
a builtin in 2019, was never added to either

#include <math.h>
  double f (double x) { return __builtin_roundeven (__builtin_floor (x)); }
  double g (int n) { return __builtin_roundeven ((double) n); }

Clang for aarch64 generates just:
f:
        frintm  d0, d0
        ret

g:
        scvtf   d0, w0
        ret

Reply via email to