From patchwork Wed Apr 17 07:57:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kretz X-Patchwork-Id: 1924528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VKCvF4Zp8z1yYB for ; Wed, 17 Apr 2024 17:58:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A384F3858C53 for ; Wed, 17 Apr 2024 07:57:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from lxmtout2.gsi.de (lxmtout2.gsi.de [140.181.3.112]) by sourceware.org (Postfix) with ESMTPS id 7E0873858D20; Wed, 17 Apr 2024 07:57:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E0873858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gsi.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gsi.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7E0873858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.181.3.112 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713340660; cv=none; b=Sylw5/ImY8PprbMGW0ysDQYaJStvcONd8uZ/XiRlR7h7mRIIXRfajnfIG/suMs0Mz0WGpDDka+6aoOnj4w4DlqL9ZER8ukkUMVaVpKrdSFe0yHaYnNxkQDnsP2YEdSf2LMCWKil4uQhrceRV/YZQ674icnaWaDtfxHRzrBMz83M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713340660; c=relaxed/simple; bh=njWYFFbqkEjjkuxJdtPDiIPPMg6roawqL588G08zjog=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=WVF1Nfl+saHPHphKcl05hRdnJtf20D377/+ZR8vHdR3loNoyuAFLIyWYq2i/8urXzUzWS7vY5ta73YMAEDD2niac0DcehwNkX02u6oKKZ7UgOPFuRPcJJaavH04ZEgO3PWZyyvTl+FmGcNYJYHVOun2vkwjn2Rp8ljNkbt5Vu6w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by lxmtout2.gsi.de (Postfix) with ESMTP id 389A320350E8; Wed, 17 Apr 2024 09:57:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at lxmtout2.gsi.de Received: from lxmtout2.gsi.de ([127.0.0.1]) by localhost (lxmtout2.gsi.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id o_pMyDIbgfiX; Wed, 17 Apr 2024 09:57:37 +0200 (CEST) Received: from srvEX8.campus.gsi.de (unknown [10.10.4.160]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lxmtout2.gsi.de (Postfix) with ESMTPS id 19E2420350E2; Wed, 17 Apr 2024 09:57:37 +0200 (CEST) Received: from minbar.localnet (140.181.3.12) by srvEX8.campus.gsi.de (10.10.4.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 17 Apr 2024 09:57:36 +0200 From: Matthias Kretz To: , Subject: [PATCH] libstdc++: Avoid ill-formed types on ARM Date: Wed, 17 Apr 2024 09:57:36 +0200 Message-ID: <15472051.tv2OnDr8pf@minbar> Organization: GSI Helmholtz Center for Heavy Ion Research MIME-Version: 1.0 X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvEX7.Campus.gsi.de (10.10.4.97) To srvEX8.campus.gsi.de (10.10.4.160) X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested on arm-linux-gnueabihf, powerpc64le-linux-gnu, and aarch64-linux-gnu. OK for trunk and backports? ----------------------------- 8< -------------------------- This resolves failing tests in check-simd. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/114750 * include/experimental/bits/simd_builtin.h (_SimdImplBuiltin::_S_load, _S_store): Fall back to copying scalars if the memory type cannot be vectorized for the target. --- libstdc++-v3/include/experimental/bits/simd_builtin.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- ────────────────────────────────────────────────────────────────────────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de stdₓ::simd ────────────────────────────────────────────────────────────────────────── diff --git a/libstdc++-v3/include/experimental/bits/simd_builtin.h b/libstdc++-v3/include/experimental/bits/simd_builtin.h index 28227a5d97f..af0c4886108 100644 --- a/libstdc++-v3/include/experimental/bits/simd_builtin.h +++ b/libstdc++-v3/include/experimental/bits/simd_builtin.h @@ -1464,7 +1464,7 @@ _S_broadcast(_Tp __x) noexcept [&](auto __i) constexpr { return static_cast<_Tp>(__i < _Np ? __mem[__i] : 0); }); - else if constexpr (sizeof(_Up) > 8) + else if constexpr (sizeof(_Up) > 8 or __vectorized_sizeof<_Up>() <= sizeof(_Up)) return __generate_vector<_Tp, _SimdMember<_Tp>::_S_full_size>( [&](auto __i) constexpr _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { return static_cast<_Tp>(__i < _Np ? __mem[__i] : 0); @@ -1536,7 +1536,7 @@ _S_masked_load(_SimdWrapper<_Tp, _Np> __merge, _MaskMember<_Tp> __k, for (size_t __i = 0; __i < _Np; ++__i) __mem[__i] = __v[__i]; } - else if constexpr (sizeof(_Up) > 8) + else if constexpr (sizeof(_Up) > 8 or __vectorized_sizeof<_Up>() <= sizeof(_Up)) __execute_n_times<_Np>([&](auto __i) constexpr _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { __mem[__i] = __v[__i]; });