public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode
@ 2016-12-12 17:52 Thomas Preudhomme
  2016-12-12 21:17 ` Christophe Lyon
  2017-01-03 17:19 ` [PATCH, GCC/testsuite/ARM, ping] " Thomas Preudhomme
  0 siblings, 2 replies; 11+ messages in thread
From: Thomas Preudhomme @ 2016-12-12 17:52 UTC (permalink / raw)
  To: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

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  <thomas.preudhomme@arm.com>

         * 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

[-- Attachment #2: skip_optional_mthumb_test_default_mode.patch --]
[-- Type: text/x-patch, Size: 3573 bytes --]

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)
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode
  2016-12-12 17:52 [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode Thomas Preudhomme
@ 2016-12-12 21:17 ` Christophe Lyon
  2016-12-13  9:54   ` Thomas Preudhomme
  2017-01-03 17:19 ` [PATCH, GCC/testsuite/ARM, ping] " Thomas Preudhomme
  1 sibling, 1 reply; 11+ messages in thread
From: Christophe Lyon @ 2016-12-12 21:17 UTC (permalink / raw)
  To: Thomas Preudhomme
  Cc: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

Hi Thomas,

Thanks for working on this,


On 12 December 2016 at 18:52, Thomas Preudhomme
<thomas.preudhomme@foss.arm.com> 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.
>

How hard would it be to skip these tests only if --with-mode=arm,
such that they would still pass in configurations --with-mode=thumb?

It seems easy to extend what you propose here, doesn't it?

Christophe

> ChangeLog entry is as follows:
>
>
> *** gcc/testsuite/ChangeLog ***
>
> 2016-12-09  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>
>         * 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode
  2016-12-12 21:17 ` Christophe Lyon
@ 2016-12-13  9:54   ` Thomas Preudhomme
  2016-12-13 10:11     ` Christophe Lyon
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Preudhomme @ 2016-12-13  9:54 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

On 12/12/16 21:17, Christophe Lyon wrote:
> Hi Thomas,
>
> Thanks for working on this,
>
>
> On 12 December 2016 at 18:52, Thomas Preudhomme
> <thomas.preudhomme@foss.arm.com> 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.
>>
>
> How hard would it be to skip these tests only if --with-mode=arm,
> such that they would still pass in configurations --with-mode=thumb?
>
> It seems easy to extend what you propose here, doesn't it?

It is but IMO it gives a false sense of quality since it does not test the 
optional -mthumb logic.

What is the motivation to make it run with --with-mode=thumb?

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode
  2016-12-13  9:54   ` Thomas Preudhomme
@ 2016-12-13 10:11     ` Christophe Lyon
  2016-12-13 11:18       ` Thomas Preudhomme
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe Lyon @ 2016-12-13 10:11 UTC (permalink / raw)
  To: Thomas Preudhomme
  Cc: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

On 13 December 2016 at 10:54, Thomas Preudhomme
<thomas.preudhomme@foss.arm.com> wrote:
> On 12/12/16 21:17, Christophe Lyon wrote:
>>
>> Hi Thomas,
>>
>> Thanks for working on this,
>>
>>
>> On 12 December 2016 at 18:52, Thomas Preudhomme
>> <thomas.preudhomme@foss.arm.com> 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.
>>>
>>
>> How hard would it be to skip these tests only if --with-mode=arm,
>> such that they would still pass in configurations --with-mode=thumb?
>>
>> It seems easy to extend what you propose here, doesn't it?
>
>
> It is but IMO it gives a false sense of quality since it does not test the
> optional -mthumb logic.
>
> What is the motivation to make it run with --with-mode=thumb?
>

With your patch, they will appear as unsupported, right?
It's not a big deal.

Do you know how most people configure their toolchains?
Linaro and Ubuntu (I think) use --with-mode=thumb.
Do most people use no --with-mode configure flag?

In the validations I run against trunk, I always have --with-mode,
except for one arm-none-eabi configuration where I also use
default cpu/fpu.

Maybe I should remove --with-mode=thumb from my config
--with-cpu=cortex-m3? (but I don't remember if the new logic
was backported to gcc-5/gcc-6 ?)

Christophe


> Best regards,
>
> Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode
  2016-12-13 10:11     ` Christophe Lyon
@ 2016-12-13 11:18       ` Thomas Preudhomme
  2016-12-13 11:26         ` Christophe Lyon
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Preudhomme @ 2016-12-13 11:18 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

On 13/12/16 10:11, Christophe Lyon wrote:
> On 13 December 2016 at 10:54, Thomas Preudhomme
> <thomas.preudhomme@foss.arm.com> wrote:
>> On 12/12/16 21:17, Christophe Lyon wrote:
>>>
>>> Hi Thomas,
>>>
>>> Thanks for working on this,
>>>
>>>
>>> On 12 December 2016 at 18:52, Thomas Preudhomme
>>> <thomas.preudhomme@foss.arm.com> 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.
>>>>
>>>
>>> How hard would it be to skip these tests only if --with-mode=arm,
>>> such that they would still pass in configurations --with-mode=thumb?
>>>
>>> It seems easy to extend what you propose here, doesn't it?
>>
>>
>> It is but IMO it gives a false sense of quality since it does not test the
>> optional -mthumb logic.
>>
>> What is the motivation to make it run with --with-mode=thumb?
>>
>
> With your patch, they will appear as unsupported, right?
> It's not a big deal.

yes indeed.

>
> Do you know how most people configure their toolchains?
> Linaro and Ubuntu (I think) use --with-mode=thumb.
> Do most people use no --with-mode configure flag?

I cannot answer for people in general but in our case we use 
--with-multilib-list which will build the toolchain for several -march, -mfpu 
and -mfloat combinations. But it's good to have a mix, it finds more issues in 
the testsuite as this very examples shows.

>
> In the validations I run against trunk, I always have --with-mode,
> except for one arm-none-eabi configuration where I also use
> default cpu/fpu.

For good reason because without those it will compile target libraries without 
any option and so the default would be used (ie ARMv4T in default mode). Either 
you need to specify some --with-* or you built with multilib.

>
> Maybe I should remove --with-mode=thumb from my config
> --with-cpu=cortex-m3? (but I don't remember if the new logic
> was backported to gcc-5/gcc-6 ?)

No it wasn't backported.

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode
  2016-12-13 11:18       ` Thomas Preudhomme
@ 2016-12-13 11:26         ` Christophe Lyon
  0 siblings, 0 replies; 11+ messages in thread
From: Christophe Lyon @ 2016-12-13 11:26 UTC (permalink / raw)
  To: Thomas Preudhomme
  Cc: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

On 13 December 2016 at 12:18, Thomas Preudhomme
<thomas.preudhomme@foss.arm.com> wrote:
> On 13/12/16 10:11, Christophe Lyon wrote:
>>
>> On 13 December 2016 at 10:54, Thomas Preudhomme
>> <thomas.preudhomme@foss.arm.com> wrote:
>>>
>>> On 12/12/16 21:17, Christophe Lyon wrote:
>>>>
>>>>
>>>> Hi Thomas,
>>>>
>>>> Thanks for working on this,
>>>>
>>>>
>>>> On 12 December 2016 at 18:52, Thomas Preudhomme
>>>> <thomas.preudhomme@foss.arm.com> 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.
>>>>>
>>>>
>>>> How hard would it be to skip these tests only if --with-mode=arm,
>>>> such that they would still pass in configurations --with-mode=thumb?
>>>>
>>>> It seems easy to extend what you propose here, doesn't it?
>>>
>>>
>>>
>>> It is but IMO it gives a false sense of quality since it does not test
>>> the
>>> optional -mthumb logic.
>>>
>>> What is the motivation to make it run with --with-mode=thumb?
>>>
>>
>> With your patch, they will appear as unsupported, right?
>> It's not a big deal.
>
>
> yes indeed.
>
OK, that's fine if that's your intent.

>>
>> Do you know how most people configure their toolchains?
>> Linaro and Ubuntu (I think) use --with-mode=thumb.
>> Do most people use no --with-mode configure flag?
>
>
> I cannot answer for people in general but in our case we use
> --with-multilib-list which will build the toolchain for several -march,
> -mfpu and -mfloat combinations. But it's good to have a mix, it finds more
> issues in the testsuite as this very examples shows.
>
>>
>> In the validations I run against trunk, I always have --with-mode,
>> except for one arm-none-eabi configuration where I also use
>> default cpu/fpu.
>
>
> For good reason because without those it will compile target libraries
> without any option and so the default would be used (ie ARMv4T in default
> mode). Either you need to specify some --with-* or you built with multilib.
>
I keep this configuration with all defaults to make sure everything
still works for the default, armv4t indeed. And there are often problems
in the testsuite as you know, because people test with more modern
configurations.

>>
>> Maybe I should remove --with-mode=thumb from my config
>> --with-cpu=cortex-m3? (but I don't remember if the new logic
>> was backported to gcc-5/gcc-6 ?)
>
>
> No it wasn't backported.
>
> Best regards,
>
> Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM, ping] Skip optional_mthumb tests if GCC has a default mode
  2016-12-12 17:52 [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode Thomas Preudhomme
  2016-12-12 21:17 ` Christophe Lyon
@ 2017-01-03 17:19 ` Thomas Preudhomme
  2017-01-06 21:12   ` Jeff Law
  2017-01-13 18:18   ` Thomas Preudhomme
  1 sibling, 2 replies; 11+ messages in thread
From: Thomas Preudhomme @ 2017-01-03 17:19 UTC (permalink / raw)
  To: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1625 bytes --]

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  <thomas.preudhomme@arm.com>
>
>         * 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

