https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127498
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Full untested patch: 2026-09-19 Jakub Jelinek <[email protected]> PR target/127498 * config/i386/sse.md (<insn><mode>3 any_rotate:VI1_AVX512_3264): Add TARGET_AVX2 to condition. * gcc.target/i386/gfni-pr127498.c: New test. --- a/gcc/config/i386/sse.md 2026-09-15 12:01:51.693090054 +0200 +++ b/gcc/config/i386/sse.md 2026-09-19 09:52:47.935239962 +0200 @@ -28458,7 +28458,7 @@ (define_expand "<insn><mode>3" (any_rotate:VI1_AVX512_3264 (match_operand:VI1_AVX512_3264 1 "register_operand") (match_operand:SI 2 "const_int_operand")))] - "TARGET_GFNI" + "TARGET_GFNI && TARGET_AVX2" { rtx matrix = ix86_vgf2p8affine_shift_matrix (operands[0], operands[2], <CODE>); emit_insn (gen_vgf2p8affineqb_<mode> (operands[0], operands[1], matrix, --- a/gcc/testsuite/gcc.target/i386/gfni-pr127498.c 2026-09-19 09:49:43.267818583 +0200 +++ b/gcc/testsuite/gcc.target/i386/gfni-pr127498.c 2026-09-19 09:45:51.120060191 +0200 @@ -0,0 +1,17 @@ +/* PR target/127498 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mgfni -mavx -mno-avx2" } */ + +typedef unsigned char V __attribute__ ((vector_size (32))); + +V +foo (V x, int n) +{ + return (x >> n) | (x << (8 - n)); +} + +V +bar (V x, int n) +{ + return (x << n) | (x >> (8 - n)); +}
