From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1880) id A89E33858D33; Wed, 19 Apr 2023 19:44:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A89E33858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681933464; bh=lz1kaRw+W/bX5OH6NvaLIFYg7ohP+53nrElBgc9guGo=; h=From:To:Subject:Date:From; b=BQjel10AN/Ac2GBL5HZBOOyDsI1np3lOCzu2htrb1BVWZmkV/GbxavL4DiS+Kd+Mr P7RS5JOuyZmGUoESMbirH3BcsF0zVBbXsyAj0MHio8RxaaLaZBenMsmhbX6CA0P+Y2 8b3qsuVJiZWJHBiVWBSl6V3JCPkXuij78sUIOV9s= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Max Filippov To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-93] gcc: xtensa: add data alignment properties to dynconfig X-Act-Checkin: gcc X-Git-Author: Max Filippov X-Git-Refname: refs/heads/master X-Git-Oldrev: 58b7dbf865b146a4e65dbda9be6df78f212c03b6 X-Git-Newrev: ec9b30879890f70266dda7f9c853f48b22a9fd50 Message-Id: <20230419194424.A89E33858D33@sourceware.org> Date: Wed, 19 Apr 2023 19:44:24 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ec9b30879890f70266dda7f9c853f48b22a9fd50 commit r14-93-gec9b30879890f70266dda7f9c853f48b22a9fd50 Author: Max Filippov Date: Tue Feb 28 05:38:12 2023 -0800 gcc: xtensa: add data alignment properties to dynconfig 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. Diff: --- 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 9aea9f253c2..12dce4d1b2a 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 2cc15cc9911..48877ebb6b6 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