public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63527] New: [5 Regression] -fPIC generates more instructions
@ 2014-10-13 18:49 hjl.tools at gmail dot com
  2014-10-14  0:04 ` [Bug target/63527] [5 Regression] -fPIC uses 2 registers for GOT hjl.tools at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2014-10-13 18:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63527

            Bug ID: 63527
           Summary: [5 Regression] -fPIC generates more instructions
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: evstupac at gmail dot com
            Target: i686-linux

On Linux/x86, r216154 generates more instructions with -O2 -fPIC
for

----
struct cache_file
{
  char magic[sizeof "ld.so-1.7.0" - 1];
  unsigned int nlibs;
};
typedef unsigned int size_t;
size_t cachesize __attribute__ ((visibility ("hidden")));
struct cache_file *cache __attribute__ ((visibility ("hidden")));
extern int __munmap (void *__addr, size_t __len);
void
_dl_unload_cache (void)
{
  if (cache != ((void *)0) && cache != (struct cache_file *) -1)
    {
      __munmap (cache, cachesize);
      cache = ((void *)0) ;
    }
}
----

r216153 generates

---
    .text
.LHOTB0:
    .p2align 4,,15
    .globl    _dl_unload_cache
    .type    _dl_unload_cache, @function
_dl_unload_cache:
    pushl    %ebx
    call    __x86.get_pc_thunk.bx
    addl    $_GLOBAL_OFFSET_TABLE_, %ebx
    subl    $8, %esp
    movl    cache@GOTOFF(%ebx), %eax
    leal    -1(%eax), %edx
    cmpl    $-3, %edx
    ja    .L1
    subl    $8, %esp
    pushl    cachesize@GOTOFF(%ebx)
    pushl    %eax
    call    __munmap@PLT
    movl    $0, cache@GOTOFF(%ebx)
    addl    $16, %esp
.L1:
    addl    $8, %esp
    popl    %ebx
    ret
    .size    _dl_unload_cache, .-_dl_unload_cache
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .hidden    cache
    .comm    cache,4,4
    .hidden    cachesize
    .comm    cachesize,4,4
    .section   
.text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
    .globl    __x86.get_pc_thunk.bx
    .hidden    __x86.get_pc_thunk.bx
    .type    __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
    movl    (%esp), %ebx
    ret
---

r216154 generates

--
    .text
.LHOTB0:
    .p2align 4,,15
    .globl    _dl_unload_cache
    .type    _dl_unload_cache, @function
_dl_unload_cache:
    pushl    %esi
    pushl    %ebx
    call    __x86.get_pc_thunk.si
    addl    $_GLOBAL_OFFSET_TABLE_, %esi
    subl    $4, %esp
    movl    cache@GOTOFF(%esi), %eax
    leal    -1(%eax), %edx
    cmpl    $-3, %edx
    ja    .L1
    subl    $8, %esp
    pushl    cachesize@GOTOFF(%esi)
    movl    %esi, %ebx
    pushl    %eax
    call    __munmap@PLT
    movl    $0, cache@GOTOFF(%esi)
    addl    $16, %esp
.L1:
    addl    $4, %esp
    popl    %ebx
    popl    %esi
    ret
    .size    _dl_unload_cache, .-_dl_unload_cache
    .section    .text.unlikely
.LCOLDE0:
    .text
.LHOTE0:
    .hidden    cache
    .comm    cache,4,4
    .hidden    cachesize
    .comm    cachesize,4,4
    .section   
.text.__x86.get_pc_thunk.si,"axG",@progbits,__x86.get_pc_thunk.si,comdat
    .globl    __x86.get_pc_thunk.si
    .hidden    __x86.get_pc_thunk.si
    .type    __x86.get_pc_thunk.si, @function
__x86.get_pc_thunk.si:
    movl    (%esp), %esi
    ret
--

Why doesn't r216154 simply use %ebx to access cache, cachesize
and __munmap?


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-25 20:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13 18:49 [Bug target/63527] New: [5 Regression] -fPIC generates more instructions hjl.tools at gmail dot com
2014-10-14  0:04 ` [Bug target/63527] [5 Regression] -fPIC uses 2 registers for GOT hjl.tools at gmail dot com
2014-10-14  7:51 ` rguenth at gcc dot gnu.org
2014-11-10 22:17 ` ubizjak at gmail dot com
2014-11-15  8:29 ` ubizjak at gmail dot com
2014-11-20 12:24 ` rguenth at gcc dot gnu.org
2014-11-25 20:20 ` vmakarov at gcc dot gnu.org
2014-11-25 20:54 ` hjl at gcc dot gnu.org
2014-11-25 20:56 ` hjl.tools at gmail dot com

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).