diff mbox series

libgomp.c-c++-common/pr109062.c: Fix expected spin count for hybrid x86

Message ID 02ee29b7-f1a7-43a4-87cb-8733555ea684@baylibre.com
State New
Headers show
Series libgomp.c-c++-common/pr109062.c: Fix expected spin count for hybrid x86 | expand

Commit Message

Tobias Burnus Nov. 11, 2024, 2:02 p.m. UTC
I intent to commit the attached patch later today as obvious.

It is an older issue I never properly investigated before
but finally want to fix it.

The issue is that on systems (like my laptop) that have
Intel's E and P cores (hybrid x86); testing by Intel has
shown that spincount=1 is actually faster, presumably
because work can then migrate from E to P cores instead
of having P cores blocked by spin-count waits.

Tobias

PS: For the original issue (i.e. setting it to 1),
see https://gcc.gnu.org/PR109812 and
https://inbox.sourceware.org/gcc-patches/DM4PR11MB609367F5B9DBD0F6A6B6FC53EACCA@DM4PR11MB6093.namprd11.prod.outlook.com/T/
diff mbox series

Patch

libgomp.c-c++-common/pr109062.c: Fix expected spin count for hybrid x86

On my system with E and P cores (hybrid) x86, the spincount is by default 1
and not 300000, cf. PR109812 and r14-4571-ge1e127de18dbee.

Hence, this commit updates the expected value of the testcase to also
accept omp_display_env showing "GOMP_SPINCOUNT = '1'".

libgomp/ChangeLog:

	* testsuite/libgomp.c-c++-common/pr109062.c:

diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr109062.c b/libgomp/testsuite/libgomp.c-c++-common/pr109062.c
index 5c7c287dafd..cb05c333e0e 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/pr109062.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/pr109062.c
@@ -11,4 +11,8 @@  main ()
   return 0;
 }
 
-/* { dg-output ".*\\\[host] GOMP_SPINCOUNT = '300000'.*" { target native } } */
+/* On hybrid x86-64, i.e. with P and E cores, the default is GOMP_SPINCOUNT=1;
+   hence, handle either value; see PR109812. */
+/* { dg-output ".*\\\[host] GOMP_SPINCOUNT = '(?:300000|1)'.*" { target { native && { x86_64-*-* i?86-*-* } } } } */
+
+/* { dg-output ".*\\\[host] GOMP_SPINCOUNT = '300000'.*" { target { native && { ! { x86_64-*-* i?86-*-* } } } } } */