[libc-commits] [libc] [libc][c23] add memset_explicit (PR #83577)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Mon Mar 4 09:18:59 PST 2024
================
@@ -0,0 +1,29 @@
+//===-- Flush Cacheline for AArch64 -----------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_FLUSH_CACHELINE_H
+#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_FLUSH_CACHELINE_H
+
+#include "src/__support/common.h"
+#include <stddef.h> // size_t
+namespace LIBC_NAMESPACE {
+
+LIBC_INLINE size_t cacheline_size() {
+ // Use the same way as in compiler-rt
+ size_t ctr_el0;
+ asm volatile("mrs %0, ctr_el0" : "=r"(ctr_el0));
----------------
nickdesaulniers wrote:
Omit `volatile`; if we call this function but don't use the value, we should skip this inline asm. (or make the return value [[nodiscard]])
https://github.com/llvm/llvm-project/pull/83577
More information about the libc-commits
mailing list