Comment 4 for bug 1720872

Revision history for this message
Dan Lewis (danielwlewis) wrote : Re: [Bug 1720872] Re: Missed optimization - unnecessary PUSH/POP

Thanks, Thomas! I learn something new everyday! :-)

Dan

On Wed, Oct 4, 2017 at 8:13 AM, Thomas Preud'homme <
<email address hidden>> wrote:

> Hi Dan,
>
> This is mandated by the aarch32 ABI [1]. A function call across
> different source file could involve 2 compilers and these need to agree
> on what to expect (where are arguments, etc.). The ABI for aarch32
> mandates 64bit alignment at (public) function call boundary.
>
> [1]
> http://infocenter.arm.com/help/topic/com.arm.doc.
> ihi0042f/IHI0042F_aapcs.pdf
>
> Best regards.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1720872
>
> Title:
> Missed optimization - unnecessary PUSH/POP
>
> Status in GNU ARM Embedded Toolchain:
> New
>
> Bug description:
> I found two examples of where gcc -O3 produces a PUSH / POP sequence
> that unnecessarily includes register R3. According to the ARM
> Procedure Call Standard, register R3 does not need to be preserved by
> functions.
>
> An example of the C source code and the resulting ARM assembly can be
> found here:
>
> https://godbolt.org/g/UZFt9K
>
> This is with version 5.4 of gcc and using the following command line
> options:
>
> -O3 -march=armv7-m -mtune=cortex-m4 -mthumb
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gcc-arm-embedded/+bug/1720872/+subscriptions
>