]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000, fix error in unsigned vector float to unsigned int built-in definitions
authorCarl Love <cel@linux.ibm.com>
Tue, 9 Jul 2024 17:17:28 +0000 (13:17 -0400)
committerCarl Love <cel@linux.ibm.com>
Tue, 9 Jul 2024 17:34:39 +0000 (13:34 -0400)
commit6031e34af130d114a7a3de0108fdb39360e8b1b3
treeab57d3eb9ac48ce753ceb437a812c43666478501
parent224cc560a6ac19c9454038efe6230096b46f4806
rs6000, fix error in unsigned vector float to unsigned int built-in definitions

The built-in __builtin_vsx_vunsigned_v2df is supposed to take a vector of
doubles and return a vector of unsigned long long ints.  Similarly
__builtin_vsx_vunsigned_v4sf takes a vector of floats an is supposed to
return a vector of unsinged ints.  The definitions are using the signed
version of the instructions not the unsigned version of the instruction.
The results should also be unsigned.  The built-ins are used by the
overloaded vec_unsigned built-in which has an unsigned result.

Similarly the built-ins __builtin_vsx_vunsignede_v2df and
__builtin_vsx_vunsignedo_v2df are supposed to return an unsigned result.
If the floating point argument is negative, the unsigned result is zero.
The built-ins are used in the overloaded built-in vec_unsignede and
vec_unsignedo respectively.

Add a test cases for a negative floating point arguments for each of the
above built-ins.

gcc/ChangeLog:
* config/rs6000/rs6000-builtins.def (__builtin_vsx_vunsigned_v2df,
__builtin_vsx_vunsigned_v4sf, __builtin_vsx_vunsignede_v2df,
__builtin_vsx_vunsignedo_v2df): Change the result type to unsigned.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/builtins-3-runnable.c: Add tests for
vec_unsignede and vec_unsignedo with negative arguments.
gcc/config/rs6000/rs6000-builtins.def
gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c