From patchwork Fri Jan 13 18:17:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 91482 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp319421qgi; Fri, 13 Jan 2017 10:18:20 -0800 (PST) X-Received: by 10.99.4.71 with SMTP id 68mr25720083pge.77.1484331500463; Fri, 13 Jan 2017 10:18:20 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d21si13247274pgi.331.2017.01.13.10.18.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 10:18:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-446128-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-446128-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-446128-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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=n+v7BJNuUJQhi2Z9c ZdRMUj96bS6pnRuh70G8tBeh5LXNPiJyDFFYAtU9o5wFLShvKgJAhuQmoYlu80ov sBDBGQj8sMZLkj1GhUWjKNhukifHUwyjnSYkRKpIoihDb9wVL6XnJowm5wNzFW6l yLEOdtp9uChixkQXeJkeYPaEBM= 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=ZN8QELaYNp9kcBj8LljC2cI RkIU=; b=DTj36T2GVxZJS+MM9Lbedeer6U7wwbDvPLgsNnV/9/QayEAlPUv3yKS 0Ks1Hr+RcuaE7ukcTxeLh4xT0WNeG0ST7shknliWAFKUZ/iAsBgEzZjEqkOekirJ j1njzyOfE4LZm1VAzVaiZ9JwuhaFIGqvtho/SNF26ovo5lZysxk4= Received: (qmail 97883 invoked by alias); 13 Jan 2017 18:18:06 -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 97868 invoked by uid 89); 13 Jan 2017 18:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=U*thomas.preudhomme, dgskipif, dg-skip-if, Best 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; Fri, 13 Jan 2017 18:17:55 +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 1B3C4152D; Fri, 13 Jan 2017 10:17:54 -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 560183F242; Fri, 13 Jan 2017 10:17:53 -0800 (PST) Subject: Re: [PATCH, GCC/testsuite/ARM, ping] Skip optional_mthumb tests if GCC has a default mode To: Kyrill Tkachov , Ramana Radhakrishnan , Richard Earnshaw , "gcc-patches@gcc.gnu.org" References: <740157ba-104b-af44-7c94-28d7172b65f1@foss.arm.com> <4fd5bd37-cdcb-8b23-c1ac-6544dea0242d@foss.arm.com> From: Thomas Preudhomme Message-ID: Date: Fri, 13 Jan 2017 18:17:52 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <4fd5bd37-cdcb-8b23-c1ac-6544dea0242d@foss.arm.com> X-IsSubscribed: yes Ping ARM maintainers? (target independent part ACKed by Jeff) Best regards, Thomas On 03/01/17 17:19, Thomas Preudhomme wrote: > Ping? > > Best regards, > > Thomas > > On 12/12/16 17:52, Thomas Preudhomme wrote: >> 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)