testsuite: Tweak gcc.dg/attr-aligned.c for CRIS

Message ID 20230216200529.AC55F2042C@pchp3.se.axis.com
State Accepted
Headers
Series testsuite: Tweak gcc.dg/attr-aligned.c for CRIS |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Hans-Peter Nilsson Feb. 16, 2023, 8:05 p.m. UTC
  Asking for the lines outside the "#if __CRIS__" part.
Ok to commit?

-- >8 --
tm.texi says for BIGGEST_ALIGNMENT (from which
__BIGGEST_ALIGNMENT__ is derived): "Biggest alignment that
any data type can require on this machine, in bits."

That is, using that value might be too strict for alignment
of *functions* and CRIS requires at least 16-bit alignment
for functions.  But, one purpose of the test is to test that
alignment can be set to a large but valid value, so pick
512, which has some use as a historically required alignment
for certain I/O descriptors.

	* gcc.dg/attr-aligned.c: Adjust comment for ALIGN_MAX_STATIC.
	(ALIGN_MAX_STATIC): Set to 512 for CRIS.
---
 gcc/testsuite/gcc.dg/attr-aligned.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Hans-Peter Nilsson Feb. 28, 2023, 1:54 a.m. UTC | #1
Ping...

> From: Hans-Peter Nilsson <hp@axis.com>
> Date: Thu, 16 Feb 2023 21:05:29 +0100

> Asking for the lines outside the "#if __CRIS__" part.
> Ok to commit?
> 
> -- >8 --
> tm.texi says for BIGGEST_ALIGNMENT (from which
> __BIGGEST_ALIGNMENT__ is derived): "Biggest alignment that
> any data type can require on this machine, in bits."
> 
> That is, using that value might be too strict for alignment
> of *functions* and CRIS requires at least 16-bit alignment
> for functions.  But, one purpose of the test is to test that
> alignment can be set to a large but valid value, so pick
> 512, which has some use as a historically required alignment
> for certain I/O descriptors.
> 
> 	* gcc.dg/attr-aligned.c: Adjust comment for ALIGN_MAX_STATIC.
> 	(ALIGN_MAX_STATIC): Set to 512 for CRIS.
> ---
>  gcc/testsuite/gcc.dg/attr-aligned.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/attr-aligned.c b/gcc/testsuite/gcc.dg/attr-aligned.c
> index 887bdd0f3799..4f0c885dc812 100644
> --- a/gcc/testsuite/gcc.dg/attr-aligned.c
> +++ b/gcc/testsuite/gcc.dg/attr-aligned.c
> @@ -18,6 +18,10 @@
>  # else
>  #   define ALIGN_MAX_STATIC      ALIGN_MAX_HARD
>  # endif
> +#elif __CRIS__
> +/* __BIGGEST_ALIGNMENT__ doesn't cover functions (16 bits for CRIS). */
> +#  define ALIGN_MAX_STATIC      512
> +#  define ALIGN_TOO_BIG_OFILE   (ALIGN_MAX_HARD << 1)
>  #elif pdp11
>  #  define ALIGN_MAX_STATIC      2
>  /* Work around a pdp11 ICE (see PR target/87821).  */
> @@ -29,7 +33,9 @@
>  /* Is this processor- or operating-system specific?  */
>  #  define ALIGN_MAX_STATIC      ALIGN_MAX_HARD
>  #else
> -   /* Guaranteed to be accepted regardless of the target.  */
> +   /* Guaranteed to be accepted regardless of the target for objects.
> +      This might not be true for alignment of functions though, so
> +      may need to be set to a target-specific value above.  */
>  #  define ALIGN_MAX_STATIC      __BIGGEST_ALIGNMENT__
>     /* Guaranteed to be rejected regardless of the target.  */
>  #  define ALIGN_TOO_BIG_OFILE   (ALIGN_MAX_HARD << 1)
> -- 
> 2.30.2
>
  
Mike Stump March 2, 2023, 6:10 p.m. UTC | #2
On Feb 27, 2023, at 5:54 PM, Hans-Peter Nilsson via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> Ping...

Ok.

