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.tkac...@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.
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); +}