From 314d20bbefd098ff75b366b870ac8e33ad7711ca Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Thu, 23 Jan 2025 11:28:15 +0100
Subject: [PATCH] testsuite: i386: Adjust gcc.target/i386/cmov12.c for Sun as
 syntax

The new gcc.target/i386/cmov12.c test FAILs on Solaris/x86 with the
native as:

FAIL: gcc.target/i386/cmov12.c scan-assembler-times cmovg 3

This happens because as uses a different syntax for cmov:

--- cmov12.s.bu243	2025-01-21 16:55:27.038829605 +0100
+++ cmov12.s.bu24390	2025-01-21 16:55:44.565051230 +0100
@@ -41,9 +41,9 @@
 	leal	1(%rdx), %ebp
 	movl	(%r11), %esi
 	cmpl	%eax, %esi
-	cmovg	%ebp, %edx
-	cmovg	%r11, %rcx
-	cmovg	%esi, %eax
+	cmovl.g	%ebp, %edx
+	cmovq.g	%r11, %rcx
+	cmovl.g	%esi, %eax

The problem is even more prominent with the upcoming gas 2.44 which
added support for the Sun as syntax on Solaris, which gcc/configure
picks up.

This patch allows for both forms.

Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.

2025-01-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/testsuite:
	* gcc.target/i386/cmov12.c (scan-assembler-times): Allow for
	cmovl.g etc.
---
 gcc/testsuite/gcc.target/i386/cmov12.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/i386/cmov12.c b/gcc/testsuite/gcc.target/i386/cmov12.c
index 87de4f4117b8..3d8c358e7031 100644
--- a/gcc/testsuite/gcc.target/i386/cmov12.c
+++ b/gcc/testsuite/gcc.target/i386/cmov12.c
@@ -1,6 +1,6 @@
 /* { dg-do compile { target { ! ia32 } } } */
 /* { dg-options "-O2 -mavx2 -mtune=sapphirerapids" } */                             
-/* { dg-final { scan-assembler-times "cmovg" 3 } } */
+/* { dg-final { scan-assembler-times "cmov(\[lq\]\.)?g" 3 } } */
 
 void foo(int *a, int n, int k)
 {
-- 
GitLab