public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, GCC/testsuite/ARM] Allow arm_arch_*_ok to test several macros
@ 2017-06-07 15:42 Thomas Preudhomme
  2017-06-09 12:33 ` Richard Earnshaw (lists)
  2017-06-14 14:11 ` Thomas Preudhomme
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Preudhomme @ 2017-06-07 15:42 UTC (permalink / raw)
  To: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

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

Hi,

The general arm_arch_*_ok procedures check architecture availability by
substituting macros inside a defined preprocessor operator. This limits
them to only check definition of only one macro and force ARMv7VE to be
special cased.

This patch takes advantage of the fact that architecture macros, when
defined, are not null to allow expressing architecture availability by
a boolean operation of possibly several macros. It then takes advantage
of this to deal with ARMv7VE in the general case.  The patch also adds a
comment to make it clear that check_effective_target_arm_arch_FUNC_ok
does not work as intendend for architecture extensions (eg. ARMv8.1-A)
due to lack of extension-specific macro similar to __ARM_ARCH_*__.

ChangeLog entry is as follows:

*** gcc/testsuite/ChangeLog ***

2017-06-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	* lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok):
	Test for null definitions instead of them being undefined.  Add entry
	for ARMv7VE.  Reindent entry for ARMv8-M Baseline.  Add comment warning
	about using the effective target for architecture extension.
	(check_effective_target_arm_arch_v7ve_ok): Remove.
	(add_options_for_arm_arch_v7ve): Likewise.

Testing:
- gcc.target/arm/atomic_loaddi_10.c passes with the patch for armv7ve
   but is marked unsupported for armv7-a
- verified in the logs that -march=armv7ve is correctly added when
   running gcc.target/arm/ftest-armv7ve-arm.c

Is this ok for trunk?

Best regards,

