[PATCH] Add a TARGET_GEN_MEMSET_VALUE hook

H.J. Lu hjl.tools@gmail.com
Fri Aug 19 14:45:00 GMT 2016


On Fri, Aug 19, 2016 at 2:21 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> 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.

Here is the original patch with the updated ChangeLog.  OK for trunk?


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-TARGET_GEN_MEMSET_VALUE-hook.patch
Type: text/x-patch
Size: 40271 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160819/b1d0669f/attachment.bin>


More information about the Gcc-patches mailing list