ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
35.16k stars 2.57k forks source link

compiler_rt: Tracking Issue ARM Routines #14634

Open matu3ba opened 1 year ago

matu3ba commented 1 year ago

Context and Purpose

Based on https://gist.github.com/harieamjari/61aa4420ae4ded5e86f5143e46d93573 by user @harieamjari the list of ARM run-time functions to double-check

The official documentation is found here https://github.com/ARM-software/abi-aa/releases and the runtime abi (Q32022) here: https://github.com/ARM-software/abi-aa/blob/2982a9f3b512a5bfdc9e3fea5d3b298f9165c36b/rtabi32/rtabi32.rst

Preparation for audit of compiler_rt in #1504. see also https://embeddedartistry.com/blog/2017/10/11/demystifying-arm-floating-point-compiler-options/

List of Routines

The functions declared here is based on the document, number,
 * "ARM IHI 0043D, current through ABI release 2.09", which
 * defines the run-time helper-function ABI for programs written
 * in ARM-Thumb assembly language, C, and C++.

/ Standard double precision floating-point arithmetic helper functions /

/ double precision floating-point comparison helper functions /

/ Standard single precision floating-point arithmetic helper functions /

/ Standard single precision floating-point comparison helper functions /

/ Standard floating-point to integer conversions /

/ Standard conversions between floating types /

/ Standard integer to floating-point conversions /

/ Long long functions /

/ Integer (32/32 -> 32) division functions /

/ Division by zero /

/ Unaligned memory access /

/ Memory copying /

/ Memory clearing and setting /

matu3ba commented 1 year ago

See also #15468.

matu3ba commented 1 year ago
ARM-only ones: Done Name a b Out Comment
Float Comparison
__aeabi_cfcmpeq f32 f32 void a == b result in PSR ZC flags[^PSRZC]
__aeabi_cfcmple f32 f32 void a <= b result ..
__aeabi_cfrcmple f32 f32 void b <= a ..
__aeabi_cdcmpeq f64 f64 void a == b ..
__aeabi_cdcmple f64 f64 void a <= b ..
__aeabi_cdrcmple f64 f64 void b <= a ..
Float Arithmetic
__aeabi_frsub f64 f64 f64 b - a
__aeabi_drsub f64 f64 f64 ..
Special
__aeabi_read_tp *u8 ret tls pointer
__aeabi_idiv0 i32 i32 div by 0 modifier
__aeabi_ldiv0 i64 i64 div by 0 modifier
Unaligned memory access
__aeabi_uread4 [*]u8 i32 ret value read
__aeabi_uwrite4 i32 [*]u8 i32 ret value written
__aeabi_uread8 [*]u8 i64 ..
__aeabi_uwrite8 i64 [*]u8 i64 ..
Done Name a b c Comment
Memory copy, move and set
__aeabi_memcpy8 [*]u8 [*]u8 usize dest, src, size
__aeabi_memcpy4 [*]u8 [*]u8 usize ..
__aeabi_memcpy [*]u8 [*]u8 usize ..
__aeabi_memmove8 [*]u8 [*]u8 usize dest, src, size
__aeabi_memmove4 [*]u8 [*]u8 usize ..
__aeabi_memmove [*]u8 [*]u8 usize ..
__aeabi_memset8 [*]u8 usize i32 *dest, size, char
__aeabi_memset4 [*]u8 usize i32 ..
__aeabi_memset [*]u8 usize i32 ..
__aeabi_memclr8 [*]u8 u32 usize *dest, size
__aeabi_memclr4 [*]u8 u32 usize ..
__aeabi_memclr [*]u8 u32 usize ..
__aeabi_uwrite8 i64 [*]u8 i64 ..

Note: If having identical implementation [including besides function signature], routines are documented in #15675 and #15676.