Basic PowerPC Built-in Functions Available on ISA 3.0 (Using the GNU Compiler Collection (GCC))

#### 7.13.23.5 Basic PowerPC Built-in Functions Available on ISA 3.0 ¶

The basic built-in functions described in this section are available on the PowerPC family of processors starting with ISA 3.0 or later. Unless specific options are explicitly disabled on the command line, specifying option `-mcpu=power9` has the effect of enabling all the same options as for `-mcpu=power8` in addition to the `-misel` option.

The following built-in functions are available on Linux 64-bit systems that use the ISA 3.0 instruction set (`-mcpu=power9`):

Built-in Function: `__float128` __builtin_addf128_round_to_odd `(__float128, __float128)` ¶

  Perform a 128-bit IEEE floating point add using round to odd as the rounding mode.

Built-in Function: `__float128` __builtin_subf128_round_to_odd `(__float128, __float128)` ¶

  Perform a 128-bit IEEE floating point subtract using round to odd as the rounding mode.

Built-in Function: `__float128` __builtin_mulf128_round_to_odd `(__float128, __float128)` ¶

  Perform a 128-bit IEEE floating point multiply using round to odd as the rounding mode.

Built-in Function: `__float128` __builtin_divf128_round_to_odd `(__float128, __float128)` ¶

  Perform a 128-bit IEEE floating point divide using round to odd as the rounding mode.

Built-in Function: `__float128` __builtin_sqrtf128_round_to_odd `(__float128)` ¶

  Perform a 128-bit IEEE floating point square root using round to odd as the rounding mode.

Built-in Function: `__float128` __builtin_fmaf128_round_to_odd `(__float128, __float128, __float128)` ¶

  Perform a 128-bit IEEE floating point fused multiply and add operation using round to odd as the rounding mode.

Built-in Function: `double` __builtin_truncf128_round_to_odd `(__float128)` ¶

  Convert a 128-bit IEEE floating point value to `double` using round to odd as the rounding mode.

The following additional built-in functions are also available for the PowerPC family of processors, starting with ISA 3.0 or later:

Built-in Function: `long long` __builtin_darn `(void)` ¶
Built-in Function: `long long` __builtin_darn_raw `(void)` ¶
Built-in Function: `int` __builtin_darn_32 `(void)` ¶

  The `__builtin_darn` and `__builtin_darn_raw` functions require a 64-bit environment supporting ISA 3.0 or later. The `__builtin_darn` function provides a 64-bit conditioned random number. The `__builtin_darn_raw` function provides a 64-bit raw random number. The `__builtin_darn_32` function provides a 32-bit conditioned random number.

The following additional built-in functions are also available for the PowerPC family of processors, starting with ISA 3.0 or later:

    int __builtin_byte_in_set (unsigned char u, unsigned long long set);
    int __builtin_byte_in_range (unsigned char u, unsigned int range);
    int __builtin_byte_in_either_range (unsigned char u, unsigned int ranges);

    int __builtin_dfp_dtstsfi_lt (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_lt (unsigned int comparison, _Decimal128 value);
    int __builtin_dfp_dtstsfi_lt_dd (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_lt_td (unsigned int comparison, _Decimal128 value);

    int __builtin_dfp_dtstsfi_gt (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_gt (unsigned int comparison, _Decimal128 value);
    int __builtin_dfp_dtstsfi_gt_dd (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_gt_td (unsigned int comparison, _Decimal128 value);

    int __builtin_dfp_dtstsfi_eq (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_eq (unsigned int comparison, _Decimal128 value);
    int __builtin_dfp_dtstsfi_eq_dd (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_eq_td (unsigned int comparison, _Decimal128 value);

    int __builtin_dfp_dtstsfi_ov (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_ov (unsigned int comparison, _Decimal128 value);
    int __builtin_dfp_dtstsfi_ov_dd (unsigned int comparison, _Decimal64 value);
    int __builtin_dfp_dtstsfi_ov_td (unsigned int comparison, _Decimal128 value);

    double __builtin_mffsl(void);

The `__builtin_byte_in_set` function requires a 64-bit environment supporting ISA 3.0 or later. This function returns a non-zero value if and only if its `u` argument exactly equals one of the eight bytes contained within its 64-bit `set` argument.

The `__builtin_byte_in_range` and `__builtin_byte_in_either_range` require an environment supporting ISA 3.0 or later. For these two functions, the `range` argument is encoded as 4 bytes, organized as `hi_1:lo_1:hi_2:lo_2`. The `__builtin_byte_in_range` function returns a non-zero value if and only if its `u` argument is within the range bounded between `lo_2` and `hi_2` inclusive. The `__builtin_byte_in_either_range` function returns non-zero if and only if its `u` argument is within either the range bounded between `lo_1` and `hi_1` inclusive or the range bounded between `lo_2` and `hi_2` inclusive.

The `__builtin_dfp_dtstsfi_lt` function returns a non-zero value if and only if the number of significant digits of its `value` argument is less than its `comparison` argument. The `__builtin_dfp_dtstsfi_lt_dd` and `__builtin_dfp_dtstsfi_lt_td` functions behave similarly, but require that the type of the `value` argument be `__Decimal64` and `__Decimal128` respectively.

The `__builtin_dfp_dtstsfi_gt` function returns a non-zero value if and only if the number of significant digits of its `value` argument is greater than its `comparison` argument. The `__builtin_dfp_dtstsfi_gt_dd` and `__builtin_dfp_dtstsfi_gt_td` functions behave similarly, but require that the type of the `value` argument be `__Decimal64` and `__Decimal128` respectively.

The `__builtin_dfp_dtstsfi_eq` function returns a non-zero value if and only if the number of significant digits of its `value` argument equals its `comparison` argument. The `__builtin_dfp_dtstsfi_eq_dd` and `__builtin_dfp_dtstsfi_eq_td` functions behave similarly, but require that the type of the `value` argument be `__Decimal64` and `__Decimal128` respectively.

The `__builtin_dfp_dtstsfi_ov` function returns a non-zero value if and only if its `value` argument has an undefined number of significant digits, such as when `value` is an encoding of `NaN`. The `__builtin_dfp_dtstsfi_ov_dd` and `__builtin_dfp_dtstsfi_ov_td` functions behave similarly, but require that the type of the `value` argument be `__Decimal64` and `__Decimal128` respectively.

The `__builtin_mffsl` uses the ISA 3.0 `mffsl` instruction to read the FPSCR. The instruction is a lower latency version of the `mffs` instruction. If the `mffsl` instruction is not available, then the builtin uses the older `mffs` instruction to read the FPSCR.