diff mbox series

[arm] Make gcc.target/arm/copysign_softfloat_1.c more robust

Message ID 5A65C162.7020205@foss.arm.com
State New
Headers show
Series [arm] Make gcc.target/arm/copysign_softfloat_1.c more robust | expand

Commit Message

Kyrill Tkachov Jan. 22, 2018, 10:48 a.m. UTC
Hi all,

This test has needlessly restrictive requirements. It tries to force a soft-float target and tries to run.
This makes it unsupportable for any non-soft-float variant.
In fact, the test can be a run-time test for any target, and only the scan-assembler tests are specific to
-mfloat-abi=soft. So this patch makes the test always runnable and makes the scan-assembler checks predicable
on the the new arm_sotftfloat effective target check.

Committing to trunk.
Thanks,
Kyrill

2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * doc/sourcebuild.texi (arm_softfloat): Document.

2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * lib/target-supports.exp (check_effective_target_arm_softfloat):
     New procedure.
     * gcc.target/arm/copysign_softfloat_1.c: Allow running everywhere.
     Adjust scan-assembler checks for soft-float.

Comments

Christophe Lyon Jan. 23, 2018, 1:09 p.m. UTC | #1
Hi Kyrill,

On 22 January 2018 at 11:48, Kyrill  Tkachov
<kyrylo.tkachov@foss.arm.com> wrote:
> Hi all,
>
> This test has needlessly restrictive requirements. It tries to force a
> soft-float target and tries to run.
> This makes it unsupportable for any non-soft-float variant.
> In fact, the test can be a run-time test for any target, and only the
> scan-assembler tests are specific to
> -mfloat-abi=soft. So this patch makes the test always runnable and makes the
> scan-assembler checks predicable
> on the the new arm_sotftfloat effective target check.
>

Unfortunately, the test now fails on armeb-linux-gnueabihf (it used to
be unsupported).
my logs only show:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped

on arm-linux-gnueabihf, it's OK (the test was unsupported, but now passes)

Christophe

> Committing to trunk.
> Thanks,
> Kyrill
>
> 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * doc/sourcebuild.texi (arm_softfloat): Document.
>
> 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * lib/target-supports.exp (check_effective_target_arm_softfloat):
>     New procedure.
>     * gcc.target/arm/copysign_softfloat_1.c: Allow running everywhere.
>     Adjust scan-assembler checks for soft-float.
Kyrill Tkachov Jan. 23, 2018, 2:57 p.m. UTC | #2
Hi Christophe,

On 23/01/18 13:09, Christophe Lyon wrote:
> Hi Kyrill,
>
> On 22 January 2018 at 11:48, Kyrill  Tkachov
> <kyrylo.tkachov@foss.arm.com> wrote:
>> Hi all,
>>
>> This test has needlessly restrictive requirements. It tries to force a
>> soft-float target and tries to run.
>> This makes it unsupportable for any non-soft-float variant.
>> In fact, the test can be a run-time test for any target, and only the
>> scan-assembler tests are specific to
>> -mfloat-abi=soft. So this patch makes the test always runnable and makes the
>> scan-assembler checks predicable
>> on the the new arm_sotftfloat effective target check.
>>
> Unfortunately, the test now fails on armeb-linux-gnueabihf (it used to
> be unsupported).
> my logs only show:
> qemu: uncaught target signal 11 (Segmentation fault) - core dumped

