Skip to content

Instantly share code, notes, and snippets.

@Joshi-Tejas
Last active October 15, 2022 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Joshi-Tejas/a87bde3b7bef1aa256a7e687cafe1b80 to your computer and use it in GitHub Desktop.
Save Joshi-Tejas/a87bde3b7bef1aa256a7e687cafe1b80 to your computer and use it in GitHub Desktop.
This document contains list of commits made for Adding math.h Functions Project for GCC under GSoC 2019.

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

https://github.com/Joshi-Tejas/gcc

Abstract

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:

  1. Roundeven variants:
    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).

  2. Add/sub/mul/div variants:
    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.
https://github.com/Joshi-Tejas/gcc/commit/787e7ee4fa0155ac6e82b472c7092adb97b8d9c7

Roundeven variants i386 inline expansion.
https://github.com/Joshi-Tejas/gcc/commit/f48f55daabb1dbc1b8b9b7c9d072f8362e5f9508

  • Links to commits that need modifications and are being reviewed to get merged:

Fadd variants folding implementation.
https://github.com/Joshi-Tejas/gcc/commit/367c4d6b516b11e4cf0ffdb49307d51905f14481

Fadd variants powerpc inline expansion.
https://github.com/Joshi-Tejas/gcc/commit/a021a2a6b3ed72eaee0fb9ffa0ff3b2575f49a07

Sub/mul/div variants folding implementation.
https://github.com/Joshi-Tejas/gcc/commit/cb3f329a79c570c611742f3c92f73f769dc3cfa8

Some patch submissions and discussions on GCC mailing lists:

https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01712.html
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01716.html
https://gcc.gnu.org/ml/gcc/2019-08/msg00134.html

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment