From patchwork Mon Dec 12 17:52:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 87724 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1774870qgi; Mon, 12 Dec 2016 09:53:02 -0800 (PST) X-Received: by 10.99.61.6 with SMTP id k6mr168478028pga.154.1481565182328; Mon, 12 Dec 2016 09:53:02 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e22si44330862pli.289.2016.12.12.09.53.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 09:53:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444200-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444200-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444200-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=tCbjMHoKUe5Dl/6jcMTYYaJkDJf98OAUAqq9NBEz6KYyVcrExv ySsz3Kja8YA7UghU9SyL1Sy8P7JfyqhC6CQkyBOShfqYo8IV2pdpCR1k7FS+sUT/ wq+KQ8hvxhYi9Vq80wfmfbO8hW6ETRZL4U7lx33J75Z+n0aFBXBHpGFbU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=5TT9hpp6XLf/DEylfhA5yV7hqoU=; b=FG5lzM4rwlURUGXQMWxx n0BpXxiT5ob5jxCXWBRnRxys09/eBEoHFVm86STKOkYvf5RcnzIsNEsaC8sWe8YU 6uuyqn97VC92UGX8ogdS+GgrcYLy1jyOZf4d7050MAhqUfCXsELyzX78DKXBFgLD 0IPqmwJPjNm1wKuyBalRYuQ= Received: (qmail 120682 invoked by alias); 12 Dec 2016 17:52:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 120662 invoked by uid 89); 12 Dec 2016 17:52:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Dec 2016 17:52:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C66C8152D; Mon, 12 Dec 2016 09:52:34 -0800 (PST) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1242A3F477; Mon, 12 Dec 2016 09:52:33 -0800 (PST) To: Kyrill Tkachov , Ramana Radhakrishnan , Richard Earnshaw , "gcc-patches@gcc.gnu.org" From: Thomas Preudhomme Subject: [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode Message-ID: <740157ba-104b-af44-7c94-28d7172b65f1@foss.arm.com> Date: Mon, 12 Dec 2016 17:52:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, The logic to make -mthumb optional for Thumb-only devices is only executed when no -marm or -mthumb is given on the command-line. This includes configuring GCC with --with-mode= because this makes the option to be passed before any others. The optional_mthumb-* testcases are skipped when -marm or -mthumb is passed on the command line but not when GCC was configured with --with-mode. Not only are the tests meaningless in these configurations, they also spuriously FAIL if --with-mode=arm was used since the test are built for Thumb-only devices, as reported by Christophe Lyon in [1]. [1] https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02082.html This patch adds logic to target-support.exp to check how was GCC configured and changes the optional_mthumb testcases to be skipped if there is a default mode (--with-mode=). It also fixes a couple of typo on the selectors. ChangeLog entry is as follows: *** gcc/testsuite/ChangeLog *** 2016-12-09 Thomas Preud'homme * lib/target-supports.exp (check_configured_with): New procedure. (check_effective_target_default_mode): new effective target. * gcc.target/arm/optional_thumb-1.c: Skip if GCC was configured with a default mode. Fix dg-skip-if target selector syntax. * gcc.target/arm/optional_thumb-2.c: Likewise. * gcc.target/arm/optional_thumb-3.c: Fix dg-skip-if target selector syntax. Is this ok for stage3? Best regards, Thomas diff --git a/gcc/testsuite/gcc.target/arm/optional_thumb-1.c b/gcc/testsuite/gcc.target/arm/optional_thumb-1.c index 23df62887ba4aaa1d8717a34ecda9a40246f0552..99cb0c3f33b601fff4493feef72765f7590e18f6 100644 --- a/gcc/testsuite/gcc.target/arm/optional_thumb-1.c +++ b/gcc/testsuite/gcc.target/arm/optional_thumb-1.c @@ -1,5 +1,5 @@ -/* { dg-do compile } */ -/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-*} { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ +/* { dg-do compile { target { ! default_mode } } } */ +/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-* } { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ /* { dg-options "-march=armv6-m" } */ /* Check that -mthumb is not needed when compiling for a Thumb-only target. */ diff --git a/gcc/testsuite/gcc.target/arm/optional_thumb-2.c b/gcc/testsuite/gcc.target/arm/optional_thumb-2.c index 4bd53a45eca97e62dd3b86d5a1a66c5ca21e7aad..280dfb3fec55570b6cfe934303c9bd3d50322b86 100644 --- a/gcc/testsuite/gcc.target/arm/optional_thumb-2.c +++ b/gcc/testsuite/gcc.target/arm/optional_thumb-2.c @@ -1,5 +1,5 @@ -/* { dg-do compile } */ -/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-*} { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ +/* { dg-do compile { target { ! default_mode } } } */ +/* { dg-skip-if "-marm/-mthumb/-march/-mcpu given" { *-*-* } { "-marm" "-mthumb" "-march=*" "-mcpu=*" } } */ /* { dg-options "-mcpu=cortex-m4" } */ /* Check that -mthumb is not needed when compiling for a Thumb-only target. */ diff --git a/gcc/testsuite/gcc.target/arm/optional_thumb-3.c b/gcc/testsuite/gcc.target/arm/optional_thumb-3.c index f1fd5c8840b191e600c20a7817c611bb9bb645df..d9150e09e475dfbeb7b0b0c153c913b1ad6f0777 100644 --- a/gcc/testsuite/gcc.target/arm/optional_thumb-3.c +++ b/gcc/testsuite/gcc.target/arm/optional_thumb-3.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_cortex_m } */ -/* { dg-skip-if "-mthumb given" { *-*-*} { "-mthumb" } } */ +/* { dg-skip-if "-mthumb given" { *-*-* } { "-mthumb" } } */ /* { dg-options "-marm" } */ -/* { dg-error "target CPU does not support ARM mode" "missing error with -marm on Thumb-only targets" { target *-*-*} 0 } */ +/* { dg-error "target CPU does not support ARM mode" "missing error with -marm on Thumb-only targets" { target *-*-* } 0 } */ /* Check that -marm gives an error when compiling for a Thumb-only target. */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 0fc0bafa67d8d34ec74ce2d1d7a2323a375615cc..f7511ef3aebca72c798496fb95ce43fcbbc08ed1 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -252,6 +252,20 @@ proc check_runtime {prop args} { }] } +# Return 1 if GCC was configured with $pattern. +proc check_configured_with { pattern } { + global tool + + set gcc_output [${tool}_target_compile "-v" "" "none" ""] + if { [ regexp "Configured with: \[^\n\]*$pattern" $gcc_output ] } { + verbose "Matched: $pattern" 2 + return 1 + } + + verbose "Failed to match: $pattern" 2 + return 0 +} + ############################### # proc check_weak_available { } ############################### @@ -3797,6 +3811,12 @@ proc add_options_for_arm_arch_v7ve { flags } { return "$flags -march=armv7ve" } +# Return 1 if GCC was configured with --with-mode= +proc check_effective_target_default_mode { } { + + return [check_configured_with "with-mode="] +} + # Return 1 if this is an ARM target where -marm causes ARM to be # used (not Thumb)