:( it runs fine for me on a armeb-none-eabi --with-float=hard target with a Foundation Model.
Unfortunately I don't have access to an armeb-non-linux-gnueabihf setup.
Could you provide more detailed configuration options so that I can try to reproduce the
exact -march -m[arm,thumb], -mfpu setup?

Thanks,
Kyrill

> on arm-linux-gnueabihf, it's OK (the test was unsupported, but now passes)
>
> Christophe
>
>> Committing to trunk.
>> Thanks,
>> Kyrill
>>
>> 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>      * doc/sourcebuild.texi (arm_softfloat): Document.
>>
>> 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>      * lib/target-supports.exp (check_effective_target_arm_softfloat):
>>      New procedure.
>>      * gcc.target/arm/copysign_softfloat_1.c: Allow running everywhere.
>>      Adjust scan-assembler checks for soft-float.
Christophe Lyon Jan. 23, 2018, 3:08 p.m. UTC | #3
On 23 January 2018 at 15:57, Kyrill  Tkachov
<kyrylo.tkachov@foss.arm.com> wrote:
> Hi Christophe,
>
> On 23/01/18 13:09, Christophe Lyon wrote:
>>
>> Hi Kyrill,
>>
>> On 22 January 2018 at 11:48, Kyrill  Tkachov
>> <kyrylo.tkachov@foss.arm.com> wrote:
>>>
>>> Hi all,
>>>
>>> This test has needlessly restrictive requirements. It tries to force a
>>> soft-float target and tries to run.
>>> This makes it unsupportable for any non-soft-float variant.
>>> In fact, the test can be a run-time test for any target, and only the
>>> scan-assembler tests are specific to
>>> -mfloat-abi=soft. So this patch makes the test always runnable and makes
>>> the
>>> scan-assembler checks predicable
>>> on the the new arm_sotftfloat effective target check.
>>>
>> Unfortunately, the test now fails on armeb-linux-gnueabihf (it used to
>> be unsupported).
>> my logs only show:
>> qemu: uncaught target signal 11 (Segmentation fault) - core dumped
>
>
> :( it runs fine for me on a armeb-none-eabi --with-float=hard target with a
> Foundation Model.
> Unfortunately I don't have access to an armeb-non-linux-gnueabihf setup.
> Could you provide more detailed configuration options so that I can try to
> reproduce the
> exact -march -m[arm,thumb], -mfpu setup?
>

I'm using qemu in user-mode, and I see this error on the 3
configurations I test:
--with-cpu=cortex-a9
--with-mode=arm or thumb
--with-fpu=neon-fp16 or vfpv3-d16-fp16

HTH

> Thanks,
> Kyrill
>
>
>> on arm-linux-gnueabihf, it's OK (the test was unsupported, but now passes)
>>
>> Christophe
>>
>>> Committing to trunk.
>>> Thanks,
>>> Kyrill
>>>
>>> 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>
>>>      * doc/sourcebuild.texi (arm_softfloat): Document.
>>>
>>> 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>>
>>>      * lib/target-supports.exp (check_effective_target_arm_softfloat):
>>>      New procedure.
>>>      * gcc.target/arm/copysign_softfloat_1.c: Allow running everywhere.
>>>      Adjust scan-assembler checks for soft-float.
>
>
diff mbox series

Patch

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index f0233c9cca4ca32248db407bf00fb4c97eb740b1..69fbf6ac76842ae90fcf4f07638755c18ecc23c9 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1650,6 +1650,10 @@  ARM target adheres to the VFP and Advanced SIMD Register Arguments
 variant of the ABI for the ARM Architecture (as selected with
 @code{-mfloat-abi=hard}).
 
+@item arm_softfloat
+ARM target uses the soft-float ABI with no floating-point instructions
+used whatsoever (as selected with @code{-mfloat-abi=soft}).
+
 @item arm_hard_vfp_ok
 ARM target supports @code{-mfpu=vfp -mfloat-abi=hard}.
 Some multilibs may be incompatible with these options.
diff --git a/gcc/testsuite/gcc.target/arm/copysign_softfloat_1.c b/gcc/testsuite/gcc.target/arm/copysign_softfloat_1.c
index d79d014e27cf445cd741504c6b256a3a51ace6cd..fdbeeadc01e1c9b9a7810a8ff8b23c58f6c429a5 100644
--- a/gcc/testsuite/gcc.target/arm/copysign_softfloat_1.c
+++ b/gcc/testsuite/gcc.target/arm/copysign_softfloat_1.c
@@ -1,8 +1,8 @@ 
 /* { dg-do run } */
 /* { dg-require-effective-target arm_thumb2_ok } */
-/* { dg-require-effective-target arm_soft_ok } */
-/* { dg-skip-if "skip override" { *-*-* } { "-mfloat-abi=softfp" "-mfloat-abi=hard" } { "" } } */
-/* { dg-options "-O2 -mfloat-abi=soft --save-temps" } */
+/* { dg-add-options arm_arch_v6t2 } */
+/* { dg-additional-options "-O2 --save-temps" } */
+
 extern void abort (void);
 
 #define N 16
@@ -42,8 +42,8 @@  main (int argc, char **argv)
 {
   int index = 0;
 
-/* { dg-final { scan-assembler-times "bfi" 2 } } */
-/* { dg-final { scan-assembler-times "lsr" 1 } } */
+/* { dg-final { scan-assembler-times "bfi" 2 { target arm_softfloat } } } */
+/* { dg-final { scan-assembler-times "lsr" 1 { target arm_softfloat } } } */
   for (index; index < N; index++)
     {
       if (__builtin_copysignf (a_f[index], b_f[index]) != c_f[index])
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 4095f6386b19d601ffd345922b14e015565a2462..50ec1adbf8158b5f29130d3919fcd86de8be5248 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -4879,6 +4879,19 @@  proc check_effective_target_arm_hf_eabi { } {
     }]
 }
 
+# Return 1 if this is an ARM target that uses the soft float ABI
+# with no floating-point instructions at all (e.g. -mfloat-abi=soft).
+
+proc check_effective_target_arm_softfloat { } {
+    return [check_no_compiler_messages arm_softfloat object {
+	#if !defined(__SOFTFP__)
+	#error not soft-float EABI
+	#else
+	int dummy;
+	#endif
+    }]
+}
+
 # Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
 # Some multilibs may be incompatible with this option.