The gcc.dg/asm-hard-reg-1.c test FAILs on i386-pc-solaris2.11 and
i686-pc-linux-gnu with -m64:

FAIL: gcc.dg/asm-hard-reg-1.c scan-assembler-times foo\\t%ecx 4

It turns out the target selectors of the x86 scans are badly confused:

* Using an i?86-*-* target selector is always wrong given the existance
  of biarch i?86-*-* targets.  They should use the x86 effective target
  with ilp32 instead.

* dg directives don't heed the preprocessor, so scans were duplicated
  for i?86-*-* and x86-*-*, sometimes with different target selectors.

This patch simplifies and fixes the target selectors, removing
duplication.

Tested on i386-pc-solaris2.11 with -m32/-m64 and x86_64-pc-linux-gnu
with -m64/-m32/-mx32, and i686-pc-linux-gnu with -m32/-m64.

Committed to trunk.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2026-02-16  Rainer Orth  <[email protected]>

        gcc/testsuite:
        * gcc.dg/asm-hard-reg-1.c: Simplify x86 target selectors.  Remove
        duplicates.

# HG changeset patch
# Parent  ae6028af1202323bd3290119c646073f326ac8d1
testsuite: Fix gcc.dg/asm-hard-reg-1.c on x86

diff --git a/gcc/testsuite/gcc.dg/asm-hard-reg-1.c b/gcc/testsuite/gcc.dg/asm-hard-reg-1.c
--- a/gcc/testsuite/gcc.dg/asm-hard-reg-1.c
+++ b/gcc/testsuite/gcc.dg/asm-hard-reg-1.c
@@ -8,9 +8,13 @@
 /* { dg-final { scan-assembler-times "foo\tr4" 8 { target { arm*-*-* } } } } */
 #elif defined (__i386__)
 # define GPR "{ecx}"
-/* { dg-final { scan-assembler-times "foo\t%cl" 2 { target { i?86-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%cx" 2 { target { i?86-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%ecx" 4 { target { i?86-*-* } } } } */
+#elif defined (__x86_64__)
+# define GPR "{rcx}"
+/* { dg-final { scan-assembler-times "foo\t%cl" 2 { target x86 } } } */
+/* { dg-final { scan-assembler-times "foo\t%cx" 2 { target x86 } } } */
+/* { dg-final { scan-assembler-times "foo\t%ecx" 4 { target { x86 && ilp32 } } } } */
+/* { dg-final { scan-assembler-times "foo\t%ecx" 2 { target { x86 && lp64 } } } } */
+/* { dg-final { scan-assembler-times "foo\t%rcx" 2 { target { x86 && lp64 } } } } */
 #elif defined (__powerpc__) || defined (__POWERPC__)
 # define GPR "{r5}"
 /* { dg-final { scan-assembler-times "foo\t5" 8 { target { powerpc*-*-* } } } } */
@@ -20,13 +24,6 @@
 #elif defined (__s390__)
 # define GPR "{r4}"
 /* { dg-final { scan-assembler-times "foo\t%r4" 8 { target { s390*-*-* } } } } */
-#elif defined (__x86_64__)
-# define GPR "{rcx}"
-/* { dg-final { scan-assembler-times "foo\t%cl" 2 { target { i?86-*-* x86_64-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%cx" 2 { target { i?86-*-* x86_64-*-* } } } } */
-/* { dg-final { scan-assembler-times "foo\t%ecx" 2 { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */
-/* { dg-final { scan-assembler-times "foo\t%rcx" 2 { target { { i?86-*-* x86_64-*-* } && lp64 } } } } */
-/* { dg-final { scan-assembler-times "foo\t%ecx" 4 { target { { i?86-*-* x86_64-*-* } && { ! lp64 } } } } } */
 #endif
 
 char

Reply via email to