compiler_builtins/
lib.rs

1#![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
2#![cfg_attr(all(target_family = "wasm"), feature(wasm_numeric_instr))]
3#![feature(abi_unadjusted)]
4#![feature(asm_experimental_arch)]
5#![feature(cfg_target_has_atomic)]
6#![feature(compiler_builtins)]
7#![feature(core_intrinsics)]
8#![feature(linkage)]
9#![feature(naked_functions)]
10#![feature(repr_simd)]
11#![cfg_attr(f16_enabled, feature(f16))]
12#![cfg_attr(f128_enabled, feature(f128))]
13#![no_builtins]
14#![no_std]
15#![allow(unused_features)]
16#![allow(internal_features)]
17// We use `u128` in a whole bunch of places which we currently agree with the
18// compiler on ABIs and such, so we should be "good enough" for now and changes
19// to the `u128` ABI will be reflected here.
20#![allow(improper_ctypes, improper_ctypes_definitions)]
21// `mem::swap` cannot be used because it may generate references to memcpy in unoptimized code.
22#![allow(clippy::manual_swap)]
23// Support compiling on both stage0 and stage1 which may differ in supported stable features.
24#![allow(stable_features)]
25// By default, disallow this as it is forbidden in edition 2024. There is a lot of unsafe code to
26// be migrated, however, so exceptions exist.
27#![warn(unsafe_op_in_unsafe_fn)]
28
29// We disable #[no_mangle] for tests so that we can verify the test results
30// against the native compiler-rt implementations of the builtins.
31
32// NOTE cfg(all(feature = "c", ..)) indicate that compiler-rt provides an arch optimized
33// implementation of that intrinsic and we'll prefer to use that
34
35// NOTE(aapcs, aeabi, arm) ARM targets use intrinsics named __aeabi_* instead of the intrinsics
36// that follow "x86 naming convention" (e.g. addsf3). Those aeabi intrinsics must adhere to the
37// AAPCS calling convention (`extern "aapcs"`) because that's how LLVM will call them.
38
39#[cfg(test)]
40extern crate core;
41
42#[macro_use]
43mod macros;
44
45pub mod float;
46pub mod int;
47pub mod math;
48pub mod mem;
49
50// `libm` expects its `support` module to be available in the crate root.
51use math::libm_math::support;
52
53#[cfg(target_arch = "arm")]
54pub mod arm;
55
56#[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))]
57pub mod aarch64;
58
59#[cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "no-asm"),))]
60pub mod aarch64_linux;
61
62#[cfg(all(
63    kernel_user_helpers,
64    any(target_os = "linux", target_os = "android"),
65    target_arch = "arm"
66))]
67pub mod arm_linux;
68
69#[cfg(target_arch = "avr")]
70pub mod avr;
71
72#[cfg(target_arch = "hexagon")]
73pub mod hexagon;
74
75#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
76pub mod riscv;
77
78#[cfg(target_arch = "x86")]
79pub mod x86;
80
81#[cfg(target_arch = "x86_64")]
82pub mod x86_64;
83
84pub mod probestack;