1 //===- ArmSMEStub.cpp - ArmSME ABI routine stubs --------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Support/Compiler.h"
13 #if (defined(_WIN32) || defined(__CYGWIN__))
14 #ifndef MLIR_ARMSMEABISTUBS_EXPORTED
15 #ifdef mlir_arm_sme_abi_stubs_EXPORTS
16 // We are building this library
17 #define MLIR_ARMSMEABISTUBS_EXPORTED __declspec(dllexport)
19 // We are using this library
20 #define MLIR_ARMSMEABISTUBS_EXPORTED __declspec(dllimport)
21 #endif // mlir_arm_sme_abi_stubs_EXPORTS
22 #endif // MLIR_ARMSMEABISTUBS_EXPORTED
24 #define MLIR_ARMSMEABISTUBS_EXPORTED \
25 __attribute__((visibility("default"))) LLVM_ATTRIBUTE_WEAK
26 #endif // (defined(_WIN32) || defined(__CYGWIN__))
28 // The actual implementation of these routines is in:
29 // compiler-rt/lib/builtins/aarch64/sme-abi.S. These stubs allow the current
30 // ArmSME tests to run without depending on compiler-rt. This works as we don't
31 // rely on nested ZA-enabled calls at the moment. The use of these stubs can be
32 // overridden by setting the ARM_SME_ABI_ROUTINES_SHLIB CMake cache variable to
33 // a path to an alternate implementation.
37 bool MLIR_ARMSMEABISTUBS_EXPORTED
__aarch64_sme_accessible() {
38 // The ArmSME tests are run within an emulator so we assume SME is available.
47 sme_state MLIR_ARMSMEABISTUBS_EXPORTED
__arm_sme_state() {
48 std::cerr
<< "[warning] __arm_sme_state() stubbed!\n";
52 void MLIR_ARMSMEABISTUBS_EXPORTED
__arm_tpidr2_restore() {
53 std::cerr
<< "[warning] __arm_tpidr2_restore() stubbed!\n";
56 void MLIR_ARMSMEABISTUBS_EXPORTED
__arm_tpidr2_save() {
57 std::cerr
<< "[warning] __arm_tpidr2_save() stubbed!\n";
60 void MLIR_ARMSMEABISTUBS_EXPORTED
__arm_za_disable() {
61 std::cerr
<< "[warning] __arm_za_disable() stubbed!\n";