Thomas

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

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ded6383cc1f9a1489cd83e1dace0c2fc48e252c3..e83ec757ae3c0dd7c3cad19cfd5d9577547d18a5 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3775,12 +3775,13 @@ proc check_effective_target_arm_fp16_hw { } {
 # can be selected and a routine to give the flags to select that architecture
 # Note: Extra flags may be added to disable options from newer compilers
 # (Thumb in particular - but others may be added in the future).
-# -march=armv7ve is special and is handled explicitly after this loop because
-# it needs more than one predefine check to identify.
+# Warning: Do not use check_effective_target_arm_arch_*_ok for architecture
+# extension (eg. ARMv8.1-A) since there is no macro defined for them.  See
+# how only __ARM_ARCH_8A__ is checked for ARMv8.1-A.
 # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
 #        /* { dg-add-options arm_arch_v5 } */
 #	 /* { dg-require-effective-target arm_arch_v5_multilib } */
-foreach { armfunc armflag armdef } {
+foreach { armfunc armflag armdefs } {
 	v4 "-march=armv4 -marm" __ARM_ARCH_4__
 	v4t "-march=armv4t" __ARM_ARCH_4T__
 	v5 "-march=armv5 -marm" __ARM_ARCH_5__
@@ -3795,20 +3796,23 @@ foreach { armfunc armflag armdef } {
 	v7r "-march=armv7-r" __ARM_ARCH_7R__
 	v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
 	v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
+	v7ve "-march=armv7ve -marm"
+		"__ARM_ARCH_7A__ && __ARM_FEATURE_IDIV"
 	v8a "-march=armv8-a" __ARM_ARCH_8A__
 	v8_1a "-march=armv8.1a" __ARM_ARCH_8A__
 	v8_2a "-march=armv8.2a" __ARM_ARCH_8A__
-	v8m_base "-march=armv8-m.base -mthumb -mfloat-abi=soft" __ARM_ARCH_8M_BASE__
+	v8m_base "-march=armv8-m.base -mthumb -mfloat-abi=soft"
+		__ARM_ARCH_8M_BASE__
 	v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ } {
-    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
+    eval [string map [list FUNC $armfunc FLAG $armflag DEFS $armdefs ] {
 	proc check_effective_target_arm_arch_FUNC_ok { } {
 	    if { [ string match "*-marm*" "FLAG" ] &&
 		![check_effective_target_arm_arm_ok] } {
 		return 0
 	    }
 	    return [check_no_compiler_messages arm_arch_FUNC_ok assembly {
-		#if !defined (DEF)
-		#error !DEF
+		#if !(DEFS)
+		#error !(DEFS)
 		#endif
 	    } "FLAG" ]
 	}
@@ -3829,26 +3833,6 @@ foreach { armfunc armflag armdef } {
     }]
 }
 
-# Same functions as above but for -march=armv7ve.  To uniquely identify
-# -march=armv7ve we need to check for __ARM_ARCH_7A__ as well as
-# __ARM_FEATURE_IDIV otherwise it aliases with armv7-a.
-
-proc check_effective_target_arm_arch_v7ve_ok { } {
-  if { [ string match "*-marm*" "-march=armv7ve" ] &&
-	![check_effective_target_arm_arm_ok] } {
-		return 0
-    }
-  return [check_no_compiler_messages arm_arch_v7ve_ok assembly {
-  #if !defined (__ARM_ARCH_7A__) || !defined (__ARM_FEATURE_IDIV)
-  #error !armv7ve
-  #endif
-  } "-march=armv7ve" ]
-}
-
-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 { } {
 

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

* Re: [PATCH, GCC/testsuite/ARM] Allow arm_arch_*_ok to test several macros
  2017-06-07 15:42 [PATCH, GCC/testsuite/ARM] Allow arm_arch_*_ok to test several macros Thomas Preudhomme
@ 2017-06-09 12:33 ` Richard Earnshaw (lists)
  2017-06-14 14:11 ` Thomas Preudhomme
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Earnshaw (lists) @ 2017-06-09 12:33 UTC (permalink / raw)
  To: Thomas Preudhomme, Kyrill Tkachov, Ramana Radhakrishnan, gcc-patches

On 07/06/17 16:42, Thomas Preudhomme wrote:
> Hi,
> 
> The general arm_arch_*_ok procedures check architecture availability by
> substituting macros inside a defined preprocessor operator. This limits
> them to only check definition of only one macro and force ARMv7VE to be
> special cased.
> 
> This patch takes advantage of the fact that architecture macros, when
> defined, are not null to allow expressing architecture availability by
> a boolean operation of possibly several macros. It then takes advantage
> of this to deal with ARMv7VE in the general case.  The patch also adds a
> comment to make it clear that check_effective_target_arm_arch_FUNC_ok
> does not work as intendend for architecture extensions (eg. ARMv8.1-A)
> due to lack of extension-specific macro similar to __ARM_ARCH_*__.
> 
> ChangeLog entry is as follows:
> 
> *** gcc/testsuite/ChangeLog ***
> 
> 2017-06-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>
> 
>     * lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok):
>     Test for null definitions instead of them being undefined.  Add entry
>     for ARMv7VE.  Reindent entry for ARMv8-M Baseline.  Add comment warning
>     about using the effective target for architecture extension.
>     (check_effective_target_arm_arch_v7ve_ok): Remove.
>     (add_options_for_arm_arch_v7ve): Likewise.
> 
> Testing:
> - gcc.target/arm/atomic_loaddi_10.c passes with the patch for armv7ve
>   but is marked unsupported for armv7-a
> - verified in the logs that -march=armv7ve is correctly added when
>   running gcc.target/arm/ftest-armv7ve-arm.c
> 
> Is this ok for trunk?
> 

OK.

R.

> Best regards,
> 
> Thomas
> 
> arm_arch_x_ok_several_macros.patch
> 
> 
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index ded6383cc1f9a1489cd83e1dace0c2fc48e252c3..e83ec757ae3c0dd7c3cad19cfd5d9577547d18a5 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -3775,12 +3775,13 @@ proc check_effective_target_arm_fp16_hw { } {
>  # can be selected and a routine to give the flags to select that architecture
>  # Note: Extra flags may be added to disable options from newer compilers
>  # (Thumb in particular - but others may be added in the future).
> -# -march=armv7ve is special and is handled explicitly after this loop because
> -# it needs more than one predefine check to identify.
> +# Warning: Do not use check_effective_target_arm_arch_*_ok for architecture
> +# extension (eg. ARMv8.1-A) since there is no macro defined for them.  See
> +# how only __ARM_ARCH_8A__ is checked for ARMv8.1-A.
>  # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
>  #        /* { dg-add-options arm_arch_v5 } */
>  #	 /* { dg-require-effective-target arm_arch_v5_multilib } */
> -foreach { armfunc armflag armdef } {
> +foreach { armfunc armflag armdefs } {
>  	v4 "-march=armv4 -marm" __ARM_ARCH_4__
>  	v4t "-march=armv4t" __ARM_ARCH_4T__
>  	v5 "-march=armv5 -marm" __ARM_ARCH_5__
> @@ -3795,20 +3796,23 @@ foreach { armfunc armflag armdef } {
>  	v7r "-march=armv7-r" __ARM_ARCH_7R__
>  	v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
>  	v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
> +	v7ve "-march=armv7ve -marm"
> +		"__ARM_ARCH_7A__ && __ARM_FEATURE_IDIV"
>  	v8a "-march=armv8-a" __ARM_ARCH_8A__
>  	v8_1a "-march=armv8.1a" __ARM_ARCH_8A__
>  	v8_2a "-march=armv8.2a" __ARM_ARCH_8A__
> -	v8m_base "-march=armv8-m.base -mthumb -mfloat-abi=soft" __ARM_ARCH_8M_BASE__
> +	v8m_base "-march=armv8-m.base -mthumb -mfloat-abi=soft"
> +		__ARM_ARCH_8M_BASE__
>  	v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ } {
> -    eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
> +    eval [string map [list FUNC $armfunc FLAG $armflag DEFS $armdefs ] {
>  	proc check_effective_target_arm_arch_FUNC_ok { } {
>  	    if { [ string match "*-marm*" "FLAG" ] &&
>  		![check_effective_target_arm_arm_ok] } {
>  		return 0
>  	    }
>  	    return [check_no_compiler_messages arm_arch_FUNC_ok assembly {
> -		#if !defined (DEF)
> -		#error !DEF
> +		#if !(DEFS)
> +		#error !(DEFS)
>  		#endif
>  	    } "FLAG" ]
>  	}
> @@ -3829,26 +3833,6 @@ foreach { armfunc armflag armdef } {
>      }]
>  }
>  
> -# Same functions as above but for -march=armv7ve.  To uniquely identify
> -# -march=armv7ve we need to check for __ARM_ARCH_7A__ as well as
> -# __ARM_FEATURE_IDIV otherwise it aliases with armv7-a.
> -
> -proc check_effective_target_arm_arch_v7ve_ok { } {
> -  if { [ string match "*-marm*" "-march=armv7ve" ] &&
> -	![check_effective_target_arm_arm_ok] } {
> -		return 0
> -    }
> -  return [check_no_compiler_messages arm_arch_v7ve_ok assembly {
> -  #if !defined (__ARM_ARCH_7A__) || !defined (__ARM_FEATURE_IDIV)
> -  #error !armv7ve
> -  #endif
> -  } "-march=armv7ve" ]
> -}
> -
> -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 { } {
>  
> 

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

* Re: [PATCH, GCC/testsuite/ARM] Allow arm_arch_*_ok to test several macros
  2017-06-07 15:42 [PATCH, GCC/testsuite/ARM] Allow arm_arch_*_ok to test several macros Thomas Preudhomme
  2017-06-09 12:33 ` Richard Earnshaw (lists)
@ 2017-06-14 14:11 ` Thomas Preudhomme
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Preudhomme @ 2017-06-14 14:11 UTC (permalink / raw)
  To: Kyrill Tkachov, Ramana Radhakrishnan, Richard Earnshaw, gcc-patches

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

I've heard adding the patch usually helps getting it review so here it is. :-)

Best regards,

Thomas

On 07/06/17 16:42, Thomas Preudhomme wrote:
> Hi,
>
> The general arm_arch_*_ok procedures check architecture availability by
> substituting macros inside a defined preprocessor operator. This limits
> them to only check definition of only one macro and force ARMv7VE to be
> special cased.
>
> This patch takes advantage of the fact that architecture macros, when
> defined, are not null to allow expressing architecture availability by
> a boolean operation of possibly several macros. It then takes advantage
> of this to deal with ARMv7VE in the general case.  The patch also adds a
> comment to make it clear that check_effective_target_arm_arch_FUNC_ok
> does not work as intendend for architecture extensions (eg. ARMv8.1-A)
> due to lack of extension-specific macro similar to __ARM_ARCH_*__.
>
> ChangeLog entry is as follows:
>
> *** gcc/testsuite/ChangeLog ***
>
> 2017-06-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>
>
>     * lib/target-supports.exp (check_effective_target_arm_arch_FUNC_ok):
>     Test for null definitions instead of them being undefined.  Add entry
>     for ARMv7VE.  Reindent entry for ARMv8-M Baseline.  Add comment warning
>     about using the effective target for architecture extension.
>     (check_effective_target_arm_arch_v7ve_ok): Remove.
>     (add_options_for_arm_arch_v7ve): Likewise.
>
> Testing:
> - gcc.target/arm/atomic_loaddi_10.c passes with the patch for armv7ve
>   but is marked unsupported for armv7-a
> - verified in the logs that -march=armv7ve is correctly added when
>   running gcc.target/arm/ftest-armv7ve-arm.c
>
> Is this ok for trunk?
>
> Best regards,
>
> Thomas

[-- Attachment #2: multi_tool_dg-cmp-results.patch --]
[-- Type: text/x-patch, Size: 899 bytes --]

diff --git a/contrib/dg-cmp-results.sh b/contrib/dg-cmp-results.sh
index d291769547dcd2a02ecf6f80d60d6be7802af4fd..d875b4bd8bca16c1f381355612ef34f6879c5674 100755
--- a/contrib/dg-cmp-results.sh
+++ b/contrib/dg-cmp-results.sh
@@ -91,8 +91,7 @@ sed $E -e '/^[[:space:]]+===/,$d' $NFILE
 
 # Create a temporary file from the old file's interesting section.
 sed $E -e "1,/$header/d" \
-  -e '/^[[:space:]]+===/,$d' \
-  -e '/^[A-Z]+:/!d' \
+  -e '/^Running target /,/^[[:space:]]+===.*Summary ===/!d' \
   -e '/^(WARNING|ERROR):/d' \
   -e 's/\r$//' \
   -e 's/^/O:/' \
@@ -102,8 +101,7 @@ sed $E -e "1,/$header/d" \
 
 # Create a temporary file from the new file's interesting section.
 sed $E -e "1,/$header/d" \
-  -e '/^[[:space:]]+===/,$d' \
-  -e '/^[A-Z]+:/!d' \
+  -e '/^Running target /,/^[[:space:]]+===.*Summary ===/!d' \
   -e '/^(WARNING|ERROR):/d' \
   -e 's/\r$//' \
   -e 's/^/N:/' \

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

end of thread, other threads:[~2017-06-14 14:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-07 15:42 [PATCH, GCC/testsuite/ARM] Allow arm_arch_*_ok to test several macros Thomas Preudhomme
2017-06-09 12:33 ` Richard Earnshaw (lists)
2017-06-14 14:11 ` Thomas Preudhomme

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).