[all-commits] [llvm/llvm-project] 2f58ac: [libc][x86] copy one cache line at a time to preve...

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Tue Oct 22 01:49:07 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f58ac4a22baa27c1e9aad1b3c6d5c687ef03721
      https://github.com/llvm/llvm-project/commit/2f58ac4a22baa27c1e9aad1b3c6d5c687ef03721
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2024-10-22 (Tue, 22 Oct 2024)

  Changed paths:
    M libc/src/string/memory_utils/x86_64/inline_memcpy.h

  Log Message:
  -----------
  [libc][x86] copy one cache line at a time to prevent the use of `rep;movsb` (#113161)

When using `-mprefer-vector-width=128` with `-march=sandybridge` copying
3 cache lines in one go (192B) gets converted into `rep;movsb` which
translate into a 60% hit in performance.

Consecutive calls to `__builtin_memcpy_inline` (implementation behind
`builtin::Memcpy::block_offset`) are not coalesced by the compiler and
so calling it three times in a row generates the desired assembly. It
only differs in the interleaving of the loads and stores and does not
affect performance.

This is needed to reland
https://github.com/llvm/llvm-project/pull/108939.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list