> 
>> From: Hans-Peter Nilsson <hp@axis.com>
>> Date: Thu, 16 Feb 2023 21:05:29 +0100
> 
>> Asking for the lines outside the "#if __CRIS__" part.
>> Ok to commit?
>> 
>> -- >8 --
>> tm.texi says for BIGGEST_ALIGNMENT (from which
>> __BIGGEST_ALIGNMENT__ is derived): "Biggest alignment that
>> any data type can require on this machine, in bits."
>> 
>> That is, using that value might be too strict for alignment
>> of *functions* and CRIS requires at least 16-bit alignment
>> for functions.  But, one purpose of the test is to test that
>> alignment can be set to a large but valid value, so pick
>> 512, which has some use as a historically required alignment
>> for certain I/O descriptors.
>> 
>> 	* gcc.dg/attr-aligned.c: Adjust comment for ALIGN_MAX_STATIC.
>> 	(ALIGN_MAX_STATIC): Set to 512 for CRIS.
>> ---
>> gcc/testsuite/gcc.dg/attr-aligned.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gcc/testsuite/gcc.dg/attr-aligned.c b/gcc/testsuite/gcc.dg/attr-aligned.c
>> index 887bdd0f3799..4f0c885dc812 100644
>> --- a/gcc/testsuite/gcc.dg/attr-aligned.c
>> +++ b/gcc/testsuite/gcc.dg/attr-aligned.c
>> @@ -18,6 +18,10 @@
>> # else
>> #   define ALIGN_MAX_STATIC      ALIGN_MAX_HARD
>> # endif
>> +#elif __CRIS__
>> +/* __BIGGEST_ALIGNMENT__ doesn't cover functions (16 bits for CRIS). */
>> +#  define ALIGN_MAX_STATIC      512
>> +#  define ALIGN_TOO_BIG_OFILE   (ALIGN_MAX_HARD << 1)
>> #elif pdp11
>> #  define ALIGN_MAX_STATIC      2
>> /* Work around a pdp11 ICE (see PR target/87821).  */
>> @@ -29,7 +33,9 @@
>> /* Is this processor- or operating-system specific?  */
>> #  define ALIGN_MAX_STATIC      ALIGN_MAX_HARD
>> #else
>> -   /* Guaranteed to be accepted regardless of the target.  */
>> +   /* Guaranteed to be accepted regardless of the target for objects.
>> +      This might not be true for alignment of functions though, so
>> +      may need to be set to a target-specific value above.  */
>> #  define ALIGN_MAX_STATIC      __BIGGEST_ALIGNMENT__
>>    /* Guaranteed to be rejected regardless of the target.  */
>> #  define ALIGN_TOO_BIG_OFILE   (ALIGN_MAX_HARD << 1)
>> -- 
>> 2.30.2
>>
  

Patch

diff --git a/gcc/testsuite/gcc.dg/attr-aligned.c b/gcc/testsuite/gcc.dg/attr-aligned.c
index 887bdd0f3799..4f0c885dc812 100644
--- a/gcc/testsuite/gcc.dg/attr-aligned.c
+++ b/gcc/testsuite/gcc.dg/attr-aligned.c
@@ -18,6 +18,10 @@ 
 # else
 #   define ALIGN_MAX_STATIC      ALIGN_MAX_HARD
 # endif
+#elif __CRIS__
+/* __BIGGEST_ALIGNMENT__ doesn't cover functions (16 bits for CRIS). */
+#  define ALIGN_MAX_STATIC      512
+#  define ALIGN_TOO_BIG_OFILE   (ALIGN_MAX_HARD << 1)
 #elif pdp11
 #  define ALIGN_MAX_STATIC      2
 /* Work around a pdp11 ICE (see PR target/87821).  */
@@ -29,7 +33,9 @@ 
 /* Is this processor- or operating-system specific?  */
 #  define ALIGN_MAX_STATIC      ALIGN_MAX_HARD
 #else
-   /* Guaranteed to be accepted regardless of the target.  */
+   /* Guaranteed to be accepted regardless of the target for objects.
+      This might not be true for alignment of functions though, so
+      may need to be set to a target-specific value above.  */
 #  define ALIGN_MAX_STATIC      __BIGGEST_ALIGNMENT__
    /* Guaranteed to be rejected regardless of the target.  */
 #  define ALIGN_TOO_BIG_OFILE   (ALIGN_MAX_HARD << 1)