https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12086

Eelis <gcc-bugzilla at contacts dot eelis.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gcc-bugzilla at contacts dot 
eelis
                   |                            |.net

--- Comment #11 from Eelis <gcc-bugzilla at contacts dot eelis.net> ---
This bug means that for

  struct X { char a[8]; };
  bool f(X x, X y) { return __builtin_memcmp(x.a, y.a, 8); }

gcc emits:

  subq    $40, %rsp
  .cfi_def_cfa_offset 48
  movl    $8, %edx
  movq    %rdi, 16(%rsp)
  leaq    16(%rsp), %rdi
  movq    %rsi, (%rsp)
  movq    %rsp, %rsi
  call    memcmp
  testl   %eax, %eax
  setne   %al
  addq    $40, %rsp
  .cfi_def_cfa_offset 8
  ret

while clang emits:

  movq    %rdi, -8(%rsp)
  movq    %rsi, -16(%rsp)
  cmpq    %rsi, -8(%rsp)
  setne    %al
  retq

(which is still suboptimal due to llvm bug #20673).

Reply via email to