[all-commits] [llvm/llvm-project] 7289b6: [libc] Improve memcpy for ARM Cortex-M supporting ...

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Thu Jun 26 01:18:24 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7289b6789ef3297f8de30a9d94c7dabc6c35931e
      https://github.com/llvm/llvm-project/commit/7289b6789ef3297f8de30a9d94c7dabc6c35931e
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M libc/src/__support/macros/optimization.h
    M libc/src/string/memory_utils/CMakeLists.txt
    A libc/src/string/memory_utils/arm/inline_memcpy.h
    M libc/src/string/memory_utils/inline_memcpy.h
    M libc/src/string/memory_utils/utils.h
    M utils/bazel/llvm-project-overlay/libc/BUILD.bazel

  Log Message:
  -----------
  [libc] Improve memcpy for ARM Cortex-M supporting unaligned accesses. (#144872)

This implementation has been compiled with the [pigweed toolchain](https://pigweed.dev/toolchain.html) and tested on:
 - Raspberry Pi Pico 2 with the following options\
`--target=armv8m.main-none-eabi`
`-march=armv8m.main+fp+dsp`
`-mcpu=cortex-m33` 
 - Raspberry Pi Pico with the following options\
`--target=armv6m-none-eabi`
`-march=armv6m`
`-mcpu=cortex-m0+` 

They both compile down to a little bit more than 200 bytes and are between 2 and 10 times faster than byte per byte copies.

For best performance the following options can be set in the `libc/config/baremetal/arm/config.json`
```
{
  "codegen": {
    "LIBC_CONF_KEEP_FRAME_POINTER": {
      "value": false
    }
  },
  "general": {
    "LIBC_ADD_NULL_CHECKS": {
      "value": false
    }
  }
}
```



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