[Clang][SME2] Enable multi-vector loads & stores for SME2 (#75821)
[llvm-project.git] / compiler-rt / lib / builtins / int_util.c
blobbbb735ccf2791b108cdde8ea6c7d297be8dc4d57
1 //===-- int_util.c - Implement internal utilities -------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "int_lib.h"
11 // NOTE: The definitions in this file are declared weak because we clients to be
12 // able to arbitrarily package individual functions into separate .a files. If
13 // we did not declare these weak, some link situations might end up seeing
14 // duplicate strong definitions of the same symbol.
16 // We can't use this solution for kernel use (which may not support weak), but
17 // currently expect that when built for kernel use all the functionality is
18 // packaged into a single library.
20 #ifdef KERNEL_USE
22 NORETURN extern void panic(const char *, ...);
23 #ifndef _WIN32
24 __attribute__((visibility("hidden")))
25 #endif
26 void __compilerrt_abort_impl(const char *file, int line, const char *function) {
27 panic("%s:%d: abort in %s", file, line, function);
30 #elif __APPLE__
32 // from libSystem.dylib
33 NORETURN extern void __assert_rtn(const char *func, const char *file, int line,
34 const char *message);
36 __attribute__((weak))
37 __attribute__((visibility("hidden")))
38 void __compilerrt_abort_impl(const char *file, int line, const char *function) {
39 __assert_rtn(function, file, line, "libcompiler_rt abort");
42 #else
44 #ifdef _WIN32
45 #include <stdlib.h>
46 #endif
48 #ifndef _WIN32
49 __attribute__((weak))
50 __attribute__((visibility("hidden")))
51 #endif
52 void __compilerrt_abort_impl(const char *file, int line, const char *function) {
53 #if !__STDC_HOSTED__
54 // Avoid depending on libc when compiling with -ffreestanding.
55 __builtin_trap();
56 #elif defined(_WIN32)
57 abort();
58 #else
59 __builtin_abort();
60 #endif
63 #endif