Skip to content

Implement fixed point fxbits functions in llvm-libc #113360

@PiJoules

Description

@PiJoules

Some fixed point functions from ISO 18037 are implemented in llvm-libc, but not all of them are implemented. The various fxbits functions should also be added. Copying from the extension:

4.1.7.5 The bitwise integer to fixed-point conversion functions

The bitwise integer to fixed-point conversion functions fxbits, where fx stands for one of hr, r, lr, hk, k, lk, uhr, ur, ulr, uhk, uk or ulk, take one argument with type int_fx_t or uint_fx_t, the result type is a fixed-point type (corresponding to fx).
The bitwise fixed-point to integer conversion functions return an fixed-point value equal to the integer value of the argument divided by 2^F, where F is the number of fractional bits in the fixedpoint result type of the function. For example, if fract has 15 fractional bits, then the value of rbits(0x2000) is 0.25.

These can first be implemented as __builtin_* functions in clang then llvm-libc can provide the wrappers for each of the builtin functions.

Metadata

Metadata

Assignees

Labels

clang:headersHeaders provided by Clang, e.g. for intrinsicsgood first issuehttps://github.com/llvm/llvm-project/contributelibc

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions