LoongArch: Make __builtin_lsx_vorn_v and __builtin_lasx_xvorn_v arguments and return values unsigned

Align them with other vector bitwise builtins.

This may break programs directly invoking __builtin_lsx_vorn_v or
__builtin_lasx_xvorn_v, but doing so is not supported (as builtins are
not documented, only intrinsics are documented and users should use them
instead).

gcc/ChangeLog:

	* config/loongarch/loongarch-builtins.cc (vorn_v, xvorn_v): Use
	unsigned vector modes.
	* config/loongarch/lsxintrin.h (__lsx_vorn_v): Cast arguments to
	v16u8.
	* config/loongarch/lasxintrin.h (__lasx_xvorn_v): Cast arguments
	to v32u8.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/lsx/lsx-builtin.c (__lsx_vorn_v):
	Change arguments and return value to v16u8.
	* gcc.target/loongarch/vector/lasx/lasx-builtin.c
	(__lasx_xvorn_v): Change arguments and return value to v32u8.
This commit is contained in:
Xi Ruoyao 2024-10-31 23:58:23 +08:00 committed by Lulu Cheng
parent 8500a8c32b
commit ae7e25662f
5 changed files with 10 additions and 10 deletions

View File

@ -3564,11 +3564,11 @@ __m256i __lasx_xvssrln_w_d (__m256i _1, __m256i _2)
}
/* Assembly instruction format: xd, xj, xk. */
/* Data types in instruction templates: V32QI, V32QI, V32QI. */
/* Data types in instruction templates: UV32QI, UV32QI, UV32QI. */
extern __inline __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__m256i __lasx_xvorn_v (__m256i _1, __m256i _2)
{
return (__m256i)__builtin_lasx_xvorn_v ((v32i8)_1, (v32i8)_2);
return (__m256i)__builtin_lasx_xvorn_v ((v32u8)_1, (v32u8)_2);
}
/* Assembly instruction format: xd, i13. */

View File

@ -1569,7 +1569,7 @@ static const struct loongarch_builtin_description loongarch_builtins[] = {
LSX_BUILTIN (vssrln_b_h, LARCH_V16QI_FTYPE_V8HI_V8HI),
LSX_BUILTIN (vssrln_h_w, LARCH_V8HI_FTYPE_V4SI_V4SI),
LSX_BUILTIN (vssrln_w_d, LARCH_V4SI_FTYPE_V2DI_V2DI),
LSX_BUILTIN (vorn_v, LARCH_V16QI_FTYPE_V16QI_V16QI),
LSX_BUILTIN (vorn_v, LARCH_UV16QI_FTYPE_UV16QI_UV16QI),
LSX_BUILTIN (vldi, LARCH_V2DI_FTYPE_HI),
LSX_BUILTIN (vshuf_b, LARCH_V16QI_FTYPE_V16QI_V16QI_V16QI),
LSX_BUILTIN (vldx, LARCH_V16QI_FTYPE_CVPOINTER_DI),
@ -2119,7 +2119,7 @@ static const struct loongarch_builtin_description loongarch_builtins[] = {
LASX_BUILTIN (xvssrln_b_h, LARCH_V32QI_FTYPE_V16HI_V16HI),
LASX_BUILTIN (xvssrln_h_w, LARCH_V16HI_FTYPE_V8SI_V8SI),
LASX_BUILTIN (xvssrln_w_d, LARCH_V8SI_FTYPE_V4DI_V4DI),
LASX_BUILTIN (xvorn_v, LARCH_V32QI_FTYPE_V32QI_V32QI),
LASX_BUILTIN (xvorn_v, LARCH_UV32QI_FTYPE_UV32QI_UV32QI),
LASX_BUILTIN (xvldi, LARCH_V4DI_FTYPE_HI),
LASX_BUILTIN (xvldx, LARCH_V32QI_FTYPE_CVPOINTER_DI),
LASX_NO_TARGET_BUILTIN (xvstx, LARCH_VOID_FTYPE_V32QI_CVPOINTER_DI),

View File

@ -4745,11 +4745,11 @@ __m128i __lsx_vssrln_w_d (__m128i _1, __m128i _2)
}
/* Assembly instruction format: vd, vj, vk. */
/* Data types in instruction templates: V16QI, V16QI, V16QI. */
/* Data types in instruction templates: UV16QI, UV16QI, UV16QI. */
extern __inline __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__m128i __lsx_vorn_v (__m128i _1, __m128i _2)
{
return (__m128i)__builtin_lsx_vorn_v ((v16i8)_1, (v16i8)_2);
return (__m128i)__builtin_lsx_vorn_v ((v16u8)_1, (v16u8)_2);
}
/* Assembly instruction format: vd, i13. */

View File

@ -3178,8 +3178,8 @@ __lasx_xvssrln_w_d (v4i64 _1, v4i64 _2)
{
return __builtin_lasx_xvssrln_w_d (_1, _2);
}
v32i8
__lasx_xvorn_v (v32i8 _1, v32i8 _2)
v32u8
__lasx_xvorn_v (v32u8 _1, v32u8 _2)
{
return __builtin_lasx_xvorn_v (_1, _2);
}

View File

@ -4006,8 +4006,8 @@ __lsx_vssrln_w_d (v2i64 _1, v2i64 _2)
{
return __builtin_lsx_vssrln_w_d (_1, _2);
}
v16i8
__lsx_vorn_v (v16i8 _1, v16i8 _2)
v16u8
__lsx_vorn_v (v16u8 _1, v16u8 _2)
{
return __builtin_lsx_vorn_v (_1, _2);
}