public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106517] New: RISC-V: Inefficient Generated Code for Floating Point to Integer Rounds
@ 2022-08-03 17:32 palmer at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: palmer at gcc dot gnu.org @ 2022-08-03 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106517
           Summary: RISC-V: Inefficient Generated Code for Floating Point
                    to Integer Rounds
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: palmer at gcc dot gnu.org
  Target Milestone: ---

RISC-V has a handful of floating-point conversion instructions that we don't
appear to be taking advantage of.  For example

long f(double in)
{
    return __builtin_floor(in);
}

generates a call to the floor() library routine, while I believe we can
implement in via just a "fcvt.l.d a0, fa0, rdn" (RISC-V clang and arm64 GCC). 
There are a bunch of similar patterns, the aarch64 test suite seems to have
pretty good coverage of them.

We should port those tests over to RISC-V, figure out which conversions we can
implement directly, and then fix whatever's broken.  I started poking around a
bit and found that even some of the conversions where we have MD file patterns
aren't behaving as expected, so there might be some deeper issue going on.

This has come up in a handful of forums lately and while we're still hoping to
find some time to look into it, I figured it'd be best to open at least a basic
bug so at least we can have one place to track the issues.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-03 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 17:32 [Bug target/106517] New: RISC-V: Inefficient Generated Code for Floating Point to Integer Rounds palmer at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).