From patchwork Tue Nov 29 00:45:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 26990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp38854wrr; Mon, 28 Nov 2022 16:47:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf5/LDg/aNkk0xQMrjOMiFmpZKpnEl668NxEGpUOlZ+gbAoRWWQgzojY7+er6iPp6R4rKEik X-Received: by 2002:a17:906:a0c6:b0:7bd:3a5c:4dea with SMTP id bh6-20020a170906a0c600b007bd3a5c4deamr14639988ejb.190.1669682830243; Mon, 28 Nov 2022 16:47:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669682830; cv=none; d=google.com; s=arc-20160816; b=M+igauUJdc8cNx0zmhQgd0kDa3NlAr0G/ajD1feJ3FqgEkTbjgsX3MVk65oXHp3N4Q x3FRZ1Jgu4Y+s0guryZxbY2cUqpYko35yE/P+GHfQymvnhYmWkBT0JEri73Oa9b2yp9J iSROZ1w9vJZj7tvwKphho2qjDijyNSQpyFSord0+LmtGWNrfYxRYgUERjktQ7gmWO0i+ KRVFrPykzeNl/IiUO0p5D93LALf5mtg3Y3ncjX1Z8Et/Q21KGplpBgRp2aUdGFO9XRuq F0cClD0KJu/0G08WvnXr72KnXzqOrvFbPNkH7tS+UGBC9RmVAV/IFe9a63LO2jItVG+L zyoA== 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 :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=iwtC6kTh/RoT+WSPd/OzsG5r0zXACUuVmTf7SBCbCz8=; b=up68irhOqel+0Hqwfk6UakYTYeOnxbENGdPTLZUZfPqTzYndemS7uQbRtzGU1HvKzA BMIExYfHOquhg/YtKbXJyiPzJSBWkTBFI9BtOpwGkLyjQcaCewsFBNqLxkZ0Xal1ODLY Yu1PWOQ2MdPndl4vOz3TIB5DElHXZNoOerPpIOg8f6XvNY1av+z3l/tzHd7SoNFW3Amo sEsWoeye8ALpWEQbq/mk+QkiBv1r1c0Yz9GqYqd4Zr8ZjezV2fNl95Cc0H/B4XVozaxq OSvZAn10CfW57vAPSLsv1LlO3TmeYaj1B/F/Sk9jKk9V27xB5vPHKxhhrdKBhT61dD/f r9Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=NoKTXePH; 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 a1-20020a50e701000000b0045bfaaab6d1si9245646edn.48.2022.11.28.16.47.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 16:47:10 -0800 (PST) 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=NoKTXePH; 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 06C3F385455D for ; Tue, 29 Nov 2022 00:46:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06C3F385455D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669682816; bh=iwtC6kTh/RoT+WSPd/OzsG5r0zXACUuVmTf7SBCbCz8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=NoKTXePHLNeCJXI1BCiJBC0OB9N0ljxI3lfW8ym4dC3a8Q8DCPO5G2cSuEe9HL0Zp Q6CXGih7LuJLyLUQUZFAl4O9IpFaVW/Zl6wusZD11WKfaXWtWs9ifC4xNAHJl1+aFw ssLp3bwJIINXC7GX6vLwBqPZsf5ZCcTzaF3+RBxU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 10B283858C52 for ; Tue, 29 Nov 2022 00:46:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10B283858C52 Received: by mail-pl1-x62a.google.com with SMTP id y17so3973039plp.3 for ; Mon, 28 Nov 2022 16:46:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iwtC6kTh/RoT+WSPd/OzsG5r0zXACUuVmTf7SBCbCz8=; b=BTrGzO8FjN5iT+yY/vo4KJJ7sRtbVRRHT6NATL3b53aUTTaLgd6tCxYzwjq+064Txj e9JFinZ6s5yMjh6oqYofZQBTnhz8Me6xBQv6UiILGr47NU81PH/pDvyKqUXel02ZpSUI czL2XEMx365hC7ZDrTs0yqPcKJA2J/oxw5BtEOb9IMzQxBIhnZ3ijm/w8xKG67nyXiCn 1QfGC7wSs8qa2f9xdfbtrUanra3Zy1dJcpCpCZSfhjWXpDcTfJ+fGh52pfhXwPOWgdMV XX9DGHU+wsqut2/zjTRLn/8TLFm9+X1l2OO6zFxEcPymybGF/VaM+YfGURGQsdKAULeg un2w== X-Gm-Message-State: ANoB5pmdL2K+Zo+zO8GmofL9TmHCvAoBbBqpjzTvOaj/XNkuciOAsqPi jpyoSDKjgH2Xu8kSfBJM9CmNDllmiJE= X-Received: by 2002:a17:90a:8592:b0:219:2e8c:a775 with SMTP id m18-20020a17090a859200b002192e8ca775mr9704861pjn.102.1669682769635; Mon, 28 Nov 2022 16:46:09 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:bb27:8901:5994:c758]) by smtp.gmail.com with ESMTPSA id s128-20020a625e86000000b005752201d4ffsm1687491pfb.213.2022.11.28.16.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 16:46:08 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Ian Lance Taylor , Max Filippov Subject: [PATCH v2 2/2] libgcc: xtensa: use built-in configuration Date: Mon, 28 Nov 2022 16:45:51 -0800 Message-Id: <20221129004551.2213723-3-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221129004551.2213723-1-jcmvbkbc@gmail.com> References: <20221129004551.2213723-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: Max Filippov via Gcc-patches From: Max Filippov Reply-To: Max Filippov 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?1750789343226866125?= X-GMAIL-MSGID: =?utf-8?q?1750789343226866125?= Now that gcc provides __XCHAL_* definitions use them instead of XCHAL_* definitions from the include/xtensa-config.h. That makes libgcc dynamically configurable for the target xtensa core. libgcc/ * config/xtensa/crti.S (xtensa-config.h): Replace #inlcude with xtensa-config-builtin.h. * config/xtensa/crtn.S: Likewise. * config/xtensa/lib1funcs.S: Likewise. * config/xtensa/lib2funcs.S: Likewise. * config/xtensa/xtensa-config-builtin.h: New File. --- libgcc/config/xtensa/crti.S | 2 +- libgcc/config/xtensa/crtn.S | 2 +- libgcc/config/xtensa/lib1funcs.S | 2 +- libgcc/config/xtensa/lib2funcs.S | 2 +- libgcc/config/xtensa/xtensa-config-builtin.h | 198 +++++++++++++++++++ 5 files changed, 202 insertions(+), 4 deletions(-) create mode 100644 libgcc/config/xtensa/xtensa-config-builtin.h diff --git a/libgcc/config/xtensa/crti.S b/libgcc/config/xtensa/crti.S index 3de7bc101f4d..2452a88a0351 100644 --- a/libgcc/config/xtensa/crti.S +++ b/libgcc/config/xtensa/crti.S @@ -24,7 +24,7 @@ # .init sections. Users may put any desired instructions in those # sections. -#include "xtensa-config.h" +#include "xtensa-config-builtin.h" .section .init .globl _init diff --git a/libgcc/config/xtensa/crtn.S b/libgcc/config/xtensa/crtn.S index 06b932edb14d..8520945fbd7c 100644 --- a/libgcc/config/xtensa/crtn.S +++ b/libgcc/config/xtensa/crtn.S @@ -25,7 +25,7 @@ # fact return. Users may put any desired instructions in those sections. # This file is the last thing linked into any executable. -#include "xtensa-config.h" +#include "xtensa-config-builtin.h" .section .init #if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__ diff --git a/libgcc/config/xtensa/lib1funcs.S b/libgcc/config/xtensa/lib1funcs.S index 3932d206256f..e5a35aa7dcc8 100644 --- a/libgcc/config/xtensa/lib1funcs.S +++ b/libgcc/config/xtensa/lib1funcs.S @@ -23,7 +23,7 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -#include "xtensa-config.h" +#include "xtensa-config-builtin.h" /* Define macros for the ABS and ADDX* instructions to handle cases where they are not included in the Xtensa processor configuration. */ diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S index 681bac1be8cf..ef2a83251352 100644 --- a/libgcc/config/xtensa/lib2funcs.S +++ b/libgcc/config/xtensa/lib2funcs.S @@ -23,7 +23,7 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -#include "xtensa-config.h" +#include "xtensa-config-builtin.h" /* __xtensa_libgcc_window_spill: This function flushes out all but the current register window. This is used to set up the stack so that diff --git a/libgcc/config/xtensa/xtensa-config-builtin.h b/libgcc/config/xtensa/xtensa-config-builtin.h new file mode 100644 index 000000000000..36d4d9db330b --- /dev/null +++ b/libgcc/config/xtensa/xtensa-config-builtin.h @@ -0,0 +1,198 @@ +/* Xtensa configuration settings. + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef XTENSA_CONFIG_BUILTIN_H +#define XTENSA_CONFIG_BUILTIN_H + +/* The macros defined here match those with the same names in the Xtensa + compile-time HAL (Hardware Abstraction Layer). Please refer to the + Xtensa System Software Reference Manual for documentation of these + macros. */ + +#undef XCHAL_HAVE_BE +#define XCHAL_HAVE_BE __XCHAL_HAVE_BE + +#undef XCHAL_HAVE_DENSITY +#define XCHAL_HAVE_DENSITY __XCHAL_HAVE_DENSITY + +#undef XCHAL_HAVE_CONST16 +#define XCHAL_HAVE_CONST16 __XCHAL_HAVE_CONST16 + +#undef XCHAL_HAVE_ABS +#define XCHAL_HAVE_ABS __XCHAL_HAVE_ABS + +#undef XCHAL_HAVE_ADDX +#define XCHAL_HAVE_ADDX __XCHAL_HAVE_ADDX + +#undef XCHAL_HAVE_L32R +#define XCHAL_HAVE_L32R __XCHAL_HAVE_L32R + +#undef XSHAL_USE_ABSOLUTE_LITERALS +#define XSHAL_USE_ABSOLUTE_LITERALS __XSHAL_USE_ABSOLUTE_LITERALS + +#undef XSHAL_HAVE_TEXT_SECTION_LITERALS +#define XSHAL_HAVE_TEXT_SECTION_LITERALS __XSHAL_HAVE_TEXT_SECTION_LITERALS + +#undef XCHAL_HAVE_MAC16 +#define XCHAL_HAVE_MAC16 __XCHAL_HAVE_MAC16 + +#undef XCHAL_HAVE_MUL16 +#define XCHAL_HAVE_MUL16 __XCHAL_HAVE_MUL16 + +#undef XCHAL_HAVE_MUL32 +#define XCHAL_HAVE_MUL32 __XCHAL_HAVE_MUL32 + +#undef XCHAL_HAVE_MUL32_HIGH +#define XCHAL_HAVE_MUL32_HIGH __XCHAL_HAVE_MUL32_HIGH + +#undef XCHAL_HAVE_DIV32 +#define XCHAL_HAVE_DIV32 __XCHAL_HAVE_DIV32 + +#undef XCHAL_HAVE_NSA +#define XCHAL_HAVE_NSA __XCHAL_HAVE_NSA + +#undef XCHAL_HAVE_MINMAX +#define XCHAL_HAVE_MINMAX __XCHAL_HAVE_MINMAX + +#undef XCHAL_HAVE_SEXT +#define XCHAL_HAVE_SEXT __XCHAL_HAVE_SEXT + +#undef XCHAL_HAVE_LOOPS +#define XCHAL_HAVE_LOOPS __XCHAL_HAVE_LOOPS + +#undef XCHAL_HAVE_THREADPTR +#define XCHAL_HAVE_THREADPTR __XCHAL_HAVE_THREADPTR + +#undef XCHAL_HAVE_RELEASE_SYNC +#define XCHAL_HAVE_RELEASE_SYNC __XCHAL_HAVE_RELEASE_SYNC + +#undef XCHAL_HAVE_S32C1I +#define XCHAL_HAVE_S32C1I __XCHAL_HAVE_S32C1I + +#undef XCHAL_HAVE_BOOLEANS +#define XCHAL_HAVE_BOOLEANS __XCHAL_HAVE_BOOLEANS + +#undef XCHAL_HAVE_FP +#define XCHAL_HAVE_FP __XCHAL_HAVE_FP + +#undef XCHAL_HAVE_FP_DIV +#define XCHAL_HAVE_FP_DIV __XCHAL_HAVE_FP_DIV + +#undef XCHAL_HAVE_FP_RECIP +#define XCHAL_HAVE_FP_RECIP __XCHAL_HAVE_FP_RECIP + +#undef XCHAL_HAVE_FP_SQRT +#define XCHAL_HAVE_FP_SQRT __XCHAL_HAVE_FP_SQRT + +#undef XCHAL_HAVE_FP_RSQRT +#define XCHAL_HAVE_FP_RSQRT __XCHAL_HAVE_FP_RSQRT + +#undef XCHAL_HAVE_FP_POSTINC +#define XCHAL_HAVE_FP_POSTINC __XCHAL_HAVE_FP_POSTINC + +#undef XCHAL_HAVE_DFP +#define XCHAL_HAVE_DFP __XCHAL_HAVE_DFP + +#undef XCHAL_HAVE_DFP_DIV +#define XCHAL_HAVE_DFP_DIV __XCHAL_HAVE_DFP_DIV + +#undef XCHAL_HAVE_DFP_RECIP +#define XCHAL_HAVE_DFP_RECIP __XCHAL_HAVE_DFP_RECIP + +#undef XCHAL_HAVE_DFP_SQRT +#define XCHAL_HAVE_DFP_SQRT __XCHAL_HAVE_DFP_SQRT + +#undef XCHAL_HAVE_DFP_RSQRT +#define XCHAL_HAVE_DFP_RSQRT __XCHAL_HAVE_DFP_RSQRT + +#undef XCHAL_HAVE_WINDOWED +#define XCHAL_HAVE_WINDOWED __XCHAL_HAVE_WINDOWED + +#undef XCHAL_NUM_AREGS +#define XCHAL_NUM_AREGS __XCHAL_NUM_AREGS2 + +#undef XCHAL_HAVE_WIDE_BRANCHES +#define XCHAL_HAVE_WIDE_BRANCHES __XCHAL_HAVE_WIDE_BRANCHES + +#undef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES __XCHAL_HAVE_PREDICTED_BRANCHES + + +#undef XCHAL_ICACHE_SIZE +#define XCHAL_ICACHE_SIZE __XCHAL_ICACHE_SIZE6384 + +#undef XCHAL_DCACHE_SIZE +#define XCHAL_DCACHE_SIZE __XCHAL_DCACHE_SIZE6384 + +#undef XCHAL_ICACHE_LINESIZE +#define XCHAL_ICACHE_LINESIZE __XCHAL_ICACHE_LINESIZE2 + +#undef XCHAL_DCACHE_LINESIZE +#define XCHAL_DCACHE_LINESIZE __XCHAL_DCACHE_LINESIZE2 + +#undef XCHAL_ICACHE_LINEWIDTH +#define XCHAL_ICACHE_LINEWIDTH __XCHAL_ICACHE_LINEWIDTH + +#undef XCHAL_DCACHE_LINEWIDTH +#define XCHAL_DCACHE_LINEWIDTH __XCHAL_DCACHE_LINEWIDTH + +#undef XCHAL_DCACHE_IS_WRITEBACK +#define XCHAL_DCACHE_IS_WRITEBACK __XCHAL_DCACHE_IS_WRITEBACK + + +#undef XCHAL_HAVE_MMU +#define XCHAL_HAVE_MMU __XCHAL_HAVE_MMU + +#undef XCHAL_MMU_MIN_PTE_PAGE_SIZE +#define XCHAL_MMU_MIN_PTE_PAGE_SIZE __XCHAL_MMU_MIN_PTE_PAGE_SIZE2 + + +#undef XCHAL_HAVE_DEBUG +#define XCHAL_HAVE_DEBUG __XCHAL_HAVE_DEBUG + +#undef XCHAL_NUM_IBREAK +#define XCHAL_NUM_IBREAK __XCHAL_NUM_IBREAK + +#undef XCHAL_NUM_DBREAK +#define XCHAL_NUM_DBREAK __XCHAL_NUM_DBREAK + +#undef XCHAL_DEBUGLEVEL +#define XCHAL_DEBUGLEVEL __XCHAL_DEBUGLEVEL + + +#undef XCHAL_MAX_INSTRUCTION_SIZE +#define XCHAL_MAX_INSTRUCTION_SIZE __XCHAL_MAX_INSTRUCTION_SIZE + +#undef XCHAL_INST_FETCH_WIDTH +#define XCHAL_INST_FETCH_WIDTH __XCHAL_INST_FETCH_WIDTH + + +#undef XSHAL_ABI +#undef XTHAL_ABI_WINDOWED +#undef XTHAL_ABI_CALL0 +#define XSHAL_ABI __XSHAL_ABITHAL_ABI_WINDOWED +#define XTHAL_ABI_WINDOWED __XTHAL_ABI_WINDOWED +#define XTHAL_ABI_CALL0 __XTHAL_ABI_CALL0 + +#endif /* !XTENSA_CONFIG_BUILTIN_H */