From patchwork Tue Nov 10 22:59:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1397837 X-Patchwork-Delegate: rsalvaterra@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Mp3rtkzK; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=RA6kNcvT; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CW3K02BLDz9sRK for ; Wed, 11 Nov 2020 10:01:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=j9Jfy5Gtp3T0UW9AM8Z06nWPYoE6Y5xdtKkUSWfxP2o=; b=Mp3rtkzKeSTmtWBVnsEFXQa4pZ aT+nS14v5rdvJkaXM5yEE33PshBr/z1xpupSsduRxTO+mfJvmpfJVooIDLUgUOlGoXCnAhJds8d66 62KgLq5NhkYZy8m91QxwQkImNATLaMGsi0e7xDwQfTRthniIrE99RHyKAM+r8pazrpsjnuAhbhiql 7fCu2vhfozGhduIN7fd7uV0L2FUcJMGAE7VjECmgG9uA5qQHoICQGI9NhfXBOoz0qXBE7dKhLtSTY 2jiE999bySmUIgnnYcPxhD6nrrJ3/8bQjqmfrIrtAQyQJQewpi8dMgW65DC+j+5Qqz/RKAS8tUCIr r8lf9ptQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccby-0006B9-OM; Tue, 10 Nov 2020 22:59:38 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccbu-0006AR-1c for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 22:59:36 +0000 Received: by mail-qt1-x833.google.com with SMTP id i7so20254qti.6 for ; Tue, 10 Nov 2020 14:59:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uLZIkuyLOVQohPnbqMgngN0g3/o0tjmgEV+d7YWljTY=; b=RA6kNcvTg7sfhj12/Izxg+rOX09/ZP9xEo4Nn8JD763eJ09V+RfiKLmkTA1qnXk0bZ Dxr6uAuWSwVdpJ8198q27oVkYkeMaZbimgbB5VxEXT7xiqy0R6Yff969YJ+h6F4eKY+U j5+1k+S3elKmUfgtLhG6wPs6E2KV6S9fswXZ2Oj27Xp78dbboFpaZjZ33s9OxEQruPS1 8yabo5ZXQF4YwGAM0VCDKAjkX/RC+3IQ14rwFoin7gCwRGx1rhUlDbPmHph7i/tdVqDF zSu/3Nzf7/GXc77pCidehZRxr8A3qgxblhGjkY3RkMVBmbfU+9D3CuPg9RH9ePpxq3fh ipHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uLZIkuyLOVQohPnbqMgngN0g3/o0tjmgEV+d7YWljTY=; b=oLQGctErL7Ztksz3WrRC4uRs0f9efhXqhoB9PhMh1oxCqc4b/TqNUYAdRun3cpl3vu telalCNM+4dGT5ukE41W9wSbZlpemyHm7a5X2778DGetC4O7/54lPpOHn3zFa6C8iFB7 +P3MTk+QH5ZChUmJ9E238c33dMi/n8MDlvVMRugkTCWG4yK/fK3c3YLnN5UU3UqYdSdI IHRiOARXuGP3MkOsGx6HHSYyuT4gIk+2H6mkBGayDvCz3ByaYOUnVpIbuQwDgUWUzXli U/wvczNjiYuzz7csHHlqRQ5nZz7mtYuvB+rYniAXrTNaZSMPxJkStdBh/Jn9ecpUYUn1 VkBw== X-Gm-Message-State: AOAM533ru1o6ozzaoVswATZ99n0OFcWG91vNC2jXUEYtmsi0ryA73Kq/ UfKkBF5Z7Vlj6uAXkI9pB5wKtxXGtg== X-Google-Smtp-Source: ABdhPJz4uHVUUr3iaPHy24Mpbpo/MWSncf7JYMmNaincrf/ffoCnQXoBVrrTpoD4wNYVbtOjAiXt3g== X-Received: by 2002:ac8:5854:: with SMTP id h20mr20464134qth.176.1605049170677; Tue, 10 Nov 2020 14:59:30 -0800 (PST) Received: from presler.lan (a95-94-69-32.cpe.netcabo.pt. [95.94.69.32]) by smtp.gmail.com with ESMTPSA id b12sm284093qkk.71.2020.11.10.14.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 14:59:30 -0800 (PST) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH] toolchain: allow compiling with -march=native Date: Tue, 10 Nov 2020 22:59:20 +0000 Message-Id: <20201110225920.1030302-1-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_175934_124629_38DB0BD9 X-CRM114-Status: GOOD ( 12.84 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:833 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rui Salvaterra Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org If the toolchain will only be executed on the system where it is built (or a system with the exact same CPU), this will squeeze out the last few (single digit) percent of performance. Signed-off-by: Rui Salvaterra --- rules.mk | 2 +- toolchain/Config.in | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rules.mk b/rules.mk index 3214395e1f..e416126030 100644 --- a/rules.mk +++ b/rules.mk @@ -249,7 +249,7 @@ export PKG_CONFIG HOSTCC:=gcc HOSTCXX:=g++ HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include) -HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS) +HOST_CFLAGS:=$(if $(CONFIG_BUILD_NATIVE_ARCH),-march=native) -O2 $(HOST_CPPFLAGS) HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib) ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) diff --git a/toolchain/Config.in b/toolchain/Config.in index cb557d4ad3..3149d7bc66 100644 --- a/toolchain/Config.in +++ b/toolchain/Config.in @@ -164,6 +164,14 @@ menuconfig TOOLCHAINOPTS bool "Toolchain Options" if DEVEL depends on NEED_TOOLCHAIN +config BUILD_NATIVE_ARCH + def_bool n + prompt "Build the toolchain with -march=native" if TOOLCHAINOPTS + help + When building the toolchain, optimize for the CPU in this specific machine. + Only choose Y if you're not going to run the compiled toolchain on any other + system. + menuconfig EXTRA_TARGET_ARCH bool prompt "Enable an extra toolchain target architecture" if TOOLCHAINOPTS