This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add a TARGET_GEN_MEMSET_VALUE hook
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Fri, 19 Aug 2016 11:21:21 +0200
- Subject: Re: [PATCH] Add a TARGET_GEN_MEMSET_VALUE hook
- Authentication-results: sourceware.org; auth=none
- References: <20160817201104.GA21304@intel.com> <CAFiYyc1ceRGF8QLQdkLE=7qRHi1R3UTo9YhK8035J2Y_PKbHaw@mail.gmail.com> <CAMe9rOrH-YAguyu-D+qjqfQcF_5eiThJZG3AASGNO5tjpaj5=g@mail.gmail.com>
On Thu, Aug 18, 2016 at 5:16 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 18, 2016 at 1:18 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
>> On Wed, Aug 17, 2016 at 10:11 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>>> builtin_memset_gen_str returns a register used for memset, which only
>>> supports integer registers. But a target may use vector registers in
>>> memmset. This patch adds a TARGET_GEN_MEMSET_VALUE hook to duplicate
>>> QImode value to mode derived from STORE_MAX_PIECES, which can be used
>>> with vector instructions. The default hook is the same as the original
>>> builtin_memset_gen_str. A target can override it to support vector
>>> instructions for STORE_MAX_PIECES.
>>>
>>> Tested on x86-64 and i686. Any comments?
>>>
>>> H.J.
>>> ---
>>> gcc/
>>>
>>> * builtins.c (builtin_memset_gen_str): Call targetm.gen_memset_value.
>>> (default_gen_memset_value): New function.
>>> * target.def (gen_memset_value): New hook.
>>> * targhooks.c: Inclue "expmed.h" and "builtins.h".
>>> (default_gen_memset_value): New function.
>>
>> I see default_gen_memset_value in builtins.c but it belongs here.
>>
>>> * targhooks.h (default_gen_memset_value): New prototype.
>>> * config/i386/i386.c (ix86_gen_memset_value): New function.
>>> (TARGET_GEN_MEMSET_VALUE): New.
>>> * config/i386/i386.h (STORE_MAX_PIECES): Likewise.
>>> * doc/tm.texi.in: Add TARGET_GEN_MEMSET_VALUE hook.
>>> * doc/tm.texi: Updated.
>>>
>
> Like this?
Aww, ok - I see builtins.c is a better place - sorry for the extra work.
Richard.
> H.J.