On Tue, Apr 22, 2014 at 4:21 PM, Michael Meissner
<meiss...@linux.vnet.ibm.com> wrote:
> This patch adds the last set of instructions in the ISA 2.05 (power6), ISA 
> 2.06
> (power7), and ISA 2.07 (power8) specifications as builtins.  As far as I know,
> this completes the set of user space instructions that users might want to use
> to the GCC compiler.  In addition, I added some 128-bit pack and unpack
> functions for the use of library maintainers that need to deal with the 
> 128-bit
> types as two 64-bit words.
>
> The builtins added are:
>
> 1. Extended divide instructions added in ISA 2.06:
> ==================================================
>
> 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);
>
> 2. BCD instructions added in ISA 2.06:
> ======================================
>
> unsigned int cdtbcd (unsigned int);
> unsigned int cbcdtd (unsigned int);
> unsigned int addg6s (unsigned int, unsigned int);
>
> 3. Decimal floating point instructions added in ISA 2.05:
> =========================================================
>
> _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 __builitn_dscliq (_Decimal128, int);
> _Decimal64 __builtin_dscri (_Decimal64, int);
> _Decimal128 __builitn_dscriq (_Decimal128, int);
>
> 4. 128-bit pack/unpack functions:
> =================================
>
> double __builtin_unpack_longdouble (long double, int);
> double __builtin_longdouble_dw0 (long double);
> double __builtin_longdouble_dw1 (long double);
> long double __builtin_pack_longdouble (double, double);
>
> unsigned long long __builtin_unpack_dec128 (_Decimal128, int);
> _Decimal128 __builtin_pack_dec128 (unsigned long long, unsigned long long);
>
> unsigned long long __builtin_unpack_vector_int128 (vector __int128_t, int);
> vector __int128_t __builtin_pack_vector_int128 (unsigned long long,
>                                                 unsigned long long);
>
> 5. BCD add/subtract instructions added in ISA 2.07:
> ===================================================
>
> vector __int128_t __builtin_bcdadd (vector __int128_t, vector__int128_t);
> int __builtin_bcdadd_lt (vector __int128_t, vector__int128_t);
> int __builtin_bcdadd_eq (vector __int128_t, vector__int128_t);
> int __builtin_bcdadd_gt (vector __int128_t, vector__int128_t);
> int __builtin_bcdadd_ov (vector __int128_t, vector__int128_t);
> vector __int128_t bcdsub (vector __int128_t, vector__int128_t);
> int __builtin_bcdsub_lt (vector __int128_t, vector__int128_t);
> int __builtin_bcdsub_eq (vector __int128_t, vector__int128_t);
> int __builtin_bcdsub_gt (vector __int128_t, vector__int128_t);
> int __builtin_bcdsub_ov (vector __int128_t, vector__int128_t);
>
> Note, there are two minor bugs that I found in writing the test cases, that I
> will submit as bugzillas to be fixed eventually.
>
> The first bug is the PowerPC extension: 'vector __int128_t' does not seem to
> work with LTO, which shows up when I wrote the test pack01.c.  I suspect this
> is some problem with the way 'vector' is implemented as a conditional keyword,
> along with the C family private type __int128_t that doesn't work together.  I
> used the vector_size attribute instead of the 'vector' keyword to work around
> this.
>
> The second bug is that pack01.c won't generate the correct code on power7
> little endian (the words get swapped in going between GPRs and VSX registers).
> On power8 it works, since we have the direct move instructions.  Since little
> endian powerpc 64-bit is officially only supported on power8 and above, I just
> made the test require power8.
>
> I've done bootstrap and make check with no regressions on power7 big endian,
> power8 big endian, and power8 little endian systems.  Can I install the
> patches?  I would prefer to upgrade both 4.8 and 4.9 as well, since we have
> moved the power8 enablement to those branches.

This patch is okay.

Please allow a few days on trunk before backporting to ensure that it
does not expose problem on other configurations.

The div[dw]e instructions could be utilized by divtidi3 and divdisi3,
but GCC does not have the infrastructure for that.

Thanks, David

Reply via email to