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