s390: fix htm-builtins test cases

Message ID 20231025145033.33702-1-jchrist@linux.ibm.com
State Accepted
Headers
Series s390: fix htm-builtins test cases |

Checks

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

Commit Message

Juergen Christ Oct. 25, 2023, 2:50 p.m. UTC
  Transactional and non-transactional stores to the same cache line cause
transactions to abort on newer generations.  Add sufficient padding to make
sure another cache line is used.

Tested on s390.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/htm-builtins-1.c: Fix.
	* gcc.target/s390/htm-builtins-2.c: Fix.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
---
 gcc/testsuite/gcc.target/s390/htm-builtins-1.c | 4 +++-
 gcc/testsuite/gcc.target/s390/htm-builtins-2.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

Andreas Krebbel Oct. 25, 2023, 3:03 p.m. UTC | #1
On 10/25/23 16:50, Juergen Christ wrote:
> Transactional and non-transactional stores to the same cache line cause
> transactions to abort on newer generations.  Add sufficient padding to make
> sure another cache line is used.
> 
> Tested on s390.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/s390/htm-builtins-1.c: Fix.
> 	* gcc.target/s390/htm-builtins-2.c: Fix.

Ok. Thanks!

Andreas

> 
> Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
> ---
>  gcc/testsuite/gcc.target/s390/htm-builtins-1.c | 4 +++-
>  gcc/testsuite/gcc.target/s390/htm-builtins-2.c | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-1.c b/gcc/testsuite/gcc.target/s390/htm-builtins-1.c
> index ff43be9fe736..4f95bf3accaa 100644
> --- a/gcc/testsuite/gcc.target/s390/htm-builtins-1.c
> +++ b/gcc/testsuite/gcc.target/s390/htm-builtins-1.c
> @@ -53,9 +53,11 @@ __attribute__ ((aligned(256))) struct
>  __attribute__ ((aligned(256))) struct
>  {
>    volatile uint64_t c1;
> +  char pad1[256 - sizeof(uint64_t)];
>    volatile uint64_t c2;
> +  char pad2[256 - sizeof(uint64_t)];
>    volatile uint64_t c3;
> -} counters = { 0, 0, 0 };
> +} counters = { 0 };
>  
>  /* ---------------------------- local helper functions --------------------- */
>  
> diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-2.c b/gcc/testsuite/gcc.target/s390/htm-builtins-2.c
> index bb9d346ea560..2e838caacc8c 100644
> --- a/gcc/testsuite/gcc.target/s390/htm-builtins-2.c
> +++ b/gcc/testsuite/gcc.target/s390/htm-builtins-2.c
> @@ -94,9 +94,11 @@ float global_float_3 = 0.0;
>  __attribute__ ((aligned(256))) struct
>  {
>    volatile uint64_t c1;
> +  char pad1[256 - sizeof(uint64_t)];
>    volatile uint64_t c2;
> +  char pad2[256 - sizeof(uint64_t)];
>    volatile uint64_t c3;
> -} counters = { 0, 0, 0 };
> +} counters = { 0 };
>  
>  /* ---------------------------- local helper functions --------------------- */
>
  

Patch

diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-1.c b/gcc/testsuite/gcc.target/s390/htm-builtins-1.c
index ff43be9fe736..4f95bf3accaa 100644
--- a/gcc/testsuite/gcc.target/s390/htm-builtins-1.c
+++ b/gcc/testsuite/gcc.target/s390/htm-builtins-1.c
@@ -53,9 +53,11 @@  __attribute__ ((aligned(256))) struct
 __attribute__ ((aligned(256))) struct
 {
   volatile uint64_t c1;
+  char pad1[256 - sizeof(uint64_t)];
   volatile uint64_t c2;
+  char pad2[256 - sizeof(uint64_t)];
   volatile uint64_t c3;
-} counters = { 0, 0, 0 };
+} counters = { 0 };
 
 /* ---------------------------- local helper functions --------------------- */
 
diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-2.c b/gcc/testsuite/gcc.target/s390/htm-builtins-2.c
index bb9d346ea560..2e838caacc8c 100644
--- a/gcc/testsuite/gcc.target/s390/htm-builtins-2.c
+++ b/gcc/testsuite/gcc.target/s390/htm-builtins-2.c
@@ -94,9 +94,11 @@  float global_float_3 = 0.0;
 __attribute__ ((aligned(256))) struct
 {
   volatile uint64_t c1;
+  char pad1[256 - sizeof(uint64_t)];
   volatile uint64_t c2;
+  char pad2[256 - sizeof(uint64_t)];
   volatile uint64_t c3;
-} counters = { 0, 0, 0 };
+} counters = { 0 };
 
 /* ---------------------------- local helper functions --------------------- */