This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/54063] New: [4.8 regression] on powerpc64 gcc 4.8 generates larger code for global variable accesses than gcc 4.7


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]