MLIR 22.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
35extern "C" {
36
38 // The ArmSME tests are run within an emulator so we assume SME is available.
39 return true;
40}
41
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()
void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_save()
#define MLIR_ARMSMEABISTUBS_EXPORTED
bool MLIR_ARMSMEABISTUBS_EXPORTED __aarch64_sme_accessible()
void MLIR_ARMSMEABISTUBS_EXPORTED __arm_tpidr2_restore()
void MLIR_ARMSMEABISTUBS_EXPORTED __arm_za_disable()
int64_t x0
int64_t x1