From patchwork Tue May 2 12:21:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 89330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp566723vqo; Tue, 2 May 2023 05:22:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7crx0i8Us6AQg7z0/mdj2O/7N43AYASaGhXyDvt+540khSDZSDi805yMg9C5YvMB6nN8p9 X-Received: by 2002:a17:906:d54b:b0:953:9b27:8f00 with SMTP id cr11-20020a170906d54b00b009539b278f00mr18793933ejc.74.1683030175008; Tue, 02 May 2023 05:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683030174; cv=none; d=google.com; s=arc-20160816; b=LV6jBExGT1dw2HfNRD1mjLJZa659Y1uGCCF4FspKwITzSEPvo9/0GlgPKKSlg9QmmX +dl+KSbYz5/DjAyk0Sp+uktGvqjnimwopOnTYcpSKfWJliiWVNUW5nND1kV3QH/Y/KV5 LH3jf6OrCxcZ+8Q0VX3LqZDMc2WAyWFcPQ4ienFaRMY7hjup2wyKTriZZrzEtfrohmCK 1qAHOPUFZ0+En2EFcvH5fz6j1+pZacBZapA7ieaqcy7FY1yedOG7MBMS244iH7TeqqJ9 RAkw0+DCEjfjHrE+Vz7XxFlx5dRfyKUIO0FZ6qJ+q2JpNcTji4CXI76ZZm+gPXv5JWcZ mMFg== 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:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=S/2HqpDd227vsSOIHw1gEwmbthP4RuC/1RcMDqeEBD0=; b=aXKv64I0YTINC0967T8b5EFS+0+jvV9qeiyeCqDz2Ab15PNvCg2SnXNv1C/MFp/Hm+ qMfhacJd8Bs+dMJ9EVxWKFxIexRCXUFrkx7UB/2QcVqp5guveaFvHNjteYrBAY7RmlNr ZZm/9Ru1ER/cXyIj64yVMXWYsICwgZVrLSs9ca61sayAkyFhb6fLlpRXOPyggUXbiK+a Dt3cFTVte4edz1E+pkq3VIHvOxsOLstH+S8cJyz/9BerFgJO4iyDiBOGg20a3lrVk88w Rm8aoR0ON/ixnsTa1mYziT3TfZfWq+D4PWFjR+JsIb/qMma6TcyxdLf5krIQnzuFgC47 CWQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=OUdIJQQx; 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 rg7-20020a1709076b8700b009572f7dadc5si20016343ejc.248.2023.05.02.05.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 05:22:54 -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=OUdIJQQx; 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 73E93385771E for ; Tue, 2 May 2023 12:22:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73E93385771E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683030167; bh=S/2HqpDd227vsSOIHw1gEwmbthP4RuC/1RcMDqeEBD0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=OUdIJQQxpzIafPhpsvLkzSEp3irmdUMaVvzgd+JidoNWx0or3NujVixaoMcGm7ooA dOvtP0E9YbGfXNYR5SjD0Ww0ngZgE4kHPu3DrA1pEkuli1Ur7jrjDRH3JK4UiHNfpU E4ugPKEGdIrqwGcqZUiifbeMAeBX4PA3kyo2lMpA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 629003858D1E for ; Tue, 2 May 2023 12:22:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 629003858D1E Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3023a56048bso3458364f8f.3 for ; Tue, 02 May 2023 05:22:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683030120; x=1685622120; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=S/2HqpDd227vsSOIHw1gEwmbthP4RuC/1RcMDqeEBD0=; b=NQwkTQPyOgZkeLvS4ec/+lNtdL5XbEITGah/JgZ3k9sCLIoL8D+obZkDvd815N2Jto myevyIrXInRwgBm6NKA9NICSMLZPG+9MKEdwD7r59p6sE+aDnLAZF6+MAbUSOgaDy5J+ OBoJN0xkDd2oMM6xYDj7AvH49YtrXoXyeSdkYqUV6r4x+7sT5aUqHphGG9xDNaEURQbL 1FjLOIzCpfH2LrD9WtDZUJvJte5zenchfUGEU1P/7VvvTTme9DOMBu5Lb1pg7hcBhYkX vMnaE79uLEryDKj9y2WCfCR62jymnOqtyoBBsQEDhx3Nbm8U44h8Ug8jJHwNQ0ctYih7 fh5Q== X-Gm-Message-State: AC+VfDxL0PQwhXNqOSKAN5XEYv7b9FBJDatA2JvR6T/C2fsOADpG1/lC Y0NgJuXGtxyReOU2UNIQydQXrQSvsDg= X-Received: by 2002:a5d:4b4f:0:b0:306:31b7:abed with SMTP id w15-20020a5d4b4f000000b0030631b7abedmr3252771wrs.59.1683030119908; Tue, 02 May 2023 05:21:59 -0700 (PDT) Received: from P-NTS-Evian.home (2a01cb05945b7e009bdc688723a24f31.ipv6.abo.wanadoo.fr. [2a01:cb05:945b:7e00:9bdc:6887:23a2:4f31]) by smtp.gmail.com with ESMTPSA id w12-20020adff9cc000000b0030635f6949fsm2159302wrr.103.2023.05.02.05.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 05:21:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: kito.cheng@sifive.com, juzhe.zhong@rivai.ai, Romain Naour Subject: [PATCH] RISC-V: fix build issue with gcc 4.9.x Date: Tue, 2 May 2023 14:21:55 +0200 Message-Id: <20230502122155.2576725-1-romain.naour@gmail.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: Romain Naour via Gcc-patches From: Romain Naour Reply-To: Romain Naour 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?1764785048896665009?= X-GMAIL-MSGID: =?utf-8?q?1764785048896665009?= GCC should still build with GCC 4.8.3 or newer [1] using C++03 by default. But a recent change in RISC-V port introduced a C++11 feature "std::log2" [2]. Use log2 from the C header, without the namespace [3]. [1] https://gcc.gnu.org/install/prerequisites.html [2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc [3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std Fixes: https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589 gcc/ChangeLog: * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header, without the namespace. Signed-off-by: Romain Naour --- gcc/config/riscv/genrvv-type-indexer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc index e677b55290c..eebe382d1c3 100644 --- a/gcc/config/riscv/genrvv-type-indexer.cc +++ b/gcc/config/riscv/genrvv-type-indexer.cc @@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, unsigned eew, bool unsigned_p, if (sew == eew) elmul_log2 = lmul_log2; else if (sew > eew) - elmul_log2 = lmul_log2 - std::log2 (sew / eew); + elmul_log2 = lmul_log2 - log2 (sew / eew); else /* sew < eew */ - elmul_log2 = lmul_log2 + std::log2 (eew / sew); + elmul_log2 = lmul_log2 + log2 (eew / sew); if (float_p) return floattype (eew, elmul_log2);