From patchwork Tue Feb 28 13:51:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 62500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3024200wrd; Tue, 28 Feb 2023 05:53:05 -0800 (PST) X-Google-Smtp-Source: AK7set8g07+BfJVDojU6NnvkNFdF1pDNoaZdhIsMdy01+RmwzH3HEb38bd3CM8IaeoH20lxb++bW X-Received: by 2002:a05:6402:4ce:b0:4ab:4d55:6f74 with SMTP id n14-20020a05640204ce00b004ab4d556f74mr3597381edw.13.1677592385060; Tue, 28 Feb 2023 05:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677592385; cv=none; d=google.com; s=arc-20160816; b=Wmlo5pP0zJmF5lg7CYtnO3wbmQdo+hi93pZepqFH2UeDeoVqtGymdy4ELKKi0ssPtI 6gXJ0UBU761mx5JWHJgq1OKqvqD5enXzjwJFopzZV98RgY6GKSk79Hp23bEFohdwdcce 7wteSAb8hJ92FFTI+EqUdpkE+YCP9fBDsH/m7R0dZFBzHu472i4MPQyt5WKUrZCyWtZl XmNJBk+kIhL2nm0sz/PSO4TI4eutDO0LlGWppITq/hMlwInRqyBuQuiC83Jmgqi3hfx9 5E7LJwGOLBBwdTLSOnlFNGcrG1M3r4nvbW5qtdz11DEXYnhjzQyCk4J2iZ9+RMFFhnoS Wk5A== 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=ON5IMsZb75gB9tZ4cjUZUWo/q0TshrtD9Whgj77uJNM=; b=r1EXwgJt7JlO8xG4hDLWItfCjSru+EOpxW6f51XdLl4jNMy6JPWyJIaHjqb4akNxZz f8MjvD1RqPWYLGqbp6DQpLY/+3mtlKLMIaH0YeHFOe5QRrBPB+rld8FhnPMZxgLoPqPB AZNcysGhJtG8XyrTSY9KRbbQbQATdk+kHUFcernLZ6LOQLmElFdTvm5d2hMkxwGOC1xd LoKFnFB+NVqxdqgG2qm+8F3qrNa6XibFFDn6ATUTjvcwNBcKdzKfhGLBS23+tzfG/XF6 2AT27rBc85WHM2NzHvrhnosVSHZxDOzk5gdBzT2scDlhIAT8HO0rvPV8gnZxWFZ1Zp1+ Se1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KGaFaa14; 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 w22-20020aa7da56000000b004acbd016e58si11327852eds.97.2023.02.28.05.53.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:53:05 -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=KGaFaa14; 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 AB33F3857438 for ; Tue, 28 Feb 2023 13:52:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB33F3857438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677592359; bh=ON5IMsZb75gB9tZ4cjUZUWo/q0TshrtD9Whgj77uJNM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=KGaFaa14uXw7TGF8A1313HEsk6yW3awnQwSkIuZVGtYlbArxYt1R3I/W5+wqbuwhq nOpyrCE55hq4vljVrXTr95IcMuCGX618guu9UzAb8YmZl6lFQ84oqE4TVAzPuiwrIr PBB/gUyQFcOBd0mYsYy7VEjcoRvLfkhqaFHIm0p8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id A42343858C62 for ; Tue, 28 Feb 2023 13:51:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A42343858C62 Received: by mail-pl1-x631.google.com with SMTP id i5so8796475pla.2 for ; Tue, 28 Feb 2023 05:51:52 -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:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ON5IMsZb75gB9tZ4cjUZUWo/q0TshrtD9Whgj77uJNM=; b=5/rsz0hVowaCbT362aea0gl/0hRFPYCPx+0Vwyi9pnLIQHES1p/Z5q/QSQAqsbPxSy J5kjastMa4obI1STNkfBPhoIdVYdsdUPqYy0Tz82psFsbVwkWpbgNQP0fAUQs8Nv9OkV Q1CBSYfWm0D/F+WopGmpiuCOEFCWADATfKME56w5fcUtucLG0fPIOQe48UTiIT4qpQH8 XmAZDA2Y+N5cVgCcXof6ijFUahusmDNSqUbadb6FVmEG4qpAxJ40bYKxyfCyBd24lUak PjbZoF2WQ9kAhAD15i3YjTfjjEWChdKozFhFrTUBgaH0pLXhvztxjLYtFuWYU3ZQ1MAA hL7w== X-Gm-Message-State: AO0yUKV4+puwXd0a6aTJC7V/BgavhlxYIS64IaRKw1rhljUU5/Arkx6a NU8+3A2GbpaG78GCVGAu8KhTtDvzZiI= X-Received: by 2002:a17:90b:1d90:b0:230:c96e:fc4a with SMTP id pf16-20020a17090b1d9000b00230c96efc4amr3330483pjb.1.1677592311242; Tue, 28 Feb 2023 05:51:51 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:c2e5:354c:fd58:a54e]) by smtp.gmail.com with ESMTPSA id g66-20020a636b45000000b004ff6b744248sm5781942pgc.48.2023.02.28.05.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:51:50 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Takayuki 'January June' Suwa , Max Filippov Subject: [PATCH 1/2] gcc: xtensa: add data alignment properties to dynconfig Date: Tue, 28 Feb 2023 05:51:35 -0800 Message-Id: <20230228135136.3727643-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-8.9 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, 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?1759083112774582703?= X-GMAIL-MSGID: =?utf-8?q?1759083112774582703?= gcc/ * config/xtensa/xtensa-dynconfig.cc (xtensa_get_config_v4): New function. include/ * xtensa-dynconfig.h (xtensa_config_v4): New struct. (XCHAL_DATA_WIDTH, XCHAL_UNALIGNED_LOAD_EXCEPTION) (XCHAL_UNALIGNED_STORE_EXCEPTION, XCHAL_UNALIGNED_LOAD_HW) (XCHAL_UNALIGNED_STORE_HW, XTENSA_CONFIG_V4_ENTRY_LIST): New definitions. (XTENSA_CONFIG_INSTANCE_LIST): Add xtensa_config_v4 instance. (XTENSA_CONFIG_ENTRY_LIST): Add XTENSA_CONFIG_V4_ENTRY_LIST. --- gcc/config/xtensa/xtensa-dynconfig.cc | 18 ++++++++ include/xtensa-dynconfig.h | 59 ++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/gcc/config/xtensa/xtensa-dynconfig.cc b/gcc/config/xtensa/xtensa-dynconfig.cc index 9aea9f253c25..12dce4d1b2aa 100644 --- a/gcc/config/xtensa/xtensa-dynconfig.cc +++ b/gcc/config/xtensa/xtensa-dynconfig.cc @@ -182,6 +182,24 @@ const struct xtensa_config_v3 *xtensa_get_config_v3 (void) return config; } +const struct xtensa_config_v4 *xtensa_get_config_v4 (void) +{ + static const struct xtensa_config_v4 *config; + static const struct xtensa_config_v4 def = { + 16, /* xchal_data_width */ + 1, /* xchal_unaligned_load_exception */ + 1, /* xchal_unaligned_store_exception */ + 0, /* xchal_unaligned_load_hw */ + 0, /* xchal_unaligned_store_hw */ + }; + + if (!config) + config = (const struct xtensa_config_v4 *) xtensa_load_config ("xtensa_config_v4", + &xtensa_config_v4, + &def); + return config; +} + const char * const *xtensa_get_config_strings (void) { static const char * const *config_strings; diff --git a/include/xtensa-dynconfig.h b/include/xtensa-dynconfig.h index 2cc15cc99112..48877ebb6b61 100644 --- a/include/xtensa-dynconfig.h +++ b/include/xtensa-dynconfig.h @@ -112,6 +112,15 @@ struct xtensa_config_v3 int xchal_have_xea3; }; +struct xtensa_config_v4 +{ + int xchal_data_width; + int xchal_unaligned_load_exception; + int xchal_unaligned_store_exception; + int xchal_unaligned_load_hw; + int xchal_unaligned_store_hw; +}; + typedef struct xtensa_isa_internal_struct xtensa_isa_internal; extern const void *xtensa_load_config (const char *name, @@ -120,6 +129,7 @@ extern const void *xtensa_load_config (const char *name, extern const struct xtensa_config_v1 *xtensa_get_config_v1 (void); extern const struct xtensa_config_v2 *xtensa_get_config_v2 (void); extern const struct xtensa_config_v3 *xtensa_get_config_v3 (void); +extern const struct xtensa_config_v4 *xtensa_get_config_v4 (void); #ifdef XTENSA_CONFIG_DEFINITION @@ -207,6 +217,26 @@ extern const struct xtensa_config_v3 *xtensa_get_config_v3 (void); #define XCHAL_HAVE_XEA3 0 #endif +#ifndef XCHAL_DATA_WIDTH +#define XCHAL_DATA_WIDTH 16 +#endif + +#ifndef XCHAL_UNALIGNED_LOAD_EXCEPTION +#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 +#endif + +#ifndef XCHAL_UNALIGNED_STORE_EXCEPTION +#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 +#endif + +#ifndef XCHAL_UNALIGNED_LOAD_HW +#define XCHAL_UNALIGNED_LOAD_HW 0 +#endif + +#ifndef XCHAL_UNALIGNED_STORE_HW +#define XCHAL_UNALIGNED_STORE_HW 0 +#endif + #define XTENSA_CONFIG_ENTRY(a) a #define XTENSA_CONFIG_V1_ENTRY_LIST \ @@ -276,6 +306,13 @@ extern const struct xtensa_config_v3 *xtensa_get_config_v3 (void); XTENSA_CONFIG_ENTRY(XCHAL_HAVE_EXCLUSIVE), \ XTENSA_CONFIG_ENTRY(XCHAL_HAVE_XEA3) +#define XTENSA_CONFIG_V4_ENTRY_LIST \ + XTENSA_CONFIG_ENTRY(XCHAL_DATA_WIDTH), \ + XTENSA_CONFIG_ENTRY(XCHAL_UNALIGNED_LOAD_EXCEPTION), \ + XTENSA_CONFIG_ENTRY(XCHAL_UNALIGNED_STORE_EXCEPTION), \ + XTENSA_CONFIG_ENTRY(XCHAL_UNALIGNED_LOAD_HW), \ + XTENSA_CONFIG_ENTRY(XCHAL_UNALIGNED_STORE_HW) + #define XTENSA_CONFIG_INSTANCE_LIST \ const struct xtensa_config_v1 xtensa_config_v1 = { \ XTENSA_CONFIG_V1_ENTRY_LIST, \ @@ -285,12 +322,16 @@ const struct xtensa_config_v2 xtensa_config_v2 = { \ }; \ const struct xtensa_config_v3 xtensa_config_v3 = { \ XTENSA_CONFIG_V3_ENTRY_LIST, \ +}; \ +const struct xtensa_config_v4 xtensa_config_v4 = { \ + XTENSA_CONFIG_V4_ENTRY_LIST, \ } #define XTENSA_CONFIG_ENTRY_LIST \ XTENSA_CONFIG_V1_ENTRY_LIST, \ XTENSA_CONFIG_V2_ENTRY_LIST, \ - XTENSA_CONFIG_V3_ENTRY_LIST + XTENSA_CONFIG_V3_ENTRY_LIST, \ + XTENSA_CONFIG_V4_ENTRY_LIST #else /* XTENSA_CONFIG_DEFINITION */ @@ -482,6 +523,22 @@ const struct xtensa_config_v3 xtensa_config_v3 = { \ #undef XCHAL_HAVE_XEA3 #define XCHAL_HAVE_XEA3 (xtensa_get_config_v3 ()->xchal_have_xea3) + +#undef XCHAL_DATA_WIDTH +#define XCHAL_DATA_WIDTH (xtensa_get_config_v4 ()->xchal_data_width) + +#undef XCHAL_UNALIGNED_LOAD_EXCEPTION +#define XCHAL_UNALIGNED_LOAD_EXCEPTION (xtensa_get_config_v4 ()->xchal_unaligned_load_exception) + +#undef XCHAL_UNALIGNED_STORE_EXCEPTION +#define XCHAL_UNALIGNED_STORE_EXCEPTION (xtensa_get_config_v4 ()->xchal_unaligned_store_exception) + +#undef XCHAL_UNALIGNED_LOAD_HW +#define XCHAL_UNALIGNED_LOAD_HW (xtensa_get_config_v4 ()->xchal_unaligned_load_hw) + +#undef XCHAL_UNALIGNED_STORE_HW +#define XCHAL_UNALIGNED_STORE_HW (xtensa_get_config_v4 ()->xchal_unaligned_store_hw) + #endif /* XTENSA_CONFIG_DEFINITION */ #ifdef __cplusplus