From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 773F33850426; Fri, 20 Aug 2021 15:21:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 773F33850426 From: "mhillen at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/101876] [s390x] vector builtin vec_permi fails to resolve with #pragma GCC target Date: Fri, 20 Aug 2021 15:21:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mhillen at linux dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 15:21:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101876 --- Comment #3 from Marius Hillenbrand --- The issue is caused by inconsistent alignment of vector_types between the t= ypes (a) expected or returned by builtin functions and (b) the typedef in the example code. In the failing cases, there's a mismatch of 16-Byte and 8-Byte (compliant with the ABI) alignment. In the successful cases, either both use 16-Byte or 8-Byte alignment. When gcc starts, s390_init_builtins defines builtin functions with their corresponding type information. That includes vector builtins. While creati= ng the builtin types for these builtins, when gcc starts with -march < z13, th= en s390_vector_alignment defers to default_vector_alignment, which results in natural alignment. That results in 16-Byte alignment of the 16-Byte vectors. Once the pragma switched to an arch level with VX support (TARGET_VX and TARGET_VX_ABI are true), then s390_vector_alignment selects 8-Byte alignmen= t in accordance with the vector ABI. The C++ example (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101877) ICEs because two structurally identical vector types have different canonical ty= pes (as a result of the different alignment?!).=