Using the GNU Compiler Collection (GCC): PowerPC Built-in Functions

Next: PowerPC AltiVec/VSX Built-in Functions, Previous: picoChip Built-in Functions, Up: Target Builtins [Contents][Index]

#### 6.58.19 PowerPC Built-in Functions

These built-in functions are available for the PowerPC family of processors:

    float __builtin_recipdivf (float, float);
    float __builtin_rsqrtf (float);
    double __builtin_recipdiv (double, double);
    double __builtin_rsqrt (double);
    uint64_t __builtin_ppc_get_timebase ();
    unsigned long __builtin_ppc_mftb ();
    double __builtin_unpack_longdouble (long double, int);
    long double __builtin_pack_longdouble (double, double);

The `vec_rsqrt`, `__builtin_rsqrt`, and `__builtin_rsqrtf` functions generate multiple instructions to implement the reciprocal sqrt functionality using reciprocal sqrt estimate instructions.

The `__builtin_recipdiv`, and `__builtin_recipdivf` functions generate multiple instructions to implement division using the reciprocal estimate instructions.

The `__builtin_ppc_get_timebase` and `__builtin_ppc_mftb` functions generate instructions to read the Time Base Register. The `__builtin_ppc_get_timebase` function may generate multiple instructions and always returns the 64 bits of the Time Base Register. The `__builtin_ppc_mftb` function always generates one instruction and returns the Time Base Register value as an unsigned long, throwing away the most significant word on 32-bit environments.

The following built-in functions are available for the PowerPC family of processors, starting with ISA 2.06 or later (`-mcpu=power7` or `-mpopcntd`):

    long __builtin_bpermd (long, long);
    int __builtin_divwe (int, int);
    int __builtin_divweo (int, int);
    unsigned int __builtin_divweu (unsigned int, unsigned int);
    unsigned int __builtin_divweuo (unsigned int, unsigned int);
    long __builtin_divde (long, long);
    long __builtin_divdeo (long, long);
    unsigned long __builtin_divdeu (unsigned long, unsigned long);
    unsigned long __builtin_divdeuo (unsigned long, unsigned long);
    unsigned int cdtbcd (unsigned int);
    unsigned int cbcdtd (unsigned int);
    unsigned int addg6s (unsigned int, unsigned int);

The `__builtin_divde`, `__builtin_divdeo`, `__builtin_divdeu`, `__builtin_divdeou` functions require a 64-bit environment support ISA 2.06 or later.

The following built-in functions are available for the PowerPC family of processors when hardware decimal floating point (`-mhard-dfp`) is available:

    _Decimal64 __builtin_dxex (_Decimal64);
    _Decimal128 __builtin_dxexq (_Decimal128);
    _Decimal64 __builtin_ddedpd (int, _Decimal64);
    _Decimal128 __builtin_ddedpdq (int, _Decimal128);
    _Decimal64 __builtin_denbcd (int, _Decimal64);
    _Decimal128 __builtin_denbcdq (int, _Decimal128);
    _Decimal64 __builtin_diex (_Decimal64, _Decimal64);
    _Decimal128 _builtin_diexq (_Decimal128, _Decimal128);
    _Decimal64 __builtin_dscli (_Decimal64, int);
    _Decimal128 __builtin_dscliq (_Decimal128, int);
    _Decimal64 __builtin_dscri (_Decimal64, int);
    _Decimal128 __builtin_dscriq (_Decimal128, int);
    unsigned long long __builtin_unpack_dec128 (_Decimal128, int);
    _Decimal128 __builtin_pack_dec128 (unsigned long long, unsigned long long);

The following built-in functions are available for the PowerPC family of processors when the Vector Scalar (vsx) instruction set is available:

    unsigned long long __builtin_unpack_vector_int128 (vector __int128_t, int);
    vector __int128_t __builtin_pack_vector_int128 (unsigned long long,
                                                    unsigned long long);

Next: PowerPC AltiVec/VSX Built-in Functions, Previous: picoChip Built-in Functions, Up: Target Builtins [Contents][Index]