From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 69C543857C43 for ; Sun, 13 Sep 2020 08:42:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 69C543857C43 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-wfLOhBGIP5i7H3lp9c0W0A-1; Sun, 13 Sep 2020 04:42:51 -0400 X-MC-Unique: wfLOhBGIP5i7H3lp9c0W0A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBFCC10059A2; Sun, 13 Sep 2020 08:42:50 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-252.ams2.redhat.com [10.36.113.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53FDE76E16; Sun, 13 Sep 2020 08:42:50 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 08D8gluL022634; Sun, 13 Sep 2020 10:42:47 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 08D8gkke022633; Sun, 13 Sep 2020 10:42:46 +0200 Date: Sun, 13 Sep 2020 10:42:46 +0200 From: Jakub Jelinek To: Richard Earnshaw , Kyrylo Tkachov Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] arm: Fix up gcc.target/arm/lto/pr96939_* FAIL - alternate version Message-ID: <20200913084246.GI21814@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Sun, 13 Sep 2020 08:42:56 -0000 Hi! The large patch for opts_set saving/restoring doesn't seem to be desirable for backporting (it can be backported and I've even tested it in gcc 10, but it is too large), so this patch instead provides a target only fix. As opts_set can't be trusted, it uses TargetVariables to record whether -march=, -mcpu= or -mtune= were specified explicitly. Bootstrapped/regtested on armv7hl-linux-gnueabi, would this be eventually ok for backporting? Note, perhaphs it could be slightly extended from the other patch, e.g. by removing the three TargetSave vars, adding 3 Save keywords instead, removing the explicit saving/restoring and don't pass opts_set argument to arm_configure_build_target instead of passing it and ignoring. 2020-09-13 Jakub Jelinek * config/arm/arm.opt (arm_arch_specified, arm_cpu_specified, arm_tune_specified): New TargetVariables. * config/arm/arm.c (arm_configure_build_target): Comment out opts_set argument name. Use opts->x_arm_*_specified instead of opts_set->x_arm_*_string. * common/config/arm/arm-common.c (arm_handle_option): New function. (TARGET_HANDLE_OPTION): Redefine. --- gcc/config/arm/arm.opt.jj 2020-09-12 13:36:27.619716335 +0200 +++ gcc/config/arm/arm.opt 2020-09-12 13:38:48.547661292 +0200 @@ -30,6 +30,15 @@ const char *x_arm_cpu_string TargetSave const char *x_arm_tune_string +TargetVariable +unsigned char arm_arch_specified = 0 + +TargetVariable +unsigned char arm_cpu_specified = 0 + +TargetVariable +unsigned char arm_tune_specified = 0 + Enum Name(tls_type) Type(enum arm_tls_type) TLS dialect to use: --- gcc/config/arm/arm.c.jj 2020-09-12 13:36:27.619716335 +0200 +++ gcc/config/arm/arm.c 2020-09-12 13:49:26.166363387 +0200 @@ -3181,7 +3181,7 @@ static sbitmap isa_quirkbits; void arm_configure_build_target (struct arm_build_target *target, struct cl_target_option *opts, - struct gcc_options *opts_set, + struct gcc_options */* opts_set */, bool warn_compatible) { const cpu_option *arm_selected_tune = NULL; @@ -3196,7 +3196,7 @@ arm_configure_build_target (struct arm_b target->core_name = NULL; target->arch_name = NULL; - if (opts_set->x_arm_arch_string) + if (opts->x_arm_arch_specified) { arm_selected_arch = arm_parse_arch_option_name (all_architectures, "-march", @@ -3204,7 +3204,7 @@ arm_configure_build_target (struct arm_b arch_opts = strchr (opts->x_arm_arch_string, '+'); } - if (opts_set->x_arm_cpu_string) + if (opts->x_arm_cpu_specified) { arm_selected_cpu = arm_parse_cpu_option_name (all_cores, "-mcpu", opts->x_arm_cpu_string); @@ -3214,7 +3214,7 @@ arm_configure_build_target (struct arm_b options for tuning. */ } - if (opts_set->x_arm_tune_string) + if (opts->x_arm_tune_specified) { arm_selected_tune = arm_parse_cpu_option_name (all_cores, "-mtune", opts->x_arm_tune_string); --- gcc/common/config/arm/arm-common.c.jj 2020-07-28 15:39:09.705760394 +0200 +++ gcc/common/config/arm/arm-common.c 2020-09-12 13:50:09.021738456 +0200 @@ -1021,6 +1021,34 @@ arm_asm_auto_mfpu (int argc, const char #undef ARM_CPU_NAME_LENGTH +bool +arm_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set ATTRIBUTE_UNUSED, + const struct cl_decoded_option *decoded, + location_t loc ATTRIBUTE_UNUSED) +{ + size_t code = decoded->opt_index; + const char *arg = decoded->arg; + int val = decoded->value; + + switch (code) + { + case OPT_march_: + opts->x_arm_arch_specified = true; + return true; + + case OPT_mcpu_: + opts->x_arm_cpu_specified = true; + return true; + + case OPT_mtune_: + opts->x_arm_tune_specified = true; + return true; + + default: + return true; + } +} #undef TARGET_DEFAULT_TARGET_FLAGS #define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_SCHED_PROLOG) @@ -1031,4 +1059,7 @@ arm_asm_auto_mfpu (int argc, const char #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO arm_except_unwind_info +#undef TARGET_HANDLE_OPTION +#define TARGET_HANDLE_OPTION arm_handle_option + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; Jakub