This is the mail archive of the mailing list for the glibc 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]

Re: [PATCH] remove nested function hack_digit

Are you asking about the results from my particular compiler  (GCC
4.8.2) or in theoretical sense?
With 4.8.2 in both cases the calls to hack_digit are not inlined
(which I think is correct).

W/o the change the calls look like this:

  4b362:       4c 8b 95 30 ff ff ff    mov    -0xd0(%rbp),%r10
   4b369:       89 95 38 ff ff ff       mov    %edx,-0xc8(%rbp)
   4b36f:       e8 1c f0 ff ff          callq  4a390 <hack_digit.13608>

W/ this change the call takes more instructions to execute:
   4b1e4:       4c 89 ad 50 ff ff ff    mov    %r13,-0xb0(%rbp)
   4b1eb:       4c 89 bd 00 ff ff ff    mov    %r15,-0x100(%rbp)
   4b1f2:       4c 8b a5 40 ff ff ff    mov    -0xc0(%rbp),%r12
   4b1f9:       4c 8b ad f8 fe ff ff    mov    -0x108(%rbp),%r13
   4b200:       31 db                   xor    %ebx,%ebx
   4b202:       4c 8b b5 70 ff ff ff    mov    -0x90(%rbp),%r14
   4b209:       4c 8b bd 48 ff ff ff    mov    -0xb8(%rbp),%r15
   4b210:       48 89 85 58 ff ff ff    mov    %rax,-0xa8(%rbp)
   4b217:       66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
   4b21e:       00 00
   4b220:       4c 8b 8d 78 ff ff ff    mov    -0x88(%rbp),%r9
   4b227:       4c 8b 85 58 ff ff ff    mov    -0xa8(%rbp),%r8
   4b22e:       4c 89 fa                mov    %r15,%rdx
   4b231:       48 8b 4d 80             mov    -0x80(%rbp),%rcx
   4b235:       8b b5 68 ff ff ff       mov    -0x98(%rbp),%esi
   4b23b:       8b bd 60 ff ff ff       mov    -0xa0(%rbp),%edi
   4b241:       4c 89 74 24 08          mov    %r14,0x8(%rsp)
   4b246:       4c 89 24 24             mov    %r12,(%rsp)
   4b24a:       e8 41 f1 ff ff          callq  4a390 <hack_digit>

It doesn't mean the new code is worse or better.
There is no miracle in the nested function call,
you still need to pass all the parameters and this is just done with a
different calling convention.


On Tue, Sep 16, 2014 at 12:44 AM, Andreas Schwab <> wrote:
> Konstantin Serebryany <> writes:
>> Yep. I've realized that I've interpreted the test results incorrectly
>> (missed the failing tests).
>> The following patch passes tests.
> How does it affect code generation?
> Andreas.
> --
> Andreas Schwab,
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."

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