This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add value range support into memcpy/memset expansion
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Richard Biener <rguenther at suse dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>, steven at gcc dot gnu dot org
- Date: Mon, 18 Nov 2013 09:16:19 -0800
- Subject: Re: Add value range support into memcpy/memset expansion
- Authentication-results: sourceware.org; auth=none
- References: <20130927145046 dot GC6666 at kam dot mff dot cuni dot cz> <20131115094517 dot GA18020 at atrey dot karlin dot mff dot cuni dot cz> <alpine dot LNX dot 2 dot 00 dot 1311151119170 dot 4261 at zhemvz dot fhfr dot qr> <20131117233820 dot GE2268 at kam dot mff dot cuni dot cz> <CAMe9rOqiGi6n_0EJgdQfu6b5toMVPcVS08vt+AmrVi52cMVOkA at mail dot gmail dot com>
On Mon, Nov 18, 2013 at 6:19 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Nov 17, 2013 at 3:38 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> Hi,
>> this is version I comitted. It also adds a testcase and enables the support in i386 backend.
>>
>> Honza
>>
>> * doc/md.texi (setmem, movstr): Update documentation.
>> * builtins.c (determine_block_size): New function.
>> (expand_builtin_memcpy): Use it and pass it to
>> emit_block_move_hints.
>> (expand_builtin_memset_args): Use it and pass it to
>> set_storage_via_setmem.
>> * expr.c (emit_block_move_via_movmem): Add min_size/max_size parameters;
>> update call to expander.
>> (emit_block_move_hints): Add min_size/max_size parameters.
>> (clear_storage_hints): Likewise.
>> (set_storage_via_setmem): Likewise.
>> (clear_storage): Update.
>> * expr.h (emit_block_move_hints, clear_storage_hints,
>> set_storage_via_setmem): Update prototype.
>> * i386.c (ix86_expand_set_or_movmem): Add bounds; export.
>> (ix86_expand_movmem, ix86_expand_setmem): Remove.
>> (ix86_expand_movmem, ix86_expand_setmem): Remove.
>> * i386.md (movmem, setmem): Pass parameters.
>>
>> * testsuite/gcc.target/i386/memcpy-2.c: New testcase.
>
> The new testcase fails for me on x86 and x86-64:
>
> FAIL: gcc.target/i386/memcpy-2.c scan-assembler-not memcpy
> FAIL: gcc.target/i386/memcpy-2.c (test for excess errors)
>
I got
[hjl@gnu-6 gcc]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/
/export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/memcpy-2.c
-fno-diagnostics-show-caret -fdiagnostics-color=never -O2
-ffat-lto-objects -ffat-lto-objects -S -m32 -o memcpy-2.s
/export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/memcpy-2.c:
In function ‘t’:
/export/gnu/import/git/gcc/gcc/testsuite/gcc.target/i386/memcpy-2.c:10:5:
warning: incompatible implicit declaration of built-in function
‘memcpy’ [enabled by default]
[hjl@gnu-6 gcc]$ cat memcpy-2.s
.file "memcpy-2.c"
.text
.p2align 4,,15
.globl t
.type t, @function
t:
.LFB0:
.cfi_startproc
subl $28, %esp
.cfi_def_cfa_offset 32
movl 32(%esp), %eax
cmpl $9, %eax
ja .L3
movl %eax, 8(%esp)
movl b, %eax
movl %eax, 4(%esp)
movl a, %eax
movl %eax, (%esp)
call memcpy
.L3:
addl $28, %esp
.cfi_def_cfa_offset 4
ret
.cfi_endproc
/* { dg-final { scan-assembler-not "memcpy" } } */
will also match
.file "memcpy-2.c"
--
H.J.