This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [i386] Rotate stack checking loop
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 12 Nov 2015 23:03:53 +0100
- Subject: Re: [i386] Rotate stack checking loop
- Authentication-results: sourceware.org; auth=none
Hello!
> this patch rotates the loop generated in the prologue to do stack checking
> when -fstack-check is specified, thereby saving one branch instruction. It
> was initially implemented as a WHILE loop to match the generic implementation
> but can be turned into a DO-WHILE loop because the amount of stack to be
> checked is known at compile time (since it's the static part of the frame).
>
> The patch also changes a mov+sub pair into an lea in the common case on Linux,
> saving one more instruction in the process.
>
> Tested on x86/Linux & x86-64/Linux (ix86_adjust_stack_and_probe path) and
> x86/Solaris (ix86_emit_probe_stack_range path). OK for the mainline?
>
>
> 2015-11-12 Eric Botcazou <ebotcazou@adacore.com>
>
> * config/i386/i386.c (ix86_adjust_stack_and_probe): Adjust and use
> an lea instruction when possible.
> (output_adjust_stack_and_probe): Rotate the loop and simplify.
> (ix86_emit_probe_stack_range): Adjust.
> (output_probe_stack_range): Rotate the loop and simplify.
OK.
Thanks,
Uros.