Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi (revision 239612)
+++ gcc/doc/extend.texi (working copy)
@@ -15019,6 +15019,139 @@ The @code{__builtin_dfp_dtstsfi_ov_dd} and
require that the type of the @code{value} argument be
@code{__Decimal64} and @code{__Decimal128} respectively.
+The following built-in functions are also available for the PowerPC family
+of processors, starting with ISA 3.0 or later
+(@option{-mcpu=power9}). These string functions are described
+separately in order to group the descriptions closer to the function
+prototypes:
+@smallexample
+int vec_all_nez (vector signed char, vector signed char)
Just a nit but in the existing documentation and in most of added
functions below the declarations end in a semicolon but a few are
missing it.
+signed int vec_cntlz_lsbb (vector signed char);
+signed int vec_cntlz_lsbb (vector unsigned char)
+
+signed int vec_cnttz_lsbb (vector signed char);
+signed int vec_cnttz_lsbb (vector unsigned char);
...
+The @code{vec_cntlz_lsbb} function returns the count of the number of
+consecutive leading byte elements (starting from position 0 within the
+supplied vector argument) for which the least-significant bit
+equals zero. The @code{vec_cnttz_lsbb} function returns the count of
+the number of consecutive trailing byte elements (starting from
+position 15 and counting backwards within the supplied vector
+argument) for which the least-significant bit equals zero.
Since these return a non-negative result I'm wondering if it would
make more sense to declare them to return unsigned rather a "signed
int." Alternatively (and I admit I have no idea if this is even
doable in the back end), since the return value is within a narrow
range of unsigned integers (between zero and 16, IIUC) would it be
possible to constrain the range of its return values, like for
the scalar __builtin_popcount? That way the branches in f0 below
would be eliminated the same way as in f1:
int f0 (__vector unsigned char v)
{
int n = __builtin_vec_vclzlsbb (v);
if (n < 0 || 16 < n)
__builtin_abort ();
return n;
}
int f1 (int i)
{
int n = __builtin_popcount (i);
if (n < 0 || 32 < n)
__builtin_abort ();
return n;
}
Martin