[-- Attachment #2: skip_optional_mthumb_test_default_mode.patch --]
[-- Type: text/x-patch, Size: 3573 bytes --]

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)
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM, ping] Skip optional_mthumb tests if GCC has a default mode
  2017-01-03 17:19 ` [PATCH, GCC/testsuite/ARM, ping] " Thomas Preudhomme
@ 2017-01-06 21:12   ` Jeff Law
  2017-01-09  9:54     ` Thomas Preudhomme
  2017-01-13 18:18   ` Thomas Preudhomme
  1 sibling, 1 reply; 11+ messages in thread
From: Jeff Law @ 2017-01-06 21:12 UTC (permalink / raw)
  To: Thomas Preudhomme, Kyrill Tkachov, Ramana Radhakrishnan,
	Richard Earnshaw, gcc-patches

On 01/03/2017 10:19 AM, Thomas Preudhomme wrote:
> Ping?
>
> Best regards,
Generic parts seem fine to me.  They may be a bit specific to arm right 
now, but we can generalize as needed in the future.

jeff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM, ping] Skip optional_mthumb tests if GCC has a default mode
  2017-01-06 21:12   ` Jeff Law
@ 2017-01-09  9:54     ` Thomas Preudhomme
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Preudhomme @ 2017-01-09  9:54 UTC (permalink / raw)
  To: Jeff Law, Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw,
	gcc-patches

