Adding functions to math.h as builtins (Google Summer of Code 2019).
The purpose of this project is to implement more functions in GCC which are added in ISO/IEC TS 18661 (supporting features of IEEE 754), folding them and expanding them inline wherever appropriate.
Link to Repository
GCC has support for built-in functions in C99/C11 standards along with features of IEEE standards. These functions do appropriate calculations according to the requirements of the users taking various types of arguments and returning values as required on supported data types of GCC like int, float. Such inbuilt functions help users, developers and GCC developers to minimize the repetitive calculations and efforts. There are optimization steps carried out to have faster compilation and running time of programs, folding and inlining being one of them. The purpose of this project is to implement more such functions in GCC which are added in ISO/IEC TS 18661 (supporting features of IEEE 754), folding them and expanding them inline wherever appropriate.
Functions that have been added:
Roundeven variants round their argument to the nearest integer value in floating-point format, rounding halfway cases to even. These functions are also expanded inline for i386 machine (SSE 4.1 and above).
These arithmetic variants compute add/sub/mul/div operations as if to the arguments' infinite precision and round once to the result format (narrowing). These functions are also expanded inline for powerpc machines (ISA 2.07 and later).
Links to commits:
- Links to commits that have been merged:
Roundeven variants folding implementation.
Roundeven variants i386 inline expansion.
- Links to commits that need modifications and are being reviewed to get merged:
Fadd variants folding implementation.
Fadd variants powerpc inline expansion.
Sub/mul/div variants folding implementation.
Some patch submissions and discussions on GCC mailing lists:
- Work Pending:
- Adding of fromfp variants and their expansion on AArch64 architecture
- Expansion of sub/mul/div variants and testing
- Some documentation
GCC being a huge code-base, getting to know its coding environment, with its own internal representations, number of passes, various intricacies, numerous optimizations, making even smaller changes take significant time.
- I am continuing my work to complete the pending tasks beyond the deadline and I am very much likely to extend my work beyond the scope of Google Summer of Code for further ISO/IEC TS 18661 extension or some other.