MLIR  19.0.0git
ArmSMEStubs.cpp
Go to the documentation of this file.
1 //===- ArmSMEStub.cpp - ArmSME ABI routine stubs --------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/Support/Compiler.h"
10 #include <cstdint>
11 #include <iostream>
12 
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)
18 #else
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
23 #else
24 #define MLIR_ARMSMEABISTUBS_EXPORTED \
25  __attribute__((visibility("default"))) LLVM_ATTRIBUTE_WEAK
26 #endif // (defined(_WIN32) || defined(__CYGWIN__))
27 
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.
34 
35 extern "C" {
36 
38  // The ArmSME tests are run within an emulator so we assume SME is available.
39  return true;
40 }
41 
42 struct sme_state {
43  int64_t x0;
44  int64_t x1;
45 };
46 
48  std::cerr << "[warning] __arm_sme_state() stubbed!\n";
49  return sme_state{};
50 }
51 
53  std::cerr << "[warning] __arm_tpidr2_restore() stubbed!\n";
54 }
55 
57  std::cerr << "[warning] __arm_tpidr2_save() stubbed!\n";
58 }
59 
61  std::cerr << "[warning] __arm_za_disable() stubbed!\n";
62 }
63 }
sme_state MLIR_ARMSMEABISTUBS_EXPORTED __arm_sme_state()
Definition: ArmSMEStubs.cpp:47
void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_save()
Definition: ArmSMEStubs.cpp:56
#define MLIR_ARMSMEABISTUBS_EXPORTED
Definition: ArmSMEStubs.cpp:24
bool MLIR_ARMSMEABISTUBS_EXPORTED __aarch64_sme_accessible()
Definition: ArmSMEStubs.cpp:37
void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_restore()
Definition: ArmSMEStubs.cpp:52
void MLIR_ARMSMEABISTUBS_EXPORTED __arm_za_disable()
Definition: ArmSMEStubs.cpp:60
int64_t x0
Definition: ArmSMEStubs.cpp:43
int64_t x1
Definition: ArmSMEStubs.cpp:44