This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add value range support into memcpy/memset expansion


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]