From patchwork Wed Feb 15 20:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kretz X-Patchwork-Id: 57725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp413258wrn; Wed, 15 Feb 2023 12:57:35 -0800 (PST) X-Google-Smtp-Source: AK7set/UEhEd39E73b0rTG4sx2nhxeEbshnpz6aPpmLX3JihrtHGZ9rsA0VWzrZ3Z20JHQpTILnv X-Received: by 2002:a17:906:79d0:b0:860:c12c:14f9 with SMTP id m16-20020a17090679d000b00860c12c14f9mr3629602ejo.40.1676494655079; Wed, 15 Feb 2023 12:57:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676494655; cv=none; d=google.com; s=arc-20160816; b=aEnBw1Ww6JiuEjpNRsgHyqsh5VWdP3iicLSb+RHWyA9VpeIcOYA+2ho6A0Iykj0JAt D/khohvOg+v5cVnS2Ff2x4SYtk81F+EX2Iu1Vacrnx8/Q0+EV9WYk8dx5pI3KZxiRR5o 9sOG4TXjBR08j324rIAZjYdZeBs+TGJQi8Cuu84JjHBL6Ja7PjSS/hqTaky0bMJlxGHE fPORAPrAiK/Wr0kuccnIpIuwyO0h91LaQjq0ju3swIz0G05M5GeCFvZBlg1jeJjuVZGR VZwHkGH3XVi1+U86Ua2xrAS0Uz81b3c1vrY1mingezGJ4OsVPOLkszLrxiDKzurW7uA0 /exA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :organization:message-id:date:subject:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=vsiWBVaqTW36WJF2uQ+UG7ny5T2JvptPguE6Kpkcc4E=; b=eJa0FGn3y7vG5f0eFPcrva1fqPhEcsRXWQUOpaP6RSFvLDy21NJcJsK5t0ilbQd/OC n59Sarj76hbXPWVhDC0+5BiIB/OQzJExv6dfnZx+q6pMGPvhWu1Yh9GfnkEY6vClmbPM pOScoj4xmRX75UDUT7FLzjktL07tP1MeoJv1NZ+M7aCpOALcSPY+gko4UIXMlDUrckv6 4LhAg7gS4gkEtMcLGCVdDGk3mdsrZXX5HJPRMkO5qj6Nu5fgRTTm03lA7yVd3XG6Ef4c Q8TqqF7OR1h95uH/lNShVNG6E1BBdfaZBxHJgVzp50u70GnGBhrw5+XgbLowaQhLYYW6 wPVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=r1kuiMi1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 1-20020a170906100100b008b12654c973si8836393ejm.269.2023.02.15.12.57.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 12:57:35 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=r1kuiMi1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3AE833882FC6 for ; Wed, 15 Feb 2023 20:53:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AE833882FC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676494424; bh=vsiWBVaqTW36WJF2uQ+UG7ny5T2JvptPguE6Kpkcc4E=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=r1kuiMi1xLCAZvpYnOQ4XEuwBgDEbWbHqpwjY//U2YriB+Pvf6agG81SvIz79ENC/ Uq6tE+rUxhsSXUlGpJa5QrvyQ/ttm0uhG8vI4ULnG7z2Plt0A35kxov+M5H/LUFv9M 4VY9xy5lSGFNhBQlL5k3CC2UhFR05hpY6m+ujgWs= 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 6655B38493FD; Wed, 15 Feb 2023 20:50:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6655B38493FD Received: from localhost (localhost [127.0.0.1]) by lxmtout2.gsi.de (Postfix) with ESMTP id 9F9C6202AD5E; Wed, 15 Feb 2023 21:50:08 +0100 (CET) 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 d0jQKvauu6A0; Wed, 15 Feb 2023 21:50:08 +0100 (CET) Received: from srvEX6.campus.gsi.de (unknown [10.10.4.96]) (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 80100202AD51; Wed, 15 Feb 2023 21:50:08 +0100 (CET) Received: from minbar.localnet (140.181.3.12) by srvEX6.campus.gsi.de (10.10.4.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Wed, 15 Feb 2023 21:50:08 +0100 To: , Subject: [PATCH 6/7] libstdc++: Fix incorrect __builtin_is_constant_evaluated calls Date: Wed, 15 Feb 2023 21:50:07 +0100 Message-ID: <45331655.fMDQidcC6G@minbar> Organization: GSI Helmholtz Centre for Heavy Ion Research In-Reply-To: <3238840.44csPzL39Z@minbar> References: <3238840.44csPzL39Z@minbar> MIME-Version: 1.0 X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvex5.Campus.gsi.de (10.10.4.95) To srvEX6.campus.gsi.de (10.10.4.96) X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Matthias Kretz via Gcc-patches From: Matthias Kretz Reply-To: Matthias Kretz Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757932059606470788?= X-GMAIL-MSGID: =?utf-8?q?1757932059606470788?= Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_SimdImplX86::_S_not_equal_to, _SimdImplX86::_S_less) (_SimdImplX86::_S_less_equal): Do not call __builtin_is_constant_evaluated in constexpr-if. --- .../include/experimental/bits/simd_x86.h | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 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_x86.h b/libstdc++-v3/include/experimental/bits/simd_x86.h index 60e80d394ba..dcfdc2a9496 100644 --- a/libstdc++-v3/include/experimental/bits/simd_x86.h +++ b/libstdc++-v3/include/experimental/bits/simd_x86.h @@ -2344,15 +2344,16 @@ template else __assert_unreachable<_Tp>(); } // }}} - else if constexpr (!__builtin_is_constant_evaluated() // {{{ - && sizeof(__x) == 8) + else if (__builtin_is_constant_evaluated()) + return _Base::_S_not_equal_to(__x, __y); + else if constexpr (sizeof(__x) == 8) { const auto __r128 = __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__x) != __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__y); _MaskMember<_Tp> __r64; __builtin_memcpy(&__r64._M_data, &__r128, sizeof(__r64)); return __r64; - } // }}} + } else return _Base::_S_not_equal_to(__x, __y); } @@ -2451,15 +2452,16 @@ template else __assert_unreachable<_Tp>(); } // }}} - else if constexpr (!__builtin_is_constant_evaluated() // {{{ - && sizeof(__x) == 8) + else if (__builtin_is_constant_evaluated()) + return _Base::_S_less(__x, __y); + else if constexpr (sizeof(__x) == 8) { const auto __r128 = __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__x) < __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__y); _MaskMember<_Tp> __r64; __builtin_memcpy(&__r64._M_data, &__r128, sizeof(__r64)); return __r64; - } // }}} + } else return _Base::_S_less(__x, __y); } @@ -2558,15 +2560,16 @@ template else __assert_unreachable<_Tp>(); } // }}} - else if constexpr (!__builtin_is_constant_evaluated() // {{{ - && sizeof(__x) == 8) + else if (__builtin_is_constant_evaluated()) + return _Base::_S_less_equal(__x, __y); + else if constexpr (sizeof(__x) == 8) { const auto __r128 = __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__x) <= __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__y); _MaskMember<_Tp> __r64; __builtin_memcpy(&__r64._M_data, &__r128, sizeof(__r64)); return __r64; - } // }}} + } else return _Base::_S_less_equal(__x, __y); }