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 inline-asm/67944] GCC emits unnecessary push/pop for callee-save reads.


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

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Your expectation is not in line with what the compiler actually promises
you: the only guarantee is that the local register variable will be in
(in your case) ebx _where used in an asm statement_.

Other than that, it is just a local variable.

You get a save/restore sequence in the prologue and epilogue because ebx
is a non-volatile register and this function uses that register.  Scheduling
later moves the push later in the code.

If you want to simply grab what is in ebx, you can use asm, like

long reg; asm("mov %%ebx,%0" : "=r"(reg));


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