]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: Retry tbegin. instructions that can fail intermittently
authorPeter Bergner <bergner@linux.ibm.com>
Tue, 15 Feb 2022 22:51:32 +0000 (16:51 -0600)
committerPeter Bergner <bergner@linux.ibm.com>
Tue, 15 Feb 2022 22:53:07 +0000 (16:53 -0600)
The HTM tbegin. instruction can fail intermittently due to many reasons.
This can lead to htm-1.c FAILing from time to time.  The solution is to
allow retrying the instruction a few times before aborting.

2022-02-15  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
* gcc.target/powerpc/htm-1.c: Retry intermittent failing tbegins.

gcc/testsuite/gcc.target/powerpc/htm-1.c

index f27e32ca281a074c1c0080840c970a0353a2952e..399a7ec881238eb99b2ef32fe46e3b039343306a 100644 (file)
@@ -12,14 +12,21 @@ main (void)
 {
   long i;
   unsigned long mask = 0;
+  unsigned long retry_count = 0;
 
 repeat:
   if (__builtin_tbegin (0))
     {
       mask++;
+      retry_count = 0;
     }
   else
-    abort();
+    {
+      /* Retry a limited number of times before aborting.  */
+      if (retry_count++ < 10)
+       goto repeat;
+      abort ();
+    }
 
   if (mask == 1)
     {