From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 585EC3858C41; Fri, 31 May 2024 08:47:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 585EC3858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717145278; bh=P2BFanOb0M8zoE0i7ZvNNb8QklkTB++FXDngbjx0UXk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K4WC1hzNytlKGPgnwUSlSoJ5Db2JuRZ8ye7QrjMq+/cZzuhr7V15IsnrtaNPw46v3 DGrb3PqFcKgpCz88+6JMjgM3zK7imGrM8YERgn07GAhrke9tJ3HqZ6ofxynxQGE1Se XCB4lOsjVTiPq88y+3az6lAGuDxOWOI4EQ9/jlM4= From: "mkretz at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h Date: Fri, 31 May 2024 08:47:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mkretz at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mkretz at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114803 --- Comment #9 from Matthias Kretz (Vir) --- (In reply to Alexandre Oliva from comment #7) > FWIW, since the backport, this test started failing in gcc-13 on arm and > aarch64 targets. Presumably this affects earlier branches as well. >=20 > .../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: = In > instantiation of 'void maybe_test() [with T =3D char]': > .../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc:8= 7:=20 > required from here > .../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc:6= 8: > error: invalid 'static_cast' from type 'V' {aka > 'std::experimental::parallelism_v2::simd std::experimental::parallelism_v2::simd_abi::_VecBuiltin<16> >'} to type > 'uint8x16_t' I tested on aarch64-linux-gnu and arm-linux-gnueabi before and after the backport and there were no regressions. What target do I need to add to my list? The specific error you report is rather puzzling. Basically an integral, si= zeof 1, not signed char, when packed into a simd is not explicitly convert= ible to uint8x16_t. The simd is defined to be convertible to its underlying intrinsic type which is determined in libstdc++-v3/include/experimental/bits/simd.h and goes like this: 'char' has no full specialization for '__intrinsic_type' (unless 'char' is the *same* type as 'signed char' or 'unsigned char') and thus pic= ks the partial specialization of __intrinsic_type. This in turn determines the corresponding signed integer type to be 'signed char'. Depending on whether 'is_unsigned_v' is true, it subsequently applies 'make_unsigned_t'. It then uses the __intrinsic_type_t of that, which is either int8x16_t or uint8x16_t depending on 'is_unsigned_v'. This=