diff mbox

[ARM] Fix gcc.target/arm/builtin-bswap16-1.c

Message ID 57514013.3010608@foss.arm.com
State New
Headers show

Commit Message

Kyrill Tkachov June 3, 2016, 8:30 a.m. UTC
Hi all,

The test gcc.target/arm/builtin-bswap16-1.c refuses to compile when testing a toolchain configured with
--with-mode=thumb --with-float=hard and an architecture that supports Thumb2.
This is because the test explicitly sets the -march option to armv6 and we get an error complaining
about Thumb1 used with the hard-float ABI.

The proposed solution in this patch is to bump the architecture to armv6t2 so that it uses Thumb2 when
-mthumb is used.

But we don't want to lose Thumb1 test coverage. So this patch moves the actual C code into a separate
.x file and includes it in two different tests, each testing Thumb1 or Thumb2.

The new test passes and builtin-bswap16-1.c also now passes rather than complaining about the float ABI.

Ok for trunk?

Thanks,
Kyrill

2016-06-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/arm/builtin-bswap16-1.c: Add -mfloat-abi=soft
     and -mthumb to dg-options.  Include builtin-bswap16.x.
     * gcc.target/arm/builtin-bswap16: New file.
     * gcc.target/arm/builtin-bswap16-2.c: New test.

Comments

Kyrill Tkachov June 10, 2016, 9:28 a.m. UTC | #1
Ping.
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00249.html

Thanks,
Kyrill

On 03/06/16 09:30, Kyrill Tkachov wrote:
> Hi all,
>
> The test gcc.target/arm/builtin-bswap16-1.c refuses to compile when testing a toolchain configured with
> --with-mode=thumb --with-float=hard and an architecture that supports Thumb2.
> This is because the test explicitly sets the -march option to armv6 and we get an error complaining
> about Thumb1 used with the hard-float ABI.
>
> The proposed solution in this patch is to bump the architecture to armv6t2 so that it uses Thumb2 when
> -mthumb is used.
>
> But we don't want to lose Thumb1 test coverage. So this patch moves the actual C code into a separate
> .x file and includes it in two different tests, each testing Thumb1 or Thumb2.
>
> The new test passes and builtin-bswap16-1.c also now passes rather than complaining about the float ABI.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2016-06-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * gcc.target/arm/builtin-bswap16-1.c: Add -mfloat-abi=soft
>     and -mthumb to dg-options.  Include builtin-bswap16.x.
>     * gcc.target/arm/builtin-bswap16: New file.
>     * gcc.target/arm/builtin-bswap16-2.c: New test.
Christophe Lyon June 13, 2016, 7:42 a.m. UTC | #2
On 10 June 2016 at 11:28, Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> wrote:
> Ping.
> https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00249.html
>

I tested this patch in my usual matrix, and it's OK for me.

Christophe

> Thanks,
> Kyrill
>
>
> On 03/06/16 09:30, Kyrill Tkachov wrote:
>>
>> Hi all,
>>
>> The test gcc.target/arm/builtin-bswap16-1.c refuses to compile when
>> testing a toolchain configured with
>> --with-mode=thumb --with-float=hard and an architecture that supports
>> Thumb2.
>> This is because the test explicitly sets the -march option to armv6 and we
>> get an error complaining
>> about Thumb1 used with the hard-float ABI.
>>
>> The proposed solution in this patch is to bump the architecture to armv6t2
>> so that it uses Thumb2 when
>> -mthumb is used.
>>
>> But we don't want to lose Thumb1 test coverage. So this patch moves the
>> actual C code into a separate
>> .x file and includes it in two different tests, each testing Thumb1 or
>> Thumb2.
>>
>> The new test passes and builtin-bswap16-1.c also now passes rather than
>> complaining about the float ABI.
>>
>> Ok for trunk?
>>
>> Thanks,
>> Kyrill
>>
>> 2016-06-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>     * gcc.target/arm/builtin-bswap16-1.c: Add -mfloat-abi=soft
>>     and -mthumb to dg-options.  Include builtin-bswap16.x.
>>     * gcc.target/arm/builtin-bswap16: New file.
>>     * gcc.target/arm/builtin-bswap16-2.c: New test.
>
>
Kyrill Tkachov June 28, 2016, 2:08 p.m. UTC | #3
Ping.

Thanks,
Kyrill

On 10/06/16 10:28, Kyrill Tkachov wrote:
> Ping.
> https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00249.html
>
> Thanks,
> Kyrill
>
> On 03/06/16 09:30, Kyrill Tkachov wrote:
>> Hi all,
>>
>> The test gcc.target/arm/builtin-bswap16-1.c refuses to compile when testing a toolchain configured with
>> --with-mode=thumb --with-float=hard and an architecture that supports Thumb2.
>> This is because the test explicitly sets the -march option to armv6 and we get an error complaining
>> about Thumb1 used with the hard-float ABI.
>>
>> The proposed solution in this patch is to bump the architecture to armv6t2 so that it uses Thumb2 when
>> -mthumb is used.
>>
>> But we don't want to lose Thumb1 test coverage. So this patch moves the actual C code into a separate
>> .x file and includes it in two different tests, each testing Thumb1 or Thumb2.
>>
>> The new test passes and builtin-bswap16-1.c also now passes rather than complaining about the float ABI.
>>
>> Ok for trunk?
>>
>> Thanks,
>> Kyrill
>>
>> 2016-06-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>     * gcc.target/arm/builtin-bswap16-1.c: Add -mfloat-abi=soft
>>     and -mthumb to dg-options.  Include builtin-bswap16.x.
>>     * gcc.target/arm/builtin-bswap16: New file.
>>     * gcc.target/arm/builtin-bswap16-2.c: New test.
>
Richard Earnshaw (lists) June 28, 2016, 3:58 p.m. UTC | #4
On 03/06/16 09:30, Kyrill Tkachov wrote:
> Hi all,
> 
> The test gcc.target/arm/builtin-bswap16-1.c refuses to compile when
> testing a toolchain configured with
> --with-mode=thumb --with-float=hard and an architecture that supports
> Thumb2.
> This is because the test explicitly sets the -march option to armv6 and
> we get an error complaining
> about Thumb1 used with the hard-float ABI.
> 
> The proposed solution in this patch is to bump the architecture to
> armv6t2 so that it uses Thumb2 when
> -mthumb is used.
> 
> But we don't want to lose Thumb1 test coverage. So this patch moves the
> actual C code into a separate
> .x file and includes it in two different tests, each testing Thumb1 or
> Thumb2.
> 
> The new test passes and builtin-bswap16-1.c also now passes rather than
> complaining about the float ABI.
> 
> Ok for trunk?
> 

