public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/26525]  New: missed opportunity to use value in fp reg
@ 2006-03-02  2:40 amodra at bigpond dot net dot au
  2006-03-02  3:07 ` [Bug target/26525] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: amodra at bigpond dot net dot au @ 2006-03-02  2:40 UTC (permalink / raw)
  To: gcc-bugs

The following compiled with -m64 -O2 -S

double f1 (double xh)
{
  long long hi = (long long) xh;

  if (hi == __LONG_LONG_MAX__)
    {
      xh += -__LONG_LONG_MAX__ - 1;
      xh += 1.0;
    }
  else
    xh -= hi;

  return xh;
}

generates

        fctidz 0,1
        li 0,-1
        rldicl 0,0,0,1
        stfd 0,-16(1)
        ld 9,-16(1)
        cmpd 7,9,0
        beq 7,.L7
        std 9,-16(1)    #
        nop             #
        nop             #
        nop             #
        lfd 13,-16(1)   #
        fcfid 0,13      #
        fsub 1,1,0
        blr
        .p2align 4,,15
.L7:
        lfs 0,.LC1@toc(2)
        lfs 13,.LC3@toc(2)
        fsub 0,1,0
        fadd 1,0,13
        blr

The sequence marked with # could be replaced with just one insn,
        fcfid 0,0
because HI is in fr0 at that point.

A similar function

double f2 (double xh)
{
  long long hi = (long long) xh;

  xh -= hi;
  if (hi == __LONG_LONG_MAX__)
    {
      xh += hi;
      xh += -__LONG_LONG_MAX__ - 1;
      xh += 1.0;
    }

  return xh;
}

does use the value in th fp reg

        fctidz 0,1
        li 0,-1
        rldicl 0,0,0,1
        stfd 0,-16(1)
        fcfid 0,0       <== here
        fsub 1,1,0
        ld 9,-16(1)
        cmpd 7,9,0
        bnelr 7
        fadd 0,0,1
        lfs 13,.LC5@toc(2)
        lfs 12,.LC7@toc(2)
        fsub 0,0,13
        fadd 1,0,12
        blr


-- 
           Summary: missed opportunity to use value in fp reg
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at bigpond dot net dot au
GCC target triplet: powerpc64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26525


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-14  3:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02  2:40 [Bug target/26525] New: missed opportunity to use value in fp reg amodra at bigpond dot net dot au
2006-03-02  3:07 ` [Bug target/26525] " pinskia at gcc dot gnu dot org
2006-06-23  1:41 ` pinskia at gcc dot gnu dot org
2007-10-23 17:13 ` pinskia at gcc dot gnu dot org
2008-09-14  3:28 ` pinskia at gcc dot gnu dot org
2009-05-14  3:19 ` bje at gcc dot gnu dot 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).