public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/58945] New: Improve atomic_compare_and_swap*_doubleword pattern
Date: Thu, 31 Oct 2013 19:25:00 -0000	[thread overview]
Message-ID: <bug-58945-4@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 11362 bytes --]

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

            Bug ID: 58945
           Summary: Improve atomic_compare_and_swap*_doubleword pattern
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com

Created attachment 31126
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31126&action=edit
Patch to simplify atomic_compare_and_swap<dwi>_doubleword pattern

Currently, gcc generates lots of unnecessary moves for following testcase
(actually gcc.dg/atomic-store-6.c):

--cut here--
__int128_t i;

int main()
{
  __atomic_store_16(&i, -1, 0);
  if (i != -1)
    __builtin_abort();
  return 0;
}
--cut here--

gcc -O2 -mcx16:

        movq    i(%rip), %rsi
        movq    $-1, %rcx
        movq    i+8(%rip), %rdi
.L2:
        movq    %rsi, %rax
        movq    %rdi, %rdx
        movq    %rcx, %rbx
        lock cmpxchg16b i(%rip)
        movq    %rdx, %rdi
        movq    %rax, %rsi
        jne     .L2

I have experimented with sync x86_64 pattern, to see if we can simplify
atomic_compare_and_swap<dwi>_doubleword pattern, so it would work with real
doublemode values and this way remove unnecessary register moves. However, I
have hit an ICE in assing_by_spills that prevents me from using these
simplifications:

gcc -O2 -mcx16

atomic-store-6.c: In function ‘main’:
atomic-store-6.c:13:1: internal compiler error: in assign_by_spills,
at lra-assigns.c:1281
 }
 ^
0x883e7f assign_by_spills
        ../../gcc-svn/trunk/gcc/lra-assigns.c:1281
0x884320 lra_assign()
        ../../gcc-svn/trunk/gcc/lra-assigns.c:1439
Please submit a full bug report,

I believe that the pattern is correct, and LRA is tripping on some
unknown issue.
>From gcc-bugs-return-433209-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Oct 31 19:26:59 2013
Return-Path: <gcc-bugs-return-433209-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30991 invoked by alias); 31 Oct 2013 19:26:59 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 30961 invoked by uid 48); 31 Oct 2013 19:26:56 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/58945] Improve atomic_compare_and_swap*_doubleword pattern
Date: Thu, 31 Oct 2013 19:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cf_gcctarget bug_status cf_reconfirmed_on cc everconfirmed bug_severity
Message-ID: <bug-58945-4-LsN3jJjh6M@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58945-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58945-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg02353.txt.bz2
Content-length: 692

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-31
                 CC|                            |vmakarov at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed as an enhancement.
>From gcc-bugs-return-433210-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Oct 31 20:25:32 2013
Return-Path: <gcc-bugs-return-433210-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11719 invoked by alias); 31 Oct 2013 20:25:31 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11672 invoked by uid 48); 31 Oct 2013 20:25:26 -0000
From: "octoploid at yandex dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/58946] New: [4.9 Regression] internal compiler error: in operator[], at vec.h:722
Date: Thu, 31 Oct 2013 20:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: octoploid at yandex dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58946-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg02354.txt.bz2
Content-length: 2249

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

            Bug ID: 58946
           Summary: [4.9 Regression] internal compiler error: in
                    operator[], at vec.h:722
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: octoploid at yandex dot com

Building dev-util/kdevplatform-1.5.2 ICEs.

markus@x4 tmp % cat test.ii
class A {
public:
  A(int p1) : m_index(p1) {
    if (!p1)
      m_index = DummyMask;
  }
  enum {
    DummyMask = 1 << 31
  };
  unsigned m_fn1() const {
    int a;
    a = m_index & DummyMask;
    if (a)
      return 0;
    return m_index;
  }
  unsigned m_index;
};

class B {
public:
  int contains___trans_tmp_4;
  void m_fn1(int &p1) {
    const A &b = p1;
    contains___trans_tmp_4 = b.m_fn1();
  }
};
void fn1(A p1, B &p2) {
  int c;
  c = p1.m_fn1();
  p2.m_fn1(c);
}

markus@x4 tmp % g++ -c -O2 test.ii
test.ii: In function ‘void fn1(A, B&)’:
test.ii:28:6: internal compiler error: in operator[], at vec.h:722
 void fn1(A p1, B &p2) {
      ^
0xc819a7 vec<operand_entry*, va_heap, vl_embed>::operator[](unsigned int)
        ../../gcc/gcc/vec.h:722
0xc84207 vec<operand_entry*, va_heap, vl_embed>::operator[](unsigned int)
        ../../gcc/gcc/tree.h:2806
0xc84207 vec<operand_entry*, va_heap, vl_ptr>::operator[](unsigned int)
        ../../gcc/gcc/vec.h:1152
0xc84207 update_ops
        ../../gcc/gcc/tree-ssa-reassoc.c:2619
0xc8c1fa maybe_optimize_range_tests
        ../../gcc/gcc/tree-ssa-reassoc.c:2907
0xc8c1fa reassociate_bb
        ../../gcc/gcc/tree-ssa-reassoc.c:4325
0xc8b927 reassociate_bb
        ../../gcc/gcc/tree-ssa-reassoc.c:4482
0xc8b927 reassociate_bb
        ../../gcc/gcc/tree-ssa-reassoc.c:4482
0xc8e2db do_reassoc
        ../../gcc/gcc/tree-ssa-reassoc.c:4515
0xc8e2db execute_reassoc
        ../../gcc/gcc/tree-ssa-reassoc.c:4597
0xc8e2db execute
        ../../gcc/gcc/tree-ssa-reassoc.c:4639
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

Looks related to PR58911.
>From gcc-bugs-return-433211-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Oct 31 20:51:43 2013
Return-Path: <gcc-bugs-return-433211-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7119 invoked by alias); 31 Oct 2013 20:51:42 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7055 invoked by uid 48); 31 Oct 2013 20:51:36 -0000
From: "mikpelinux at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/58943] wrong calculation of indirect structure member arithmetic via function call
Date: Thu, 31 Oct 2013 20:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: mikpelinux at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc attachments.created
Message-ID: <bug-58943-4-UNIMCEL72k@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58943-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58943-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg02355.txt.bz2
Content-length: 962

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX943

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Created attachment 31127
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id1127&actioníit
reduced test case

I believe this bug is real, and a dup or variation of PR48814, the difference
being that PR48814 had a postfix ++ while here we have a compound assignment
(|=).  According to Joseph's comment in
<http://gcc.gnu.org/bugzilla/show_bug.cgi?idH814#c8> the same interleaving
restrictions apply to ++ and |=.

The bug appears to trigger when the lvalue is a non-scalar.  It doesn't have to
be a struct member, an array element (as in this test case) suffices.


             reply	other threads:[~2013-10-31 19:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 19:25 ubizjak at gmail dot com [this message]
2014-09-11  7:52 ` [Bug target/58945] " ubizjak at gmail dot com
2014-10-15 19:09 ` ubizjak at gmail dot com
2014-10-17  7:20 ` ubizjak at gmail dot com
2014-10-17  7:33 ` ubizjak at gmail dot com
2015-02-13 10:07 ` ubizjak at gmail dot com
2015-03-31  9:30 ` ubizjak at gmail dot com
2015-03-31 17:33 ` uros at gcc dot gnu.org
2015-03-31 17:37 ` ubizjak at gmail dot com

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-58945-4@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).