Software APIs
math_builtins.c File Reference

(30d7e787c7)

Implementations of libgcc-style polyfills for arithmetic. More...

#include <stdint.h>
#include <stdnoreturn.h>
#include "sw/device/lib/base/macros.h"

Go to the source code of this file.

Detailed Description

Implementations of libgcc-style polyfills for arithmetic.

This file has no header, since its functions should not be called directly; the compiler will generate calls into them as needed.

The functions have names like _ot_builtin_*, rather than their libgcc names, so that they can coexist with libgcc/libcompiler-rt on the host-side for the purpose of unit tests. The linker aliases for the libgcc names only exist on the device-side.

See https://github.com/llvm/llvm-project/tree/main/compiler-rt/lib/builtins for a detailed specification of the ABI we implement in this file.

The provided functions here are:

Although the RISC-V B extension provides instructions for some ofthese, we currently do not require using a Clang that is aware of how to codegen them, so LLVM may choose to emit libgcc polyfill symbols (like the following) instead. Once we mandate such a Clang, they should be removed.

Definition in file math_builtins.c.