This is the mail archive of the gcc-bugs@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]

[Bug target/46647] New: Can't inline memset with -1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46647

           Summary: Can't inline memset with -1
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com
                CC: ubizjak@gmail.com


[hjl@gnu-16 gcc]$ cat /tmp/x.i 
char a[4];
int
func1 (void)
{
  __builtin_memset (a,-1,sizeof (a));
  return 0;
}

int
func2 (void)
{
  __builtin_memset (a,123,sizeof (a));
  return 0;
}
[hjl@gnu-16 gcc]$ ./xgcc -B./ -S /tmp/x.i -O2 -m32
[hjl@gnu-16 gcc]$ cat x.s
    .file    "x.i"
    .text
    .p2align 4,,15
    .globl    func1
    .type    func1, @function
func1:
.LFB0:
    .cfi_startproc
    subl    $28, %esp
    .cfi_def_cfa_offset 32
    movl    $4, 8(%esp)
    movl    $-1, 4(%esp)
    movl    $a, (%esp)
    call    memset
    xorl    %eax, %eax
    addl    $28, %esp
    .cfi_def_cfa_offset 4
    ret
    .cfi_endproc
.LFE0:
    .size    func1, .-func1
    .p2align 4,,15
    .globl    func2
    .type    func2, @function
func2:
.LFB1:
    .cfi_startproc
    movl    $2071690107, a
    xorl    %eax, %eax
    ret
    .cfi_endproc
.LFE1:
    .size    func2, .-func2
    .comm    a,4,1
    .ident    "GCC: (GNU) 4.6.0 20101124 (experimental) [trunk revision
167121]"
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-16 gcc]$ 

Why can't we inline  __builtin_memset (a,123,sizeof (a))?


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