On Mon, Dec 8, 2025 at 2:51 PM Hongtao Liu <[email protected]> wrote:
>
> On Mon, Dec 8, 2025 at 1:42 PM H.J. Lu <[email protected]> wrote:
> >
> > When -march=cascadelake is added, we generate
> >
> > vmovdqa x(%rip), %ymm0
> > vpcmpq $1, x(%rip), %ymm0, %k0
> > vpmovm2q %k0, %ymm0
> > vmovdqa %ymm0, x(%rip)
> >
> > instead of
> >
> > vmovdqa x(%rip), %ymm1
> > vmovdqa x(%rip), %ymm0
> > vpcmpgtq %ymm1, %ymm0, %ymm0
> > vmovdqa %ymm0, x(%rip)
> >
> > Compile avx2-vpcmpgtq-1.c with -fno-fuse-ops-with-volatile-access to
> > generate vpcmpgtq instead of vpcmpq.
> >
> > PR target/122343
> > * gcc.target/i386/avx2-vpcmpgtq-1.c: Compile with
> > -fno-fuse-ops-with-volatile-access.
>
> I didn't see the patch, but I think it should be an obvious patch.
> >

Oops.  Here is the patch I am checking in.

-- 
H.J.
From ba431b7fbcaaad2b528df14510f5c04fdb5ba56f Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <[email protected]>
Date: Mon, 8 Dec 2025 13:32:55 +0800
Subject: [PATCH] x86: Compile avx2-vpcmpgtq-1.c with
 -fno-fuse-ops-with-volatile-access

When -march=cascadelake is added, we generate

	vmovdqa	x(%rip), %ymm0
	vpcmpq	$1, x(%rip), %ymm0, %k0
	vpmovm2q	%k0, %ymm0
	vmovdqa	%ymm0, x(%rip)

instead of

	vmovdqa	x(%rip), %ymm1
	vmovdqa	x(%rip), %ymm0
	vpcmpgtq	%ymm1, %ymm0, %ymm0
	vmovdqa	%ymm0, x(%rip)

Compile avx2-vpcmpgtq-1.c with -fno-fuse-ops-with-volatile-access to
generate vpcmpgtq instead of vpcmpq.

	PR target/122343
	* gcc.target/i386/avx2-vpcmpgtq-1.c: Compile with
	-fno-fuse-ops-with-volatile-access.

Signed-off-by: H.J. Lu <[email protected]>
---
 gcc/testsuite/gcc.target/i386/avx2-vpcmpgtq-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/i386/avx2-vpcmpgtq-1.c b/gcc/testsuite/gcc.target/i386/avx2-vpcmpgtq-1.c
index 7a983808b10..5e6f4310517 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-vpcmpgtq-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-vpcmpgtq-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-mavx2 -O2" } */
+/* { dg-options "-mavx2 -O2 -fno-fuse-ops-with-volatile-access" } */
 /* { dg-final { scan-assembler "vpcmpgtq\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
 
 #include <immintrin.h>
-- 
2.52.0

Reply via email to