public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/24209] strange instruction selected for an annuled delay slot
Date: Thu, 18 Apr 2013 21:06:00 -0000	[thread overview]
Message-ID: <bug-24209-4-F13uGqSSLc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-24209-4@http.gcc.gnu.org/bugzilla/>


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-10-05 11:06:49         |2013-04-18 11:06:49
                 CC|gcc-bugs at gcc dot gnu.org |steven at gcc dot gnu.org

--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2013-04-18 21:06:17 UTC ---
Current trunk still picks that ldsb insn for the delay slot.
Here's what it produces:

        .file   "t.c"
        .section        ".text"
        .align 4
        .global PointToRowCol
        .type   PointToRowCol, #function
        .proc   020
PointToRowCol:
        sethi   %hi(term+4), %g1
        sethi   %hi(firstValidRow), %g2
        ld      [%g1+%lo(term+4)], %g1
        ld      [%g2+%lo(firstValidRow)], %g2
        ld      [%g1], %g4
        ld      [%g1+12], %g3
        sub     %o0, %g4, %o0
        sra     %o0, 31, %o5
        wr      %o5, 0, %y
        ld      [%g3+4], %o5
        nop
        nop
        sdiv    %o0, %o5, %o0
        cmp     %o0, %g2
        bl,a    .L12
         ldsb   [%g1+16], %o4
        sethi   %hi(lastValidRow), %o5
        ld      [%o5+%lo(lastValidRow)], %o5
        cmp     %o0, %o5
        bg      .L10
         mov    %o0, %g2
.L2:
        ldsb    [%g1+16], %o4
.L12:
        cmp     %o4, 0
        bne     .L4
         mov    0, %o5
        ld      [%g3+8], %o5
.L4:
        add     %o5, %g4, %g4
        sub     %o1, %g4, %o1
        sra     %o1, 31, %g4
        wr      %g4, 0, %y
        ld      [%g3], %g4
        nop
        nop
        sdiv    %o1, %g4, %o1
        cmp     %o1, 0
        bl,a    .L8
         st     %g2, [%o2]
        ld      [%g1+4], %g1
        add     %g1, 1, %g1
        cmp     %o1, %g1
        bg      .L11
         st     %g2, [%o2]
        jmp     %o7+8
         st     %o1, [%o3]
.L11:
        mov     %g1, %o1
        jmp     %o7+8
         st     %o1, [%o3]
.L10:
        b       .L2
         mov    %o5, %g2
.L8:
        mov     0, %o1
        jmp     %o7+8
         st     %o1, [%o3]
        .size   PointToRowCol, .-PointToRowCol
        .ident  "GCC: (GNU) 4.9.0 20130418 (experimental) [trunk revision
198052]"
        .section        .note.GNU-stack,"",@progbits


for this test case:

typedef char Boolean;

typedef struct {
  int width;
} SbInfo;

struct _vtwin {
  int f_width;
  int f_height;
  SbInfo sb_info;
};

typedef struct {
  int border;
  int max_col;
  struct _vtwin *whichVwin;
} TScreen;

typedef struct _Misc {
  Boolean useRight;
} Misc;

typedef struct _XtermWidgetRec {
  TScreen screen;
  Misc misc;
} XtermWidgetRec, *XtermWidget;

extern int firstValidRow, lastValidRow;

extern XtermWidget term;

void
PointToRowCol(int y, int x, int *r, int *c)
{
  TScreen *screen = &term->screen;
  int row, col;

  row = (y - screen->border) / screen->whichVwin->f_height;
  if (row < firstValidRow)
    row = firstValidRow;
  else if (row > lastValidRow)
    row = lastValidRow;
  col = (x - (((term->misc.useRight) ? 0 : screen->whichVwin->sb_info.width) +
screen->border) ) / screen->whichVwin->f_width;
  if (col < 0)
    col = 0;
  else if (col > screen->max_col + 1)
    col = screen->max_col + 1;

  *r = row;
  *c = col;
}

with options: "-mcpu=v8 -m32 -O2".


       reply	other threads:[~2013-04-18 21:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-24209-4@http.gcc.gnu.org/bugzilla/>
2013-04-18 21:06 ` steven at gcc dot gnu.org [this message]
2005-10-05  5:12 [Bug rtl-optimization/24209] New: strange instruction selected for an annuled slot on sparc dann at godzilla dot ics dot uci dot edu
2005-10-05 11:06 ` [Bug rtl-optimization/24209] strange instruction selected for an annuled delay slot ebotcazou at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-24209-4-F13uGqSSLc@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).