This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/54063] New: [4.8 regression] on powerpc64 gcc 4.8 generates larger code for global variable accesses than gcc 4.7
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 21 Jul 2012 12:04:52 +0000
- Subject: [Bug target/54063] New: [4.8 regression] on powerpc64 gcc 4.8 generates larger code for global variable accesses than gcc 4.7
- Auto-submitted: auto-generated
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.