https://gcc.gnu.org/g:f80829a9f98c99e751bc2b80cffbe599a117f430

commit r16-5952-gf80829a9f98c99e751bc2b80cffbe599a117f430
Author: H.J. Lu <[email protected]>
Date:   Mon Dec 8 13:29:59 2025 +0800

    x86: Don't allow 2 volatile memory references
    
    Don't allow 2 volatile memory references in *<avx512>_cmp<mode>3_dup_op
    so that gcc.target/i386/avx2-vpcmpeqq-1.c will generate 2 loads when
    -march=cascadelake is used.
    
            PR target/122343
            * config/i386/sse.md (*<avx512>_cmp<mode>3_dup_op): Don't allow
            2 volatile memory references.
    
    Signed-off-by: H.J. Lu <[email protected]>

Diff:
---
 gcc/config/i386/sse.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 0be898c789ed..fb79b2e67df3 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -4900,7 +4900,8 @@
           (match_operand:SI 3 "<cmp_imm_predicate>")]
          UNSPEC_PCMP_ITER))]
   "TARGET_AVX512F && ix86_pre_reload_split ()
-   && rtx_equal_p (operands[1], operands[2])"
+   && rtx_equal_p (operands[1], operands[2])
+   && (!MEM_P (operands[1]) || !MEM_VOLATILE_P (operands[1]))"
   "#"
   "&& 1"
   [(set (match_dup 0) (match_dup 4))]

Reply via email to