[Bug tree-optimization/126691] New: Add roundeven to the rounding family lists

"ktkachov at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.