https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123759
Bug ID: 123759
Summary: LoongArch/LSX: properly using __lsx_vftintrne_w_s
requires a cast
Product: gcc
Version: 14.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: iv at altlinux dot org
Target Milestone: ---
__lsx_vftintrne_w_s converts a vector of 4 32-bit floats into a vector of 4
32-bit signed ints (v4i32). But it is defined as returning __m128i (a vector of
two 64-bit signed ints currently), so assigning its result to v4i32 fails
unless -flax-vector-conversions is specified:
$ cat test-vftintrne_w_s.c
#include <lsxintrin.h>
void test(__m128 arg) {
v4i32 tmp = __lsx_vftintrne_w_s(arg);
}
$ loongarch64-linux-gnu-gcc test-vftintrne_w_s.c
test-vftintrne_w_s.c: In function 'test':
test-vftintrne_w_s.c:5:5: note: use '-flax-vector-conversions' to permit
conversions between vectors with differing element types or numbers of subparts
5 | v4i32 tmp = __lsx_vftintrne_w_s(arg);
| ^~~~~
test-vftintrne_w_s.c:5:17: error: incompatible types when initializing type
'v4i32' using type '__m128i'
5 | v4i32 tmp = __lsx_vftintrne_w_s(arg);
| ^~~~~~~~~~~~~~~~~~~
While this can be worked around with -flax-vector-conversions or an explicit
cast, it would be nice if no workarounds would be required.
I'm using GCC 14.3.1, but the issue is reproducible with all GCC 14 and 15
versions for loongarch64 available at godbold.org, and seems to be present in
current master.