From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27755 invoked by alias); 21 Jul 2012 12:05:06 -0000 Received: (qmail 27732 invoked by uid 22791); 21 Jul 2012 12:05:05 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 21 Jul 2012 12:04:52 +0000 From: "mikpe at it dot uu.se" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54063] New: [4.8 regression] on powerpc64 gcc 4.8 generates larger code for global variable accesses than gcc 4.7 Date: Sat, 21 Jul 2012 12:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mikpe at it dot uu.se X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-07/txt/msg01699.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54063 Bug #: 54063 Summary: [4.8 regression] on powerpc64 gcc 4.8 generates larger code for global variable accesses than gcc 4.7 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: mikpe@it.uu.se Consider this trivial test case, which scans for an element in a doubly-linked list that uses a separate sentinel object to represent the head and tail of the list: struct list { struct list *next, *prev; int k; } head = { &head, &head, 0 }; int lookup(int k) { struct list *list = head.next; while (list != &head) { if (list->k == k) return 1; list = list->next; } return 0; } The code generated by gcc 4.8 and 4.7 on powerpc64-linux for this test case is similar, except gcc 4.8 generates an additional instruction at the start of the function when computing the address of the global variable 'head': @@ -11,25 +11,26 @@ .previous .type lookup, @function .L.lookup: + addis 10,2,.LANCHOR0@toc@ha addis 8,2,.LANCHOR0@toc@ha - ld 9,.LANCHOR0@toc@l(8) + ld 9,.LANCHOR0@toc@l(10) addi 8,8,.LANCHOR0@toc@l cmpd 7,9,8 The rest is the same, modulo the numbers chosen for the labels. The test case is reduced from similar code in the Linux kernel, see PR54062.