August 9th, 2024

LLVM Libc now has all C23 basic math functions for all 5 floating point types

The LLVM C Library offers accurate mathematical functions compliant with C and IEEE 754 standards, supports multiple data types, and shows competitive performance across various platforms, allowing user contributions.

Read original articleLink Icon
LLVM Libc now has all C23 basic math functions for all 5 floating point types

The LLVM C Library provides a comprehensive set of mathematical functions designed to adhere to C and IEEE 754 standards, emphasizing accuracy and consistency across platforms. The library aims for correct rounding in all modes and compares its outputs against established libraries like GNU MPFR for validation. Performance is also a key focus, with average performance expected to be comparable to other libc implementations, while worst-case scenarios should remain within 10-20 times the average. The library supports various data types, including float, double, and long double, and includes both basic and higher mathematical operations. Users can add new functions by following specific guidelines provided in the documentation. Performance testing has been conducted, showing competitive results against the GNU C library, particularly in functions like acos, exp, and log. The library is structured to support various platforms, including Linux, Windows, macOS, and embedded systems, ensuring broad applicability.

- LLVM C Library focuses on accuracy and consistency in mathematical functions.

- The library supports multiple data types and includes both basic and advanced math operations.

- Performance is tested against established libraries, with results showing competitive performance.

- Users can contribute by following guidelines for adding new math functions.

- The library is designed for compatibility across various platforms and use cases.

Related

Own Constant Folder in C/C++

Own Constant Folder in C/C++

Neil Henning discusses precision issues in clang when using the sqrtps intrinsic with -ffast-math, suggesting inline assembly for instruction selection. He introduces a workaround using __builtin_constant_p for constant folding optimization, enhancing code efficiency.

Integrated assembler improvements in LLVM 19

Integrated assembler improvements in LLVM 19

LLVM 19 brings significant enhancements to the integrated assembler, focusing on the MC library for assembly, disassembly, and object file formats. Performance improvements include optimized fragment sizes, streamlined symbol handling, and simplified expression evaluation. These changes aim to boost performance, reduce memory usage, and lay the groundwork for future enhancements.

Bignum Arithmetic by AWS

Bignum Arithmetic by AWS

The s2n-bignum project on GitHub provides optimized integer arithmetic routines for cryptography. It includes assembly code for speed and HOL-Light proofs for verification, supporting various languages and emphasizing security and performance.

GNU C Library version 2.40 fixes 5 CVEs

GNU C Library version 2.40 fixes 5 CVEs

The GNU C Library version 2.40 emphasizes portability, performance, and standards compliance. Updates include GCC 14.1 support, new function families, security enhancements, and improvements for 32-bit architectures. Users can find release notes and contributors on the GNU C Library webpage.

How Clang compiles a function (2018)

How Clang compiles a function (2018)

The article explains how Clang compiles a simple C++ function into LLVM IR, detailing memory allocation, control flow, and the representation of loops, with a focus on unoptimized output.

Link Icon 0 comments