Traditionally, the old C-torture testsuite (now gcc.c-torture) used .x
as the filename extension for a test control script.  So I'm not too
keen on overloading that meaning (though I note that has been used in
quite a few aarch64 tests).  So OK, but please rename it to use a
different extension letter.  Any reason why you can't use .h?

R.


> Thanks,
> Kyrill
> 
> 2016-06-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>     * gcc.target/arm/builtin-bswap16-1.c: Add -mfloat-abi=soft
>     and -mthumb to dg-options.  Include builtin-bswap16.x.
>     * gcc.target/arm/builtin-bswap16: New file.
>     * gcc.target/arm/builtin-bswap16-2.c: New test.
> 
> arm-bswap-test.patch
> 
> 
> diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
> index 6920f004eab42443441227029c579aeb2bb981ee..7c3f8370e132b4c41ad7b3dac973b552c4ddbfe1 100644
> --- a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
> +++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
> @@ -1,15 +1,10 @@
>  /* { dg-do compile } */
> -/* { dg-options "-O2" } */
> +/* { dg-options "-O2 -mthumb -mfloat-abi=soft" } */
>  /* { dg-require-effective-target arm_arch_v6_ok } */
>  /* { dg-add-options arm_arch_v6 } */
> -/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
>  
> -unsigned short swapu16_1 (unsigned short x)
> -{
> -  return (x << 8) | (x >> 8);
> -}
> +/* Test Thumb1 code generation when -mthumb is used.  */
> +
> +#include "builtin-bswap16.x"
>  
> -unsigned short swapu16_2 (unsigned short x)
> -{
> -  return (x >> 8) | (x << 8);
> -}
> +/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
> diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c b/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..a4927e3ab0ced7a272e5acb4a5c2bcb1b2badafc
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c
> @@ -0,0 +1,11 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +/* { dg-require-effective-target arm_arch_v6t2_ok } */
> +/* { dg-add-options arm_arch_v6t2 } */
> +
> +/* Test Thumb2 code generation when -mthumb is used.  */
> +
> +#include "builtin-bswap16.x"
> +
> +/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
> +
> diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16.x b/gcc/testsuite/gcc.target/arm/builtin-bswap16.x
> new file mode 100644
> index 0000000000000000000000000000000000000000..1e7f41edf013e353944f0a4879a1248c8a8b2f11
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16.x
> @@ -0,0 +1,9 @@
> +unsigned short swapu16_1 (unsigned short x)
> +{
> +  return (x << 8) | (x >> 8);
> +}
> +
> +unsigned short swapu16_2 (unsigned short x)
> +{
> +  return (x >> 8) | (x << 8);
> +}
>
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
index 6920f004eab42443441227029c579aeb2bb981ee..7c3f8370e132b4c41ad7b3dac973b552c4ddbfe1 100644
--- a/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
+++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-1.c
@@ -1,15 +1,10 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mthumb -mfloat-abi=soft" } */
 /* { dg-require-effective-target arm_arch_v6_ok } */
 /* { dg-add-options arm_arch_v6 } */
-/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
 
-unsigned short swapu16_1 (unsigned short x)
-{
-  return (x << 8) | (x >> 8);
-}
+/* Test Thumb1 code generation when -mthumb is used.  */
+
+#include "builtin-bswap16.x"
 
-unsigned short swapu16_2 (unsigned short x)
-{
-  return (x >> 8) | (x << 8);
-}
+/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c b/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c
new file mode 100644
index 0000000000000000000000000000000000000000..a4927e3ab0ced7a272e5acb4a5c2bcb1b2badafc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16-2.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target arm_arch_v6t2_ok } */
+/* { dg-add-options arm_arch_v6t2 } */
+
+/* Test Thumb2 code generation when -mthumb is used.  */
+
+#include "builtin-bswap16.x"
+
+/* { dg-final { scan-assembler-not "orr\[ \t\]" } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/builtin-bswap16.x b/gcc/testsuite/gcc.target/arm/builtin-bswap16.x
new file mode 100644
index 0000000000000000000000000000000000000000..1e7f41edf013e353944f0a4879a1248c8a8b2f11
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/builtin-bswap16.x
@@ -0,0 +1,9 @@ 
+unsigned short swapu16_1 (unsigned short x)
+{
+  return (x << 8) | (x >> 8);
+}
+
+unsigned short swapu16_2 (unsigned short x)
+{
+  return (x >> 8) | (x << 8);
+}