[clang] [llvm] [RISCV] Implement Clang Builtins for XAndesPerf Extension (PR #147018)

Jim Lin via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 05:13:06 PDT 2025


================
@@ -0,0 +1,29 @@
+//==- BuiltinsRISCVXAndes.td - RISC-V Andes Builtin database -----*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the Andes-specific builtin function database.  Users of
+// this file must define the BUILTIN macro to make use of this information.
+//
+//===----------------------------------------------------------------------===//
+
+class RISCVXAndesBuiltin<string prototype, string features = ""> : TargetBuiltin {
+  let Spellings = ["__builtin_riscv_nds_" # NAME];
+  let Prototype = prototype;
+  let Features = features;
+}
+
+let Attributes = [NoThrow, Const] in {
+//===----------------------------------------------------------------------===//
+// XAndesPerf extension.
+//===----------------------------------------------------------------------===//
+
+def ffb     : RISCVXAndesBuiltin<"long int(unsigned long int, unsigned long int)", "xandesperf">;
----------------
tclin914 wrote:

Unfortunately, we did not plan to provide both 32-bit and 64-bit versions for RV64. The 32-bit version would be only for RV32, and the 64-bit version is for RV64.

https://github.com/llvm/llvm-project/pull/147018


More information about the llvm-commits mailing list