[PATCH, rs6000] Use explicit casts for vec_sel argument 3 in intrinsic headers
Segher Boessenkool
segher@kernel.crashing.org
Tue Oct 23 01:35:00 GMT 2018
Hi Bill,
On Mon, Oct 22, 2018 at 01:29:15PM -0500, Bill Schmidt wrote:
> The vec_sel intrinsic is overloaded for multiple types. There are a
> couple of cases in our intrinsic compatibility headers where the types
> used don't match any allowable type signature. GCC is able to correctly
> infer which matching built-in function is meant, but not all compilers
> can. For compatibility, cast the third parameter correctly in the
> source code.
> --- gcc/config/rs6000/emmintrin.h (revision 265389)
> +++ gcc/config/rs6000/emmintrin.h (working copy)
> @@ -1766,7 +1766,7 @@ _mm_sll_epi64 (__m128i __A, __m128i __B)
> shmask = lshift < shmax;
> result = vec_vsld ((__v2du) __A, lshift);
> result = (__v2du) vec_sel ((__v2df) shmask, (__v2df) result,
> - (__v2df) shmask);
> + (vector unsigned long long) shmask);
shmask already is a proper type, just delete the cast? (And then fit this
on one line).
> --- gcc/config/rs6000/xmmintrin.h (revision 265389)
> +++ gcc/config/rs6000/xmmintrin.h (working copy)
> @@ -458,7 +458,7 @@ extern __inline __m128 __attribute__((__gnu_inline
> _mm_min_ps (__m128 __A, __m128 __B)
> {
> __m128 m = (__m128) vec_vcmpgtfp ((__v4sf) __B, (__v4sf) __A);
> - return vec_sel (__B, __A, m);
> + return vec_sel (__B, __A, (vector unsigned int)m);
m should not be type __m128, but maybe __v4si? The cast of the vec_vcmpgtfp
result can go away as well then, maybe.
Segher
More information about the Gcc-patches
mailing list