> From: Dipesh Sharma <[email protected]>
> Sent: Monday, October 26, 2026 11:46 PM
> 
> This patch moves shared AVX10.2 convert intrinsics to AVX10V1AUX.

LGTM with minor comment.

> diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-
> builtin.def
> index e2b7714d4c3e..c2a7aeb417c8 100644
> --- a/gcc/config/i386/i386-builtin.def
> +++ b/gcc/config/i386/i386-builtin.def
> @@ -3054,90 +3054,90 @@ BDESC (OPTION_MASK_ISA_AVX512VL,
> OPTION_MASK_ISA2_AVX512FP16, CODE_FOR_avx512vl_
>  BDESC (OPTION_MASK_ISA_AVX512VL, OPTION_MASK_ISA2_AVX512FP16,
> CODE_FOR_avx512vl_fmulc_v16hf_mask,
> "__builtin_ia32_vfmulcph256_mask", IX86_BUILTIN_VFMULCPH256_MASK,
> UNKNOWN, (int) V16HF_FTYPE_V16HF_V16HF_V16HF_UQI)
> 
>  /* AVX10.2.  */
> -BDESC (0, OPTION_MASK_ISA2_AVX10_2, CODE_FOR_vpdpbssd_v16si,
> "__builtin_ia32_vpdpbssd512", IX86_BUILTIN_VPDPBSSDV16SI, UNKNOWN,
> (int) V16SI_FTYPE_V16SI_V16SI_V16SI)

You should not touch these vnni builtins in this patch.

> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> index d5b90291fc9c..1fff2f0a277c 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -613,7 +613,8 @@
> 
> avx512bw,noavx512bw,avx512dq,noavx512dq,fma_or_avx512vl,
> 
> avx512vl,noavx512vl,avxvnni,avxvnniint8,avx512vnnivl,avx512fp16,avxifma,
>                   avx512ifmavl,avxneconvert,avx512bf16vl,vpclmulqdqvl,
> -
> avx_noavx512f,avx_noavx512vl,vaes_avx512vl,noapx_nf,avx10_2"
> +
> avx_noavx512f,avx_noavx512vl,vaes_avx512vl,noapx_nf,avx10_2,
> +                 avx10v1aux"
>    (const_string "base"))
> 
>  ;; The (bounding maximum) length of an instruction immediate.
> @@ -1015,6 +1016,7 @@
>        (eq_attr "isa" "vaes_avx512vl")
>          (symbol_ref "TARGET_VAES && TARGET_AVX512VL")
>        (eq_attr "isa" "avx10_2") (symbol_ref "TARGET_AVX10_2")
> +      (eq_attr "isa" "avx10v1aux") (symbol_ref "TARGET_AVX10V1AUX")
> 

I don't see the usage for them in this patch. And ...

>        (eq_attr "mmx_isa" "native")
>          (symbol_ref "!TARGET_MMX_WITH_SSE")
> diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
> index c1e8b2562958..0f2ab6205e15 100644
> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -717,6 +717,9 @@
>  (define_mode_iterator VI4_AVX10_2
>    [(V16SI "TARGET_AVX10_2") V8SI V4SI])
> 
> +(define_mode_iterator VI4_AVX10_V1_AUX
> +  [(V16SI "TARGET_AVX10V1AUX") V8SI V4SI])

... also for this.

The naming convention is not consistent here, AVX10V1AUX is
better.

> @@ -33545,25 +33548,25 @@
>                        (const_int 6) (const_int 7)]))
>           (match_operand:QI 4 "register_operand" "Yk"))
>         (match_operand:V8QI 5 "const0_operand")))]
> -  "TARGET_AVX10_2"
> +  "TARGET_AVX10V1AUX"
> 
> "vcvt<biasph2fp8_pack>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %
> 2}"
>    [(set_attr "prefix" "evex")])
> 
> -(define_mode_iterator VHF_AVX10_2_2
> +(define_mode_iterator VHF_AVX10V1AUX
>    [V32HF V16HF])
> 

It seems to me that this iterator could combine with ...

>  (define_insn "vcvt<biasph2fp8_pack><mode><mask_name>"
>    [(set (match_operand:<ssebvecmode_2> 0 "register_operand" "=v")
>       (unspec:<ssebvecmode_2>
>         [(match_operand:<ssebvecmode> 1 "register_operand" "v")
> -        (match_operand:VHF_AVX10_2_2 2 "nonimmediate_operand"
> "vm")]
> +        (match_operand:VHF_AVX10V1AUX 2 "nonimmediate_operand"
> "vm")]
>         UNSPEC_VCVTBIASPH2FP8_PACK))]
> -  "TARGET_AVX10_2"
> +  "TARGET_AVX10V1AUX"
> 
> "vcvt<biasph2fp8_pack>\t{%2, %1, %0<mask_operand3>|%0<mask_operan
> d3>, %1, %2}"
>    [(set_attr "prefix" "evex")])
> 
>  (define_mode_iterator VHF_256_512
> -  [V16HF (V32HF "TARGET_AVX10_2")])
> +  [V16HF (V32HF "TARGET_AVX10V1AUX")])
> 

... this and using VHF_256_512 name. It is probably left behind redundant
when re-unifying 256/512 path.

> 
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-
> supports.exp
> index ae04b6a8daa1..3520ce6c16a7 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -11767,6 +11767,17 @@ proc check_effective_target_avx10v2aux { } {
>      } "-mavx10v2aux" ]
>  }
> 
> +# Return 1 if avx10v1aux instructions can be compiled.
> +proc check_effective_target_avx10v1aux { } {
> +    return [check_no_compiler_messages avx10v1aux object {
> +     void
> +     foo ()
> +     {
> +       __asm__ volatile
> ("vcvt2ph2bf8\t{%%zmm2, %%zmm1 %%zmm1|%%zmm1, %%zmm1 %%z
> mm2}");

The inline asm seems wrong to me. And if you are not adding runtime tests,
they are not needed.

Thx,
Haochen

Reply via email to