Hi Jeff,

On 06/01/17 21:12, Jeff Law wrote:
> On 01/03/2017 10:19 AM, Thomas Preudhomme wrote:
>> Ping?
>>
>> Best regards,
> Generic parts seem fine to me.  They may be a bit specific to arm right now, but
> we can generalize as needed in the future.

What's too ARM specific about it? The default_mode procedure is together with 
other ARM specific procedures and the check_configured_with seems quite general 
to me. Is there something else you would like to see?

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM, ping] Skip optional_mthumb tests if GCC has a default mode
  2017-01-03 17:19 ` [PATCH, GCC/testsuite/ARM, ping] " Thomas Preudhomme
  2017-01-06 21:12   ` Jeff Law
@ 2017-01-13 18:18   ` Thomas Preudhomme
  2017-01-20 15:22     ` Richard Earnshaw (lists)
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Preudhomme @ 2017-01-13 18:18 UTC (permalink / raw)
  To: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1804 bytes --]

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  <thomas.preudhomme@arm.com>
>>
>>         * 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

[-- Attachment #2: skip_optional_mthumb_test_default_mode.patch --]
[-- Type: text/x-patch, Size: 3573 bytes --]

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)
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, GCC/testsuite/ARM, ping] Skip optional_mthumb tests if GCC has a default mode
  2017-01-13 18:18   ` Thomas Preudhomme
@ 2017-01-20 15:22     ` Richard Earnshaw (lists)
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Earnshaw (lists) @ 2017-01-20 15:22 UTC (permalink / raw)
  To: Thomas Preudhomme, Kyrill Tkachov, Ramana Radhakrishnan, gcc-patches

On 13/01/17 18:17, Thomas Preudhomme wrote:
> 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  <thomas.preudhomme@arm.com>
>>>
>>>         * 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.
>>>
>>>

OK.

R.

>>> Is this ok for stage3?
>>>
>>> Best regards,
>>>
>>> Thomas
> 
> skip_optional_mthumb_test_default_mode.patch
> 
> 
> 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)
>  
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-01-20 15:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-12 17:52 [PATCH, GCC/testsuite/ARM] Skip optional_mthumb tests if GCC has a default mode Thomas Preudhomme
2016-12-12 21:17 ` Christophe Lyon
2016-12-13  9:54   ` Thomas Preudhomme
2016-12-13 10:11     ` Christophe Lyon
2016-12-13 11:18       ` Thomas Preudhomme
2016-12-13 11:26         ` Christophe Lyon
2017-01-03 17:19 ` [PATCH, GCC/testsuite/ARM, ping] " Thomas Preudhomme
2017-01-06 21:12   ` Jeff Law
2017-01-09  9:54     ` Thomas Preudhomme
2017-01-13 18:18   ` Thomas Preudhomme
2017-01-20 15:22     ` Richard Earnshaw (lists)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).