This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add zero-overhead looping for xtensa backend
- From: "augustine dot sterling at gmail dot com" <augustine dot sterling at gmail dot com>
- To: Felix Yang <fei dot yang0953 at gmail dot com>
- Cc: "Yangfei (Felix)" <felix dot yang at huawei dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 13 Oct 2014 09:09:12 -0700
- Subject: Re: [PATCH] Add zero-overhead looping for xtensa backend
- Authentication-results: sourceware.org; auth=none
- References: <CAFc0fxw_SrT8c5y=Ly+X98UhN5_P1bAjMg3n0K06fxAv0ioebg at mail dot gmail dot com> <CAGSvup-V3h1EoZ3D31BEc7Gq0F=YEYJD1GmH+_UipVjNCe=HyQ at mail dot gmail dot com> <CAFc0fxzHg4OktbyTy9341Joubf+A6E3XRj-oCS8WzgVp4pw9mw at mail dot gmail dot com> <CAFc0fxwh7Ey2XFRpbSVNQpQ7RUwcQgGCYHMFB=Yo=6ci261prQ at mail dot gmail dot com> <DA41BE1DDCA941489001C7FBD7A8820E54A354E4 at szxema507-mbx dot china dot huawei dot com> <CAGSvup9qUfTfYOm6FyUcDFeKp4dJtFMjWaC+XnjT6Ca+OqYguA at mail dot gmail dot com> <CAFc0fxxXWa603e0r29WjkSGN7T5JAQ5WZq6iKW46zfvWhou7Dw at mail dot gmail dot com> <CAFc0fxwXVkSf0---P42kdXWR7ibr02uOaiiz8L9Kc=fHTxWY1w at mail dot gmail dot com>
On Fri, Oct 10, 2014 at 6:59 AM, Felix Yang <fei.yang0953@gmail.com> wrote:
> Hi Sterling,
>
> I made some improvement to the patch. Two changes:
> 1. TARGET_LOOPS is now used as a condition of the doloop related
> patterns, which is more elegant.
Fine.
> 2. As the trip count register of the zero-cost loop maybe
> potentially spilled, we need to change the patterns in order to handle
> this issue.
Actually, for xtensa you don't. The trip count is copied into LCOUNT
at the execution of the loop instruction, and therefore a spill or
whatever doesn't matter--it won't affect the result. So as long as you
have the trip count at the start of the loop, you are fine.
This does bring up an issue of whether or not the trip count can be
modified during the loop. (note that this is different than early
exit.) If it can, you can't use a zero-overhead loop. Does your patch
address this case.
The solution is similar to that adapted by c6x backend.
> Just turn the zero-cost loop into a regular loop when that happens
> when reload is completed.
> Attached please find version 4 of the patch. Make check regression
> tested with xtensa-elf-gcc/simulator.
> OK for trunk?