public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/51374] [avr] insn combine reorders volatile memory accesses
Date: Thu, 01 Dec 2011 10:08:00 -0000	[thread overview]
Message-ID: <bug-51374-4-1LhA97xQo7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51374-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-12-01 10:08:05 UTC ---
ALso notice, that with the following test case that reads status *after* data

typedef unsigned char uint8_t;

void __vector_18(void)
{
    unsigned char data = (*(volatile uint8_t *)((0x0C) + 0x20));
    unsigned char status = (*(volatile uint8_t *)((0x0B) + 0x20));
    static int slot;

    if (status & 0x10)
    {
        if (slot == (-2))
        {
            slot ++;
        }
    }
}


then *no* SBIS/SBIC instruction is produced:

__vector_18:
    in r24,0xc     ;  6    movqi_insn/4    [length = 1]
    in r24,0xb     ;  8    movqi_insn/4    [length = 1]
    sbrs r24,4     ;  11    *sbrx_branchqi    [length = 2]
    rjmp .L1
...

and combine says:

Trying 9, 10 -> 11:
Successfully matched this instruction:
(set (pc)
    (if_then_else (eq (zero_extract:QI (reg/v:QI 44 [ status ])
                (const_int 1 [0x1])
                (const_int 4 [0x4]))
            (const_int 0 [0]))
        (label_ref:HI 21)
        (pc)))
deferring deletion of insn with uid = 10.
deferring deletion of insn with uid = 9.
modifying insn i3    11 pc={(zero_extract(r44:QI,0x1,0x4)==0)?L21:pc}
      REG_DEAD: r44:QI
      REG_BR_PROB: 0xf3c
deferring rescan insn with uid = 11.

Trying 8 -> 11:
Failed to match this instruction:
(set (pc)
    (if_then_else (eq (zero_extract:QI (mem/v:QI (const_int 43 [0x2b]) [0
MEM[(volatile uint8_t *)43B]+0 S1 A8])
                (const_int 1 [0x1])
                (const_int 4 [0x4]))
            (const_int 0 [0]))
        (label_ref:HI 21)
        (pc)))


  parent reply	other threads:[~2011-12-01 10:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01  5:01 [Bug c/51374] New: Volatile access reordered andyw at pobox dot com
2011-12-01  9:58 ` [Bug rtl-optimization/51374] [avr] insn combine reorders volatile memory accesses gjl at gcc dot gnu.org
2011-12-01  9:59 ` gjl at gcc dot gnu.org
2011-12-01 10:08 ` gjl at gcc dot gnu.org [this message]
2011-12-01 13:23 ` andyw at pobox dot com
2011-12-08 16:48 ` gjl at gcc dot gnu.org
2011-12-18 20:11 ` gjl at gcc dot gnu.org
2012-01-13 16:00 ` gjl at gcc dot gnu.org
2012-01-13 16:18 ` gjl at gcc dot gnu.org
2012-02-01 11:36 ` gjl at gcc dot gnu.org
2012-02-01 12:41 ` gjl at gcc dot gnu.org
2012-02-01 12:47 ` gjl at gcc dot gnu.org
2012-02-01 12:57 ` gjl at gcc dot gnu.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-51374-4-1LhA97xQo7@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).