[committed,01/22] arm: testsuite: correctly detect armv6t2 hardware for acle execution tests

Message ID 20231113142658.69039-2-rearnsha@arm.com
State Unresolved
Headers
Series arm: testsuite: clean up some architecture-specific tests |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Richard Earnshaw Nov. 13, 2023, 2:26 p.m. UTC
  Some of the ACLE tests for Arm are executable, but we were only testing
that the compiler could generate code for them, not that the hardware
was capable of executing them.  Fix this by adding an execution test for
suitable hardware.

gcc/testsuite:

	* lib/target-supports.exp (check_effective_target_arm_arch_v6t2_hw_ok):
	New function.
	* gcc.target/arm/acle/data-intrinsics-armv6.c: Use it.
	* gcc.target/arm/acle/data-intrinsics-rbit.c: Likewise.
---
 .../arm/acle/data-intrinsics-armv6.c           |  2 +-
 .../gcc.target/arm/acle/data-intrinsics-rbit.c |  2 +-
 gcc/testsuite/lib/target-supports.exp          | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 2 deletions(-)
  

Comments

Christophe Lyon Nov. 14, 2023, 5:01 p.m. UTC | #1
Hi,

On 11/13/23 15:26, Richard Earnshaw wrote:
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 1a7bea96c1e..d414cddf4dc 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -5590,6 +5590,24 @@ proc check_effective_target_arm_thumb1_cbz_ok {} {
>       }
>   }
>   
> +# Return 1 if this is an Arm target which supports the Armv6t2 extensions.
> +# This can be either in Arm state or in Thumb state.
> +
> +proc check_effective_target_arm_arch_v6t2_hw_ok {} {
> +    if [check_effective_target_arm_thumb1_ok] {

Why arm_thumb1_ok and not arm_arch_v6t2_ok ?

Thanks,

Christophe


> +	return [check_no_compiler_messages arm_movt object {
> +	    int
> +	    main (void)
> +	    {
> +	      asm ("bfc r0, #1, #2");
> +	      return 0;
> +	    }
> +	} [add_options_for_arm_arch_v6t2 ""]]
> +    } else {
> +	return 0
> +    }
> +}
> +
>   # Return 1 if this is an ARM target where ARMv8-M Security Extensions is
>   # available.
>
  
Richard Earnshaw Nov. 14, 2023, 5:23 p.m. UTC | #2
On 14/11/2023 17:01, Christophe Lyon wrote:
> Hi,
> 
> On 11/13/23 15:26, Richard Earnshaw wrote:
>> diff --git a/gcc/testsuite/lib/target-supports.exp 
>> b/gcc/testsuite/lib/target-supports.exp
>> index 1a7bea96c1e..d414cddf4dc 100644
>> --- a/gcc/testsuite/lib/target-supports.exp
>> +++ b/gcc/testsuite/lib/target-supports.exp
>> @@ -5590,6 +5590,24 @@ proc check_effective_target_arm_thumb1_cbz_ok {} {
>>       }
>>   }
>> +# Return 1 if this is an Arm target which supports the Armv6t2 
>> extensions.
>> +# This can be either in Arm state or in Thumb state.
>> +
>> +proc check_effective_target_arm_arch_v6t2_hw_ok {} {
>> +    if [check_effective_target_arm_thumb1_ok] {
> 
> Why arm_thumb1_ok and not arm_arch_v6t2_ok ?

Because I cloned the function immediately above, then only half fixed 
it.  That's not the only bug though.  It never tries to run the test 
(object only runs the compiler with '-c', so it stops after assembly), 
which it should if it's checking if the HW can run a test.

Ooops!

I'll fix that.  Thanks for catching.

R.

> 
> Thanks,
> 
> Christophe
> 
> 
>> +    return [check_no_compiler_messages arm_movt object {
>> +        int
>> +        main (void)
>> +        {
>> +          asm ("bfc r0, #1, #2");
>> +          return 0;
>> +        }
>> +    } [add_options_for_arm_arch_v6t2 ""]]
>> +    } else {
>> +    return 0
>> +    }
>> +}
>> +
>>   # Return 1 if this is an ARM target where ARMv8-M Security 
>> Extensions is
>>   # available.
  

Patch

diff --git a/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-armv6.c b/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-armv6.c
index 988ecac3787..6dc8c55e2f9 100644
--- a/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-armv6.c
+++ b/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-armv6.c
@@ -1,5 +1,5 @@ 
 /* { dg-do run } */
-/* { dg-require-effective-target arm_arch_v6t2_ok } */
+/* { dg-require-effective-target arm_arch_v6t2_hw_ok } */
 /* { dg-add-options arm_arch_v6t2 } */
 
 #include "arm_acle.h"
diff --git a/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-rbit.c b/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-rbit.c
index d1fe274b5ce..b01c4219a7e 100644
--- a/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-rbit.c
+++ b/gcc/testsuite/gcc.target/arm/acle/data-intrinsics-rbit.c
@@ -1,6 +1,6 @@ 
 /* Test the ACLE data intrinsics existence for specific instruction.  */
 /* { dg-do run } */
-/* { dg-require-effective-target arm_arch_v6t2_ok } */
+/* { dg-require-effective-target arm_arch_v6t2_hw_ok } */
 /* { dg-additional-options "--save-temps -O1" } */
 /* { dg-add-options arm_arch_v6t2 } */
 /* { dg-final { check-function-bodies "**" "" "" } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 1a7bea96c1e..d414cddf4dc 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5590,6 +5590,24 @@  proc check_effective_target_arm_thumb1_cbz_ok {} {
     }
 }
 
+# Return 1 if this is an Arm target which supports the Armv6t2 extensions.
+# This can be either in Arm state or in Thumb state.
+
+proc check_effective_target_arm_arch_v6t2_hw_ok {} {
+    if [check_effective_target_arm_thumb1_ok] {
+	return [check_no_compiler_messages arm_movt object {
+	    int
+	    main (void)
+	    {
+	      asm ("bfc r0, #1, #2");
+	      return 0;
+	    }
+	} [add_options_for_arm_arch_v6t2 ""]]
+    } else {
+	return 0
+    }
+}
+
 # Return 1 if this is an ARM target where ARMv8-M Security Extensions is
 # available.