From patchwork Mon May 22 15:32:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Kretz X-Patchwork-Id: 97512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1536311vqo; Mon, 22 May 2023 08:33:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RMg6qp9ua2VXc9LxT32qZ2+zsbxSq5xkfFaXyjDOHt/MhsOHDpvysg0osUof+uVwobUzc X-Received: by 2002:aa7:db57:0:b0:50b:ca1b:adeb with SMTP id n23-20020aa7db57000000b0050bca1badebmr8950098edt.0.1684769636293; Mon, 22 May 2023 08:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684769636; cv=none; d=google.com; s=arc-20160816; b=rHcyrL63Svj/rb4A4MiHH1nP0T7HMI05WX2JOZUoB25QewAN7cXFWwFAYtp7T6vp5/ WMSz8YD8pR9lljFM9gNPT9rvxqk8ocFSayD3NhZwPw3TGoAyAG40QtJ9RllgL8WRezTV UoGP4WGKJytSB43ZbKquK8CiD4KU/8NN+LwVaJNNe6iupKc0zbMGR7zp4FJY25bQfIAm iylAOxnvNKyV1SwsVQbTOZymYR7hmQ3Uy/+E33aZ3Xn4aLSPHQvmCSv/Iy4xpkucuOoL cPfQ6DrYWlH+9rqPxN/ZSocvWTEKTqqi48kvjunHlpymqABSJiuhfy5X7TXvIwNW1Hdv YENA== 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:organization:message-id:date :subject:to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=KUI/NdUyYNYANjJh47ADq5n3rSvbEzp+jbqPqWTM5D4=; b=unCzkoKjzn2JTkR7+yLsGsme17aqPpz+FuU34fyRDmyRf8X4z6dVgcOZ9VbfIMvLbc c2x44F958GJvP/0r978sjFyWdsBuDvk01yGSo9RJRVHxvft6ZDk/P9jV4LCc2muh0NoG X6/1LNruwgUnPBo5J6ZnoHTTZVsmp4JOKH5KBZWLr62HlcfuNHUGbY5y3gCRXYqRGiEL SB4FHuUlMic5Zbw4uDXQiHAJ1Fg+cINFxUmALfmQIgRYNoJ7hvMatcNzay17MAcW32So 9040sEkPmyCKsMCXHQ7NjgDVcM3TE0xeNjykyiANuqEd87TwnvcGoA8OG4cgwKpwoRkZ 8O6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SXxmjvqZ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id k7-20020aa7d8c7000000b00506934d9569si3941504eds.227.2023.05.22.08.33.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 08:33:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SXxmjvqZ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 B224D3857719 for ; Mon, 22 May 2023 15:33:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B224D3857719 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684769622; bh=KUI/NdUyYNYANjJh47ADq5n3rSvbEzp+jbqPqWTM5D4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SXxmjvqZn95M3vL8OayGb1noXlSLXPhXD4TBxyN1m2XET5+lCFbJDiSnxIGM1Aw1+ w2E/g37vsSzrrfbbgAnezVwbLb4eetmx4QSq8DCQaAAnbwRUxu3wsmNo5sMGx6//X0 G6LmiNbX6ARnvwIT0CEvtbxxlE5F9dMHOCPxc8S4= 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 CF7583858D35; Mon, 22 May 2023 15:32:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF7583858D35 Received: from localhost (localhost [127.0.0.1]) by lxmtout2.gsi.de (Postfix) with ESMTP id C779D202AD46; Mon, 22 May 2023 17:32:46 +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 MbwvviRMPGD8; Mon, 22 May 2023 17:32:46 +0200 (CEST) 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 A47882038F7C; Mon, 22 May 2023 17:32:46 +0200 (CEST) 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.26; Mon, 22 May 2023 17:32:46 +0200 To: , Subject: [committed] libstdc++: Resolve -Wunused-variable warnings in stdx::simd and tests Date: Mon, 22 May 2023 17:32:45 +0200 Message-ID: <5868460.taCxCBeP46@minbar> Organization: GSI Helmholtz Centre for Heavy Ion Research MIME-Version: 1.0 X-Originating-IP: [140.181.3.12] X-ClientProxiedBy: srvEX6.Campus.gsi.de (10.10.4.96) To srvEX6.campus.gsi.de (10.10.4.96) X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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?1766609005695096302?= X-GMAIL-MSGID: =?utf-8?q?1766609005695096302?= pushed to master, will backport later regtested on x86_64-linux Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_builtin.h (_S_fpclassify): Move __infn into #ifdef'ed block. * testsuite/experimental/simd/tests/fpclassify.cc: Declare constants only when used. * testsuite/experimental/simd/tests/frexp.cc: Likewise. * testsuite/experimental/simd/tests/logarithm.cc: Likewise. * testsuite/experimental/simd/tests/trunc_ceil_floor.cc: Likewise. * testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc: Move totest and expect1 into #ifdef'ed block. --- libstdc++-v3/include/experimental/bits/simd_builtin.h | 4 ++-- .../testsuite/experimental/simd/tests/fpclassify.cc | 2 ++ libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc | 6 ++++++ .../experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc | 4 ++-- libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc | 4 +++- .../testsuite/experimental/simd/tests/trunc_ceil_floor.cc | 2 ++ 6 files changed, 17 insertions(+), 5 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 4c008da26e0..3d52bc6c96a 100644 --- a/libstdc++-v3/include/experimental/bits/simd_builtin.h +++ b/libstdc++-v3/include/experimental/bits/simd_builtin.h @@ -2370,12 +2370,12 @@ _S_fpclassify(_SimdWrapper<_Tp, _Np> __x) constexpr size_t _NI = sizeof(__xn) / sizeof(_I); _GLIBCXX_SIMD_USE_CONSTEXPR auto __minn = __vector_bitcast<_I>(__vector_broadcast<_NI>(__norm_min_v<_Tp>)); - _GLIBCXX_SIMD_USE_CONSTEXPR auto __infn - = __vector_bitcast<_I>(__vector_broadcast<_NI>(__infinity_v<_Tp>)); _GLIBCXX_SIMD_USE_CONSTEXPR auto __fp_normal = __vector_broadcast<_NI, _I>(FP_NORMAL); #if !__FINITE_MATH_ONLY__ + _GLIBCXX_SIMD_USE_CONSTEXPR auto __infn + = __vector_bitcast<_I>(__vector_broadcast<_NI>(__infinity_v<_Tp>)); _GLIBCXX_SIMD_USE_CONSTEXPR auto __fp_nan = __vector_broadcast<_NI, _I>(FP_NAN); _GLIBCXX_SIMD_USE_CONSTEXPR auto __fp_infinite diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc b/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc index 00c608f9530..13262df80ac 100644 --- a/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc +++ b/libstdc++-v3/testsuite/experimental/simd/tests/fpclassify.cc @@ -38,9 +38,11 @@ test() { using T = typename V::value_type; using intv = std::experimental::fixed_size_simd; +#if __GCC_IEC_559 >= 2 constexpr T inf = std::__infinity_v; constexpr T denorm_min = std::__infinity_v; constexpr T nan = std::__quiet_NaN_v; +#endif constexpr T max = std::__finite_max_v; constexpr T norm_min = std::__norm_min_v; test_values( diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc b/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc index f6a47cedd13..2c3f500beee 100644 --- a/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc +++ b/libstdc++-v3/testsuite/experimental/simd/tests/frexp.cc @@ -25,11 +25,17 @@ test() { using int_v = std::experimental::fixed_size_simd; using T = typename V::value_type; +#if __GCC_IEC_559 >= 2 || defined __STDC_IEC_559__ constexpr auto denorm_min = std::__denorm_min_v; +#endif +#if __GCC_IEC_559 >= 2 constexpr auto norm_min = std::__norm_min_v; +#endif constexpr auto max = std::__finite_max_v; +#if defined __STDC_IEC_559__ constexpr auto nan = std::__quiet_NaN_v; constexpr auto inf = std::__infinity_v; +#endif test_values( {0, 0.25, 0.5, 1, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 31, -0., -0.25, -0.5, -1, diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc b/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc index 0fb1338fc04..56e275ee4bf 100644 --- a/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc +++ b/libstdc++-v3/testsuite/experimental/simd/tests/ldexp_scalbn_scalbln_modf.cc @@ -137,7 +137,6 @@ test() if (modf_is_broken) return; V integral = {}; - const V totest = modf(input, &integral); auto&& expected = [&](const auto& v) -> std::pair { std::pair tmp = {}; using std::modf; @@ -149,8 +148,9 @@ test() } return tmp; }; - const auto expect1 = expected(input); #ifdef __STDC_IEC_559__ + const V totest = modf(input, &integral); + const auto expect1 = expected(input); COMPARE(isnan(totest), isnan(expect1.first)) << "modf(" << input << ", iptr) = " << totest << " != " << expect1; COMPARE(isnan(integral), isnan(expect1.second)) diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc b/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc index 31ad1499e00..a4a46c95800 100644 --- a/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc +++ b/libstdc++-v3/testsuite/experimental/simd/tests/logarithm.cc @@ -27,11 +27,13 @@ test() vir::test::setFuzzyness(1); using T = typename V::value_type; +#ifdef __STDC_IEC_559__ constexpr T nan = std::__quiet_NaN_v; constexpr T inf = std::__infinity_v; constexpr T denorm_min = std::__denorm_min_v; - constexpr T norm_min = std::__norm_min_v; constexpr T min = std::__finite_min_v; +#endif + constexpr T norm_min = std::__norm_min_v; constexpr T max = std::__finite_max_v; test_values({1, 2, diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc b/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc index ecbc1481600..f2ef8088f73 100644 --- a/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc +++ b/libstdc++-v3/testsuite/experimental/simd/tests/trunc_ceil_floor.cc @@ -24,8 +24,10 @@ test() { using T = typename V::value_type; +#ifdef __STDC_IEC_559__ constexpr T inf = std::__infinity_v; constexpr T denorm_min = std::__denorm_min_v; +#endif constexpr T norm_min = std::__norm_min_v; constexpr T max = std::__finite_max_v; constexpr T min = std::__finite_min_v;