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