[gcc r16-9072] i386: Support HYGON c86-4g series processors

Kewen Lin linkw@gcc.gnu.org
Tue Jun 9 05:44:17 GMT 2026


https://gcc.gnu.org/g:4ed5f9ebd31afa9708ea7d936c245d8b9a750fd7

commit r16-9072-g4ed5f9ebd31afa9708ea7d936c245d8b9a750fd7
Author: Xin Liu <liulxx@hygon.cn>
Date:   Tue Jun 9 03:32:22 2026 +0000

    i386: Support HYGON c86-4g series processors
    
    This patch enables new x86 CPU vendor HYGON ID detection
    and adds c86-4g series c86-4g-m{4,6,7} processor supports.
    Without such support, if users use -march=native option on
    HYGON machines, they can get some old arch like core2, it
    would be suboptimal.  It also enables -m{arch,tune}=c86-4g
    -m{4,6,7} supports.  Based on the hardware characteristics,
    appropriate cost models and tuning parameters are provided.
    
    New machine description files are introduced: c86-4g.md is
    used to describe the pipeline for c86-4g-m4 and c86-4g-m6,
    while c86-4g-m7.md describes the pipeline for c86-4g-m7.
    To better model some pipeline information, it introduces
    new attrs c86_attr and c86_decode by following existing
    practice.
    
    Bootstrapped and regtested on hygon c86-4g-m4 and c86-4g-m7
    machine, as well as a cfarm x86-64 machine.
    
    Co-authored-by: Zhaoling Bao <baozhaoling@hygon.cn>
    Signed-off-by: Xin Liu <liulxx@hygon.cn>
    Signed-off-by: Zhaoling Bao <baozhaoling@hygon.cn>
    
    gcc/ChangeLog:
    
            * common/config/i386/cpuinfo.h (get_hygon_cpu): Detect the specific
            type of HYGON CPU and return HYGON CPU name.
            (cpu_indicator_init): Handle HYGON CPU.
            * common/config/i386/i386-common.cc (processor_names): Add HYGON
            C86-4G processors c86-4g-m{4,6,7}.
            (processor_alias_table): Add hygon, hygonfam18h and c86-4g-m{4,6,7}
            entries.
            (ARRAY_SIZE): Update as new entries added.
            * common/config/i386/i386-cpuinfo.h (enum processor_vendor): Add
            VENDOR_HYGON.
            (enum processor_types): Add HYGONFAM18H.
            (enum processor_subtypes): Add HYGONFAM18H_C86_4G_M{4,6,7}.
            * config.gcc: Add support for c86_4g_m{4,6,7}.
            * config/i386/cpuid.h (signature_HYGON_ebx):  Add signature for HYGON.
            (signature_HYGON_ecx): Ditto.
            (signature_HYGON_edx): Ditto.
            * config/i386/driver-i386.cc (host_detect_local_cpu): Support HYGON
            c86-4g-m4{4,6,7} processors.
            * config/i386/i386-c.cc (ix86_target_macros_internal): Ditto.
            * config/i386/i386-options.cc (m_C86_4G_M4): New definition.
            (m_C86_4G_M6): Ditto.
            (m_C86_4G_M7): Ditto.
            (m_C86_4G): Ditto.
            (processor_cost_table): Add cost entries for c86-4g-m4{4,6,7}.
            * config/i386/i386.cc (ix86_reassociation_width): Add handlings for
            PROCESSOR_C86_4G_M{4,6,7}.
            * config/i386/i386.h (enum processor_type): Define
            PROCESSOR_C86_4G_M{4,6,7}.
            (PTA_C86_4G_M4): New define.
            (PTA_C86_4G_M6): Ditto.
            (PTA_C86_4G_M7): Ditto.
            * config/i386/x86-tune-costs.h (c86_4g_m4_memcpy): New stringop_algs.
            (c86_4g_m4_cost): New processor_costs.
            (c86_4g_m6_cost): Ditto.
            (c86_4g_m7_cost): Ditto.
            * config/i386/x86-tune-sched.cc (ix86_issue_rate): Handle
            PROCESSOR_C86_4G_M{4,6,7}.
            (ix86_adjust_cost): Ditto.
            * config/i386/x86-tune.def (X86_TUNE_SCHEDULE): Handle m_C86_4G.
            (X86_TUNE_PARTIAL_REG_DEPENDENCY): Ditto.
            (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY): Ditto.
            (X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY): Ditto.
            (X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY): Ditto.
            (X86_TUNE_MEMORY_MISMATCH_STALL): Ditto.
            (X86_TUNE_FUSE_CMP_AND_BRANCH_32): Ditto.
            (X86_TUNE_FUSE_CMP_AND_BRANCH_64): Ditto.
            (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS): Ditto.
            (X86_TUNE_USE_LEAVE): Ditto.
            (X86_TUNE_PUSH_MEMORY): Ditto.
            (X86_TUNE_INTEGER_DFMODE_MOVES): Ditto.
            (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES): Ditto.
            (X86_TUNE_USE_SAHF): Ditto.
            (X86_TUNE_USE_BT): Ditto.
            (X86_TUNE_AVOID_MFENCE): Ditto.
            (X86_TUNE_USE_FFREEP): Ditto.
            (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL): Ditto.
            (X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL): Ditto.
            (X86_TUNE_SSE_TYPELESS_STORES): Ditto.
            (X86_TUNE_SSE_LOAD0_BY_PXOR): Ditto.
            (X86_TUNE_USE_GATHER_2PARTS): Ditto.
            (X86_TUNE_USE_GATHER_4PARTS): Ditto.
            (X86_TUNE_USE_GATHER_8PARTS): Ditto.
            (X86_TUNE_AVOID_128FMA_CHAINS): Ditto.
            (X86_TUNE_AVOID_256FMA_CHAINS): Ditto.
            (X86_TUNE_USE_RCR): Ditto.
            (X86_TUNE_AVX256_MOVE_BY_PIECES): Handle m_C86_4G_M{4,6}.
            (X86_TUNE_USE_SCATTER_2PARTS): Handle m_C86_4G_M7.
            (X86_TUNE_USE_SCATTER_4PARTS): Ditto.
            (X86_TUNE_USE_SCATTER_8PARTS): Ditto.
            (X86_TUNE_SSE_REDUCTION_PREFER_PSHUF): Ditto.
            (X86_TUNE_AVX512_SPLIT_REGS): Ditto.
            (X86_TUNE_AVX512_MOVE_BY_PIECES): Ditto.
            (X86_TUNE_AVX512_MASKED_EPILOGUES): Ditto.
            * doc/extend.texi: Document about hygonfam18h and c86-4g-m{4,6,7}.
            * doc/invoke.texi: Document about c86-4g-m{4,6,7}.
            * config/i386/c86-4g-m7.md: New file for c86-4g-m7 scheduling model
            information.
            * config/i386/c86-4g.md: New file for c86-4g-m{4,6} scheduling model
            information.
            * config/i386/i386.md (cpu attr): Add c86_4g_m{4,6,7}.
            (c86-4g.md): New include.
            (c86-4g-m7.md): Ditto.
            (*cmpi<unord>xf_i387): Set attr c86_decode.
            (*cmpi<unord><MODEF:mode>): Ditto.
            (swap<mode>): Ditto.
            (*swap<mode>): Ditto.
            (extendhisi2): Ditto.
            (floathi<mode>2): Ditto.
            (float<SWI48x:mode>xf2): Ditto.
            (*float<SWI48:mode><MODEF:mode>2): Ditto.
            (*floatdi<MODEF:mode>2_i387): Ditto.
            (*anddi_1_bt): Ditto.
            (*iordi_1_bts): Ditto.
            (*xordi_1_btc): Ditto.
            (*<btsc><mode>): Ditto.
            (*btr<mode>): Ditto.
            (*btsq_imm): Ditto.
            (*btrq_imm): Ditto.
            (*btcq_imm): Ditto.
            (*tzcnt<mode>_1): Ditto.
            (*tzcnt<mode>_1_falsedep): Ditto.
            (*bsf<mode>_1): Ditto.
            (*ctz<mode>2_falsedep): Ditto.
            (*ctzsi2_zext): Ditto.
            (*ctzsi2_zext_falsedep): Ditto.
            (bsr_rex64): Ditto.
            (bsr_rex64_1): Ditto.
            (bsr_rex64_1_zext): Ditto.
            (bsr): Ditto.
            (bsr_1): Ditto.
            (bsr_zext_1): Ditto.
            (*bswaphi2_movbe): Ditto.
            (*bswaphi2): Ditto.
            (bswaphisi2_lowpart): Ditto.
            (fpremxf4_i387): Ditto.
            (fprem1xf4_i387): Ditto.
            (<sincos>xf2): Ditto.
            (sincosxf3): Ditto.
            (fptanxf4_i387): Ditto.
            (atan2xf3): Ditto.
            (fyl2xxf3_i387): Ditto.
            (fyl2xp1xf3_i387): Ditto.
            (fxtractxf3_i387): Ditto.
            (*f2xm1xf2_i387): Ditto.
            (fscalexf4_i387): Ditto.
            (rintxf2): Ditto.
            (*movxi_internal_avx512f): Set attr c86_attr.
            (*movoi_internal_avx): Ditto.
            (*movti_internal): Ditto.
            (*movdi_internal): Ditto.
            (*movsi_internal): Ditto.
            (*movhi_internal): Ditto.
            (*movtf_internal): Ditto.
            (*movdf_internal): Ditto.
            (*movsf_internal): Ditto.
            (*zero_extendsidi2): Ditto.
            (sqrtxf2): Ditto.
            (<smaxmin:code><mode>3): Ditto.
            (*ieee_s<ieee_maxmin><mode>3): Ditto.
            * config/i386/mmx.md (*mmx_maskmovq): Set attr c86_decode.
            (*mmx_maskmovq): Ditto.
            (sse_movntq): Set attr c86_attr.
            (*mmx_blendps): Ditto.
            (mmx_blendvps): Ditto.
            (*mmx_pmaddwd): Ditto.
            (mmx_pblendvb_v8qi): Ditto.
            (mmx_pblendvb_<mode>): Ditto.
            (sse4_1_<code>v4qiv4hi2): Ditto.
            (sse4_1_<code>v2hiv2si2): Ditto.
            (sse4_1_<code>v2qiv2si2): Ditto.
            (sse4_1_<code>v2qiv2hi2): Ditto.
            (*mmx_pinsrd): Ditto.
            (*mmx_pinsrw): Ditto.
            (*mmx_pinsrb): Ditto.
            (*mmx_pextrw): Ditto.
            (*mmx_pextrw<mode>): Ditto.
            (*mmx_pextrw_zext): Ditto.
            (*mmx_pextrb): Ditto.
            (*mmx_pextrb_zext): Ditto.
            (*mmx_pblendw64): Ditto.
            (*mmx_pblendw32): Ditto.
            (*vec_extractv2si_1): Ditto.
            (*vec_extractv2si_1_zext): Ditto.
            (*pinsrw): Ditto.
            (*pinsrb): Ditto.
            (*pextrw): Ditto.
            (*pextrw<mode>): Ditto.
            (*pextrw_zext): Ditto.
            (*pextrb): Ditto.
            (*pextrb_zext): Ditto.
            (*mmx_psadbw): Ditto.
            * config/i386/sse.md (ktest<mode>): Set attr c86_decode.
            (*kortest<mode>): Ditto.
            (sse_cvtsi2ss<rex64namesuffix><round_name>): Ditto.
            (sse2_cvtsi2sd): Ditto.
            (sse2_maskmovdqu): Ditto.
            (*<sse>_dp<ssemodesuffix><avxsizesuffix>): Ditto.
            (*<sse4_1_avx2>_mpsadbw): Ditto.
            (pclmulqdq): Ditto.
            (<mask_codefor>conflict<mode><mask_name>): Ditto.
            (<avx512>_blendm<mode>): Set attr c86_attr.
            (sse2_movnti<mode>): Ditto.
            (<sse>_movnt<mode>): Ditto.
            (<sse2>_movnt<mode>): Ditto.
            (<sse>_rcp<mode>2): Ditto.
            (sse_vmrcpv4sf2): Ditto.
            (<mask_codefor>rcp14<mode><mask_name>): Ditto.
            (srcp14<mode>): Ditto.
            (srcp14<mode>_mask): Ditto.
            (<sse>_sqrt<mode>2<mask_name><round_name>): Ditto.
            (<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>): Ditto.
            (*<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>): Ditto.
            (<mask_codefor>rsqrt14<mode><mask_name>): Ditto.
            (rsqrt14<mode>): Ditto.
            (rsqrt14_<mode>_mask"): Ditto.
            (*<code><mode>3<mask_name><round_saeonly_name>): Ditto.
            (ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>): Ditto.
            (*<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
            Ditto.
            (<sse>_ieee_vm<ieee_maxmin><mode>3<mask_scalar_name>
            <round_saeonly_scalar_name>): Ditto.
            (*ieee_<ieee_maxmin><mode>3): Ditto.
            (avx_h<insn>v4df3): Ditto.
            (*sse3_haddv2df3): Ditto.
            (sse3_hsubv2df3): Ditto.
            (*sse3_haddv2df3_low): Ditto.
            (*sse3_hsubv2df3_low): Ditto.
            (avx_h<insn>v8sf3): Ditto.
            (sse3_h<insn>v4sf3): Ditto.
            (*<mask_codefor>reducep<mode><mask_name><round_saeonly_name>): Ditto.
            (reduces<mode><mask_scalar_name><round_saeonly_scalar_name>): Ditto.
            (*<avx512>_eq<mode>3<mask_scalar_merge_name>_1): Ditto.
            (<sse>_andnot<mode>3<mask_name>): Ditto.
            (*<code><mode>3<mask_name>): Ditto.
            (*andnot<mode>3): Ditto.
            (<code><mode>3): Ditto.
            (*<code>tf3): Ditto.
            (vec_set<mode>_0): Ditto.
            (@vec_set<mode>_0): Ditto.
            (*sse4_1_extractps): Ditto.
            (vec_extract<mode>): Ditto.
            (<mask_codefor><avx512>_align<mode><mask_name>): Ditto.
            (avx512bw_pmaddwd512<mode><mask_name>): Ditto.
            (*avx2_pmaddw): Ditto.
            (*sse2_pmaddwd): Ditto.
            (*avx2_<code><mode>3): Ditto.
            (*avx512f_<code><mode>3<mask_name>): Ditto.
            (*avx512bw_<code><mode>3<mask_name>): Ditto.
            (*sse4_1_<code><mode>3<mask_name>): Ditto.
            (*<code>v8hi3): Ditto.
            (*<code>v16qi3): Ditto.
            (*andnot<mode>3_mask): Ditto.
            (*<code><mode>3): Ditto.
            (<code>v1ti3): Ditto.
            (<sse2p4_1>_pinsr<ssemodesuffix>): Ditto.
            (*<extract_type>_vinsert<shuffletype><extract_suf>_0): Ditto.
            (<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>
            _1<mask_name>): Ditto.
            (vec_set_lo_<mode><mask_name>): Ditto.
            (vec_set_hi_<mode><mask_name>): Ditto.
            (<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>): Ditto.
            (avx512f_shuf_<shuffletype>64x2_1<mask_name>): Ditto.
            (*avx512f_shuf_<shuffletype>64x2_1<mask_name>_1): Ditto.
            (avx512vl_shuf_<shuffletype>32x4_1<mask_name>): Ditto.
            (avx512f_shuf_<shuffletype>32x4_1<mask_name>): Ditto.
            (*avx512f_shuf_<shuffletype>32x4_1<mask_name>_1): Ditto.
            (*vec_extract<mode>): Ditto.
            (*vec_extract<PEXTR_MODE12:mode>_zext): Ditto.
            (*vec_extractv16qi_zext): Ditto.
            (*vec_extractv4si): Ditto.
            (*vec_extractv4si_zext): Ditto.
            (*vec_extractv2di_1): Ditto.
            (*vec_concatv2si_sse4_1): Ditto.
            (vec_concatv2di): Ditto.
            (*<sse2_avx2>_uavg<mode>3<mask_name>): Ditto.
            (*<sse2_avx2>_psadbw): Ditto.
            (<sse>_movmsk<ssemodesuffix><avxsizesuffix>): Ditto.
            (*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext): Ditto.
            (<sse2_avx2>_pmovmskb): Ditto.
            (*<sse2_avx2>_pmovmskb_zext): Ditto.
            (*sse2_maskmovdqu): Ditto.
            (avx2_ph<plusminus_mnemonic>wv16hi3): Ditto.
            (ssse3_ph<plusminus_mnemonic>wv8hi3): Ditto.
            (ssse3_ph<plusminus_mnemonic>dv4si3): Ditto.
            (avx2_ph<plusminus_mnemonic>dv8si3): Ditto.
            (avx2_pmaddubsw256): Ditto.
            (avx512bw_pmaddubsw512<mode><mask_name>): Ditto.
            (ssse3_pmaddubsw128): Ditto.
            (<ssse3_avx2>_psign<mode>3): Ditto.
            (ssse3_psign<mode>3): Ditto.
            (*abs<mode>2): Ditto.
            (abs<mode>2_mask): Ditto.
            (abs<mode>2_mask): Ditto.
            (sse4a_movnt<mode>): Ditto.
            (sse4a_vmmovnt<mode>): Ditto.
            (<sse4_1>_blend<ssemodesuffix><avxsizesuffix>): Ditto.
            (<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>): Ditto.
            (sse4_1_blendv<ssemodesuffix>): Ditto.
            (<vi8_sse4_1_avx2_avx512>_movntdqa): Ditto.
            (<sse4_1_avx2>_pblendvb): Ditto.
            (sse4_1_pblend<ssemodesuffix>): Ditto.
            (*avx2_pblend<ssemodesuffix>): Ditto.
            (avx2_pblendd<mode>): Ditto.
            (avx2_<code>v16qiv16hi2<mask_name>): Ditto.
            (avx512bw_<code>v32qiv32hi2<mask_name>): Ditto.
            (sse4_1_<code>v8qiv8hi2<mask_name>): Ditto.
            (*sse4_1_<code>v8qiv8hi2<mask_name>_1): Ditto.
            (<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>): Ditto.
            (avx2_<code>v8qiv8si2<mask_name>): Ditto.
            (*avx2_<code>v8qiv8si2<mask_name>_1): Ditto.
            (sse4_1_<code>v4qiv4si2<mask_name>): Ditto.
            (*sse4_1_<code>v4qiv4si2<mask_name>_1): Ditto.
            (avx512f_<code>v16hiv16si2<mask_name>): Ditto.
            (avx2_<code>v8hiv8si2<mask_name>): Ditto.
            (sse4_1_<code>v4hiv4si2<mask_name>): Ditto.
            (*sse4_1_<code>v4hiv4si2<mask_name>_1): Ditto.
            (avx512f_<code>v8qiv8di2<mask_name>): Ditto.
            (*avx512f_<code>v8qiv8di2<mask_name>_1): Ditto.
            (avx2_<code>v4qiv4di2<mask_name>): Ditto.
            (*avx2_<code>v4qiv4di2<mask_name>_1): Ditto.
            (sse4_1_<code>v2qiv2di2<mask_name>): Ditto.
            (*sse4_1_<code>v2qiv2di2<mask_name>_1): Ditto.
            (avx512f_<code>v8hiv8di2<mask_name>): Ditto.
            (avx2_<code>v4hiv4di2<mask_name>): Ditto.
            (*avx2_<code>v4hiv4di2<mask_name>_1): Ditto.
            (sse4_1_<code>v2hiv2di2<mask_name>): Ditto.
            (*sse4_1_<code>v2hiv2di2<mask_name>_1): Ditto.
            (avx512f_<code>v8siv8di2<mask_name>): Ditto.
            (avx2_<code>v4siv4di2<mask_name>): Ditto.
            (sse4_1_<code>v2siv2di2<mask_name>): Ditto.
            (*sse4_1_<code>v2siv2di2<mask_name>_1): Ditto.
            (sse4_1_round<ssescalarmodesuffix>): Ditto.
            (*sse4_1_round<ssescalarmodesuffix>"): Ditto.
            (sse4_2_pcmpestri): Ditto.
            (sse4_2_pcmpestrm): Ditto.
            (sse4_2_pcmpestr_cconly): Ditto.
            (sse4_2_pcmpistri): Ditto.
            (sse4_2_pcmpistrm): Ditto.
            (sse4_2_pcmpistr_cconly): Ditto.
            (xop_phadd<u>bw): Ditto.
            (xop_phadd<u>bd): Ditto.
            (xop_phadd<u>bq): Ditto.
            (xop_phadd<u>wd): Ditto.
            (xop_phadd<u>wq): Ditto.
            (xop_phadd<u>dq): Ditto.
            (xop_phsubbw): Ditto.
            (xop_phsubwd): Ditto.
            (xop_phsubdq): Ditto.
            (aesenc): Ditto.
            (aesenclast): Ditto.
            (aesdec): Ditto.
            (aesdeclast): Ditto.
            (aesimc): Ditto.
            (aeskeygenassist): Ditto.
            (<avx2_avx512>_permvar<mode><mask_name>): Ditto.
            (avx2_perm<mode>_1<mask_name>): Ditto.
            (<avx512>_permvar<mode><mask_name>): Ditto.
            (avx512f_perm<mode>_1<mask_name>): Ditto.
            (<mask_codefor>avx512f_broadcast<mode><mask_name>): Ditto.
            (avx_vbroadcastf128_<mode>): Ditto.
            (<mask_codefor>avx512vl_broadcast<mode><mask_name>_1): Ditto.
            (<mask_codefor>avx512dq_broadcast<mode><mask_name>_1): Ditto.
            (*<avx512>_vpermi2var<mode>3_mask): Ditto.
            (<avx512>_vpermt2var<mode>3<sd_maskz_name>): Ditto.
            (<avx512>_vpermt2var<mode>3_mask): Ditto.
            (*avx_vperm2f128<mode>_nozero): Ditto.
            (vec_set_lo_<mode><mask_name>): Ditto.
            (vec_set_hi_<mode><mask_name>): Ditto.
            (vec_set_lo_<mode>): Ditto.
            (vec_set_hi_<mode>): Ditto.
            (vec_set_lo_v32qi): Ditto.
            (<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>): Ditto.
            (<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>): Ditto.
            (avx_vec_concat<mode>): Ditto.
            (<avx512>_compress<mode>_mask): Ditto.
            (compress<mode>_mask): Ditto.
            (<avx512>_compressstore<mode>_mask): Ditto.
            (compressstore<mode>_mask): Ditto.
            (expand<mode>_mask): Ditto.
            (<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>): Ditto.
            (clz<mode>2<mask_name>): Ditto.
            (vpmadd52<vpmadd52type>v8di): Ditto.
            (vpmadd52<vpmadd52type><mode>): Ditto.
            (vpmadd52<vpmadd52type><mode>_maskz_1): Ditto.
            (vpmadd52<vpmadd52type><mode>_mask): Ditto.
            (vaesdec_<mode>): Ditto.
            (vaesdeclast_<mode>): Ditto.
            (vaesenc_<mode>): Ditto.
            (vaesenclast_<mode>): Ditto.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/i386/builtin_target.c: Add handling for HYGON CPUs by
            validating the vendor and invoking HYGON-specific CPU detection.
            * gcc.target/i386/funcspec-56.inc: Test function target attribute on
            {arch,tune}=c86-4g-m{4,6,7}.
            * g++.target/i386/mv33.C: New test.
    
    (cherry picked from commit 2a64a63d982584618af1de1b5d5f1f1c3ec03502)

Diff:
---
 gcc/common/config/i386/cpuinfo.h               |   57 +
 gcc/common/config/i386/i386-common.cc          |   20 +-
 gcc/common/config/i386/i386-cpuinfo.h          |    5 +
 gcc/config.gcc                                 |   26 +-
 gcc/config/i386/c86-4g-m7.md                   | 1996 ++++++++++++++++++++++++
 gcc/config/i386/c86-4g.md                      | 1204 ++++++++++++++
 gcc/config/i386/cpuid.h                        |    4 +
 gcc/config/i386/driver-i386.cc                 |   19 +
 gcc/config/i386/i386-c.cc                      |   22 +-
 gcc/config/i386/i386-options.cc                |    9 +-
 gcc/config/i386/i386.cc                        |    5 +-
 gcc/config/i386/i386.h                         |   18 +
 gcc/config/i386/i386.md                        |   85 +-
 gcc/config/i386/mmx.md                         |   31 +
 gcc/config/i386/sse.md                         |  238 +++
 gcc/config/i386/x86-tune-costs.h               |  300 ++++
 gcc/config/i386/x86-tune-sched.cc              |    6 +
 gcc/config/i386/x86-tune.def                   |   85 +-
 gcc/doc/extend.texi                            |   12 +
 gcc/doc/invoke.texi                            |   21 +
 gcc/testsuite/g++.target/i386/mv33.C           |   42 +
 gcc/testsuite/gcc.target/i386/builtin_target.c |    6 +
 gcc/testsuite/gcc.target/i386/funcspec-56.inc  |    6 +
 23 files changed, 4172 insertions(+), 45 deletions(-)

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index 583e0acf8e87..62e9210b0675 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -349,6 +349,48 @@ get_amd_cpu (struct __processor_model *cpu_model,
   return cpu;
 }
 
+/* Get the specific type of HYGON CPU and return HYGON CPU name.  Return
+   NULL for unknown HYGON CPU.  */
+
+static inline const char *
+get_hygon_cpu (struct __processor_model *cpu_model,
+	       struct __processor_model2 *cpu_model2,
+	       unsigned int *cpu_features2 __attribute__((unused)))
+{
+  const char *cpu = NULL;
+  unsigned int family = cpu_model2->__cpu_family;
+  unsigned int model = cpu_model2->__cpu_model;
+
+  switch (family)
+    {
+    case 0x18:
+      cpu_model->__cpu_type = HYGONFAM18H;
+      if (model == 0x4)
+	{
+	  cpu = "c86-4g-m4";
+	  CHECK___builtin_cpu_is ("c86-4g-m4");
+	  cpu_model->__cpu_subtype = HYGONFAM18H_C86_4G_M4;
+	}
+      else if (model == 0x6)
+	{
+	  cpu = "c86-4g-m6";
+	  CHECK___builtin_cpu_is ("c86-4g-m6");
+	  cpu_model->__cpu_subtype = HYGONFAM18H_C86_4G_M6;
+	}
+      else if (model == 0x7)
+	{
+	  cpu = "c86-4g-m7";
+	  CHECK___builtin_cpu_is ("c86-4g-m7");
+	  cpu_model->__cpu_subtype = HYGONFAM18H_C86_4G_M7;
+	}
+      break;
+    default:
+      break;
+    }
+
+  return cpu;
+}
+
 /* Get the specific type of Intel CPU and return Intel CPU name.  Return
    NULL for unknown Intel CPU.  */
 
@@ -1259,6 +1301,21 @@ cpu_indicator_init (struct __processor_model *cpu_model,
     cpu_model->__cpu_vendor = VENDOR_CYRIX;
   else if (vendor == signature_NSC_ebx)
     cpu_model->__cpu_vendor = VENDOR_NSC;
+  else if (vendor == signature_HYGON_ebx)
+    {
+      /* Adjust model and family for HYGON CPUS.  */
+      if (family == 0x0f)
+	{
+	  family += extended_family;
+	  model += extended_model;
+	}
+      cpu_model2->__cpu_family = family;
+      cpu_model2->__cpu_model = model;
+
+      /* Get CPU type.  */
+      get_hygon_cpu (cpu_model, cpu_model2, cpu_features2);
+      cpu_model->__cpu_vendor = VENDOR_HYGON;
+    }
   else
     cpu_model->__cpu_vendor = VENDOR_OTHER;
 
diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc
index 4b924e09b2af..1dd9819c3091 100644
--- a/gcc/common/config/i386/i386-common.cc
+++ b/gcc/common/config/i386/i386-common.cc
@@ -2205,7 +2205,10 @@ const char *const processor_names[] =
   "znver3",
   "znver4",
   "znver5",
-  "znver6"
+  "znver6",
+  "c86-4g-m4",
+  "c86-4g-m6",
+  "c86-4g-m7"
 };
 
 /* Guarantee that the array is aligned with enum processor_type.  */
@@ -2473,6 +2476,15 @@ const pta processor_alias_table[] =
   {"btver2", PROCESSOR_BTVER2, CPU_BTVER2,
     PTA_BTVER2,
     M_CPU_TYPE (AMD_BTVER2), P_PROC_BMI},
+  {"c86-4g-m4", PROCESSOR_C86_4G_M4, CPU_C86_4G_M4,
+    PTA_C86_4G_M4,
+    M_CPU_SUBTYPE (HYGONFAM18H_C86_4G_M4), P_PROC_AVX2},
+  {"c86-4g-m6", PROCESSOR_C86_4G_M6, CPU_C86_4G_M6,
+    PTA_C86_4G_M6,
+    M_CPU_SUBTYPE (HYGONFAM18H_C86_4G_M6), P_PROC_AVX2},
+  {"c86-4g-m7", PROCESSOR_C86_4G_M7, CPU_C86_4G_M7,
+    PTA_C86_4G_M7,
+    M_CPU_SUBTYPE (HYGONFAM18H_C86_4G_M7), P_PROC_AVX512F},
 
   {"generic", PROCESSOR_GENERIC, CPU_GENERIC,
     PTA_64BIT
@@ -2493,10 +2505,14 @@ const pta processor_alias_table[] =
     M_CPU_SUBTYPE (AMDFAM10H_SHANGHAI), P_NONE},
   {"istanbul", PROCESSOR_GENERIC, CPU_GENERIC, 0,
     M_CPU_SUBTYPE (AMDFAM10H_ISTANBUL), P_NONE},
+  {"hygon", PROCESSOR_GENERIC, CPU_GENERIC, 0,
+    M_VENDOR (VENDOR_HYGON), P_NONE},
+  {"hygonfam18h", PROCESSOR_GENERIC, CPU_GENERIC, 0,
+    M_CPU_TYPE (HYGONFAM18H), P_NONE},
 };
 
 /* NB: processor_alias_table stops at the "generic" entry.  */
-unsigned int const pta_size = ARRAY_SIZE (processor_alias_table) - 7;
+unsigned int const pta_size = ARRAY_SIZE (processor_alias_table) - 9;
 unsigned int const num_arch_names = ARRAY_SIZE (processor_alias_table);
 
 /* Provide valid option values for -march and -mtune options.  */
diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h
index 56294246779d..5407d9d9ebaf 100644
--- a/gcc/common/config/i386/i386-cpuinfo.h
+++ b/gcc/common/config/i386/i386-cpuinfo.h
@@ -30,6 +30,7 @@ enum processor_vendor
   VENDOR_INTEL = 1,
   VENDOR_AMD,
   VENDOR_ZHAOXIN,
+  VENDOR_HYGON,
   VENDOR_OTHER,
   VENDOR_CENTAUR,
   VENDOR_CYRIX,
@@ -62,6 +63,7 @@ enum processor_types
   INTEL_GRANDRIDGE,
   INTEL_CLEARWATERFOREST,
   AMDFAM1AH,
+  HYGONFAM18H,
   CPU_TYPE_MAX,
   BUILTIN_CPU_TYPE_MAX = CPU_TYPE_MAX
 };
@@ -108,6 +110,9 @@ enum processor_subtypes
   INTEL_COREI7_DIAMONDRAPIDS,
   INTEL_COREI7_NOVALAKE,
   AMDFAM1AH_ZNVER6,
+  HYGONFAM18H_C86_4G_M4,
+  HYGONFAM18H_C86_4G_M6,
+  HYGONFAM18H_C86_4G_M7,
   CPU_SUBTYPE_MAX
 };
 
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8fe99616f825..d1595a1d85eb 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -768,7 +768,7 @@ sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
 nano-x2 eden-x4 nano-x4 lujiazui yongfeng shijidadao x86-64 x86-64-v2 \
 x86-64-v3 x86-64-v4 sierraforest graniterapids graniterapids-d grandridge \
 arrowlake arrowlake-s clearwaterforest pantherlake diamondrapids novalake \
-native"
+c86-4g-m4 c86-4g-m6 c86-4g-m7 native"
 
 # Additional x86 processors supported by --with-cpu=.  Each processor
 # MUST be separated by exactly one space.
@@ -4006,6 +4006,18 @@ case ${target} in
 	cpu=pentiumpro
 	arch_without_sse2=yes
 	;;
+      c86_4g_m4-*)
+	arch=c86-4g-m4
+	cpu=c86-4g-m4
+	;;
+      c86_4g_m6-*)
+	arch=c86-4g-m6
+	cpu=c86-4g-m6
+	;;
+      c86_4g_m7-*)
+	arch=c86-4g-m7
+	cpu=c86-4g-m7
+	;;
       *)
 	arch=pentiumpro
 	cpu=generic
@@ -4108,6 +4120,18 @@ case ${target} in
 	arch=corei7
 	cpu=corei7
 	;;
+      c86_4g_m4-*)
+	arch=c86-4g-m4
+	cpu=c86-4g-m4
+	;;
+      c86_4g_m6-*)
+	arch=c86-4g-m6
+	cpu=c86-4g-m6
+	;;
+      c86_4g_m7-*)
+	arch=c86-4g-m7
+	cpu=c86-4g-m7
+	;;
       *)
 	arch=x86-64
 	cpu=generic
diff --git a/gcc/config/i386/c86-4g-m7.md b/gcc/config/i386/c86-4g-m7.md
new file mode 100644
index 000000000000..7eda123acaa5
--- /dev/null
+++ b/gcc/config/i386/c86-4g-m7.md
@@ -0,0 +1,1996 @@
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; <http://www.gnu.org/licenses/>.
+;;
+
+;; HYGON c86-4g-m7 Scheduling
+;; Modeling automatons for decoders, integer execution pipes,
+;; AGU pipes, branch, floating point execution and fp store units.
+(define_automaton "c86_4g_m7, c86_4g_m7_ieu, c86_4g_m7_agu, c86_4g_m7_fpu")
+
+;; Decoders unit has 4 decoders and all of them can decode fast path
+;; and vector type instructions.
+(define_cpu_unit "c86-4g-m7-decode0" "c86_4g_m7")
+(define_cpu_unit "c86-4g-m7-decode1" "c86_4g_m7")
+(define_cpu_unit "c86-4g-m7-decode2" "c86_4g_m7")
+(define_cpu_unit "c86-4g-m7-decode3" "c86_4g_m7")
+
+;; Currently blocking all decoders for vector path instructions as
+;; they are dispatched separetely as microcode sequence.
+(define_reservation "c86-4g-m7-vector" "c86-4g-m7-decode0+c86-4g-m7-decode1+c86-4g-m7-decode2+c86-4g-m7-decode3")
+
+;; Direct instructions can be issued to any of the four decoders.
+(define_reservation "c86-4g-m7-direct" "c86-4g-m7-decode0|c86-4g-m7-decode1|c86-4g-m7-decode2|c86-4g-m7-decode3")
+
+;; Fix me: Need to revisit this later to simulate fast path double behavior.
+(define_reservation "c86-4g-m7-double" "c86-4g-m7-direct")
+
+;; Integer unit 4 ALU pipes.
+(define_cpu_unit "c86-4g-m7-ieu0" "c86_4g_m7_ieu")
+(define_cpu_unit "c86-4g-m7-ieu1" "c86_4g_m7_ieu")
+(define_cpu_unit "c86-4g-m7-ieu2" "c86_4g_m7_ieu")
+(define_cpu_unit "c86-4g-m7-ieu3" "c86_4g_m7_ieu")
+
+;; c86-4g-m7 has an additional branch unit.
+(define_cpu_unit "c86-4g-m7-bru0" "c86_4g_m7_ieu")
+(define_reservation "c86-4g-m7-ieu" "c86-4g-m7-ieu0|c86-4g-m7-ieu1|c86-4g-m7-ieu2|c86-4g-m7-ieu3")
+
+;; 3 AGU pipes in c86-4g-m7
+(define_cpu_unit "c86-4g-m7-agu0" "c86_4g_m7_agu")
+(define_cpu_unit "c86-4g-m7-agu1" "c86_4g_m7_agu")
+(define_cpu_unit "c86-4g-m7-agu2" "c86_4g_m7_agu")
+(define_reservation "c86-4g-m7-agu-reserve" "c86-4g-m7-agu0|c86-4g-m7-agu1|c86-4g-m7-agu2")
+
+;; Load is 4 cycles.  We do not model reservation of load unit.
+(define_reservation "c86-4g-m7-load" "c86-4g-m7-agu-reserve")
+(define_reservation "c86-4g-m7-store" "c86-4g-m7-agu-reserve")
+
+;; vectorpath (microcoded) instructions are single issue instructions.
+;; So, they occupy all the integer units.
+(define_reservation "c86-4g-m7-ivector" "c86-4g-m7-ieu0+c86-4g-m7-ieu1
+				      +c86-4g-m7-ieu2+c86-4g-m7-ieu3+c86-4g-m7-bru0
+				      +c86-4g-m7-agu0+c86-4g-m7-agu1+c86-4g-m7-agu2")
+
+;; Floating point unit 4 FP pipes.
+(define_cpu_unit "c86-4g-m7-fpu0" "c86_4g_m7_fpu")
+(define_cpu_unit "c86-4g-m7-fpu1" "c86_4g_m7_fpu")
+(define_cpu_unit "c86-4g-m7-fpu2" "c86_4g_m7_fpu")
+(define_cpu_unit "c86-4g-m7-fpu3" "c86_4g_m7_fpu")
+(define_reservation "c86-4g-m7-fpu" "c86-4g-m7-fpu0|c86-4g-m7-fpu1|c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+(define_reservation "c86-4g-m7-fpu_0_2" "c86-4g-m7-fpu0|c86-4g-m7-fpu2")
+(define_reservation "c86-4g-m7-fpu_1_3" "c86-4g-m7-fpu1|c86-4g-m7-fpu3")
+(define_reservation "c86-4g-m7-fpu_0_1" "c86-4g-m7-fpu0|c86-4g-m7-fpu1")
+(define_reservation "c86-4g-m7-fpu_0_2x2" "c86-4g-m7-fpu0*2|c86-4g-m7-fpu2*2")
+(define_reservation "c86-4g-m7-fpu_0_2x4" "c86-4g-m7-fpu0*4|c86-4g-m7-fpu2*4")
+(define_reservation "c86-4g-m7-fvector" "c86-4g-m7-fpu0+c86-4g-m7-fpu1
+				      +c86-4g-m7-fpu2+c86-4g-m7-fpu3
+				      +c86-4g-m7-agu0+c86-4g-m7-agu1+c86-4g-m7-agu2")
+
+;; IMOV/IMOVX
+(define_insn_reservation "c86_4g_m7_imov_xchg" 1
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imov")
+				  (and (eq_attr "c86_decode" "vector")
+				       (eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct")
+
+(define_insn_reservation "c86_4g_m7_imov_xchg_load" 5
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imov")
+				  (and (eq_attr "c86_decode" "vector")
+				       (eq_attr "memory" "!none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_imovx_cwde" 2
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imovx")
+				  (and (eq_attr "c86_decode" "double")
+				       (eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_imov" 1
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imov,imovx")
+				  (and (eq_attr "c86_decode" "direct")
+				       (eq_attr "memory" "none"))))
+	     "c86-4g-m7-direct,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_imov_load" 5
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imov,imovx")
+				  (and (eq_attr "c86_decode" "!vector")
+				       (eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_imov_store" 1
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imov,imovx")
+				  (and (eq_attr "c86_decode" "!vector")
+				       (eq_attr "memory" "store"))))
+			 "c86-4g-m7-direct,c86-4g-m7-store,c86-4g-m7-ieu")
+
+;; PUSH
+(define_insn_reservation "c86_4g_m7_push" 1
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "push,sse")
+				  (eq_attr "memory" "store")))
+			 "c86-4g-m7-direct,c86-4g-m7-store")
+
+(define_insn_reservation "c86_4g_m7_push_mem" 5
+			(and (eq_attr "cpu" "c86_4g_m7")
+				 (and (eq_attr "type" "push")
+				  (eq_attr "memory" "both")))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-store")
+
+;; POP
+(define_insn_reservation "c86_4g_m7_pop" 4
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "pop")
+				  (eq_attr "memory" "load")))
+			 "c86-4g-m7-direct,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_pop_mem" 5
+	    (and (eq_attr "cpu" "c86_4g_m7")
+		 (and (eq_attr "type" "pop")
+		  (eq_attr "memory" "both")))
+	     "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-store")
+
+;; IMUL/IMULX
+(define_insn_reservation "c86_4g_m7_imul" 3
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imul,imulx")
+				  (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu1")
+
+(define_insn_reservation "c86_4g_m7_imul_load" 7
+			(and (eq_attr "cpu" "c86_4g_m7")
+			     (and (eq_attr "type" "imul")
+				  (eq_attr "memory" "!none")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu1")
+
+;; IDIV
+(define_insn_reservation "c86_4g_m7_idiv_DI" 41
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "DI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-ieu3*41")
+
+(define_insn_reservation "c86_4g_m7_idiv_SI" 25
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "SI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-ieu3*25")
+
+(define_insn_reservation "c86_4g_m7_idiv_HI" 17
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "HI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-ieu3*17")
+
+(define_insn_reservation "c86_4g_m7_idiv_QI" 15
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "QI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu3*15")
+
+(define_insn_reservation "c86_4g_m7_idiv_DI_load" 45
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "DI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-ieu3*41")
+
+(define_insn_reservation "c86_4g_m7_idiv_SI_load" 29
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "SI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-ieu3*25")
+
+(define_insn_reservation "c86_4g_m7_idiv_HI_load" 21
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "HI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-ieu3*17")
+
+(define_insn_reservation "c86_4g_m7_idiv_QI_load" 19
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "QI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu3*15")
+
+;; Integer/genaral Instructions
+(define_insn_reservation "c86_4g_m7_insn" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu,negnot,rotate1,ishift1,test,incdec,icmp,
+						    rotate,rotatex,ishift,ishiftx,icmov")
+				   (eq_attr "memory" "none,unknown")))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_insn_load" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu,incdec,icmp,test,ishift,
+						    ishiftx,icmov,rotate,rotatex")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_insn_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ishift1,rotate1,rotate,incdec,
+						    alu,icmov,ishift,negnot,alu1")
+				   (eq_attr "memory" "store")))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu,c86-4g-m7-store")
+
+(define_insn_reservation "c86_4g_m7_insn2_store" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "icmp")
+				   (eq_attr "memory" "store")))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu,c86-4g-m7-store")
+
+(define_insn_reservation "c86_4g_m7_insn_both" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu,negnot,rotate1,ishift1,incdec,rotate,
+						    rotatex,ishift,ishiftx,icmov")
+				   (eq_attr "memory" "both")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu,c86-4g-m7-store")
+
+(define_insn_reservation "c86_4g_m7_setcc" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "setcc")
+				   (eq_attr "memory" "none,unknown")))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu0|c86-4g-m7-ieu3")
+
+(define_insn_reservation "c86_4g_m7_setcc_load" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "setcc")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu0|c86-4g-m7-ieu3")
+
+(define_insn_reservation "c86_4g_m7_setcc_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "setcc")
+				   (eq_attr "memory" "store")))
+			 "c86-4g-m7-direct,c86-4g-m7-store,c86-4g-m7-ieu0|c86-4g-m7-ieu3")
+
+;; ALU1
+(define_insn_reservation "c86_4g_m7_alu1_double" 2
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu1")
+				   (and (eq_attr "c86_decode" "double")
+					(eq_attr "memory" "none,unknown"))))
+			 "c86-4g-m7-double,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_alu1_double_load" 6
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu1")
+				   (and (eq_attr "c86_decode" "double")
+					(eq_attr "memory" "both"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-store,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_alu1_vector" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu1")
+				   (and (eq_attr "c86_decode" "vector")
+					(eq_attr "memory" "none,unknown"))))
+			 "c86-4g-m7-vector,c86-4g-m7-ivector*3")
+
+(define_insn_reservation "c86_4g_m7_alu1_vector_load" 7
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu1")
+				   (and (eq_attr "c86_decode" "vector")
+					(eq_attr "memory" "both"))))
+			 "c86-4g-m7-vector,c86-4g-m7-load,c86-4g-m7-store,c86-4g-m7-ivector*3")
+
+(define_insn_reservation "c86_4g_m7_alu1_direct" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu1")
+				   (and (eq_attr "c86_decode" "direct")
+					(eq_attr "memory" "none,unknown"))))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu")
+
+(define_insn_reservation "c86_4g_m7_alu1_direct_load" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "alu1")
+				   (and (eq_attr "c86_decode" "direct")
+					(eq_attr "memory" "both"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-store,c86-4g-m7-ieu")
+
+;; CALL/CALLV
+(define_insn_reservation "c86_4g_m7_call" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (eq_attr "type" "call,callv"))
+			 "c86-4g-m7-double,c86-4g-m7-ieu0|c86-4g-m7-bru0,c86-4g-m7-store")
+
+;; IBR
+(define_insn_reservation "c86_4g_m7_branch" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ibr")
+				   (eq_attr "memory" "none")))
+			  "c86-4g-m7-direct,c86-4g-m7-ieu0|c86-4g-m7-bru0")
+
+(define_insn_reservation "c86_4g_m7_branch_load" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ibr")
+				   (eq_attr "memory" "load")))
+			  "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-ieu0|c86-4g-m7-bru0")
+
+;; LEA
+(define_insn_reservation "c86_4g_m7_lea" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (eq_attr "type" "lea"))
+			 "c86-4g-m7-direct,c86-4g-m7-ieu")
+
+;; LEAVE
+(define_insn_reservation "c86_4g_m7_leave" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (eq_attr "type" "leave"))
+			 "c86-4g-m7-double,c86-4g-m7-ieu,c86-4g-m7-store")
+
+;; STR
+(define_insn_reservation "c86_4g_m7_str" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "str")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-vector,c86-4g-m7-ivector*3")
+
+(define_insn_reservation "c86_4g_m7_str_load" 7
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "str")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-vector,c86-4g-m7-load,c86-4g-m7-ivector*3")
+
+
+(define_insn_reservation "c86_4g_m7_ieu_vector" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "other,multi")
+				   (and (eq_attr "unit" "!i387")
+				       (eq_attr "memory" "none,unknown"))))
+			 "c86-4g-m7-vector,c86-4g-m7-ivector*5")
+
+(define_insn_reservation "c86_4g_m7_ieu_vector_load" 9
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "other,multi")
+				   (and (eq_attr "unit" "!i387")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-vector,c86-4g-m7-load,c86-4g-m7-ivector*5")
+
+;; SSEINS
+(define_insn_reservation "c86_4g_m7_sse_insertimm" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseins")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "length_immediate" "2"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu0|c86-4g-m7-fpu3,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_sse_insert" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseins")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "length_immediate" "!2"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1")
+
+;; FCMOV
+(define_insn_reservation "c86_4g_m7_fp_cmov" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (eq_attr "type" "fcmov"))
+			 "c86-4g-m7-vector,c86-4g-m7-fvector*3")
+
+;; FLD
+(define_insn_reservation "c86_4g_m7_fp_mov_direct_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1")
+
+;; FST
+(define_insn_reservation "c86_4g_m7_fp_mov_direct_store" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1,c86-4g-m7-store")
+
+;; FILD
+(define_insn_reservation "c86_4g_m7_fp_mov_double_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1")
+
+;; FIST
+(define_insn_reservation "c86_4g_m7_fp_mov_double_store" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu1,c86-4g-m7-store")
+
+(define_insn_reservation "c86_4g_m7_fp_mov_direct" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1")
+
+;; FSQRT
+(define_insn_reservation "c86_4g_m7fp_sqrt" 22
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fpspc")
+				   (eq_attr "c86_attr" "sqrt")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1*22")
+
+;; FPSPC
+(define_insn_reservation "c86_4g_m7_fp_spc_direct" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fpspc")
+				   (and (eq_attr "c86_decode" "direct")
+				    (and (eq_attr "c86_attr" "other")
+					 (eq_attr "memory" "store")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_fp_spc" 6
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fpspc")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-vector,c86-4g-m7-fvector*6")
+
+(define_insn_reservation "c86_4g_m7_fp_op_mul" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fop,fmul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_fp_op_mul_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fop,fmul")
+				   (and (eq_attr "fp_int_src" "false")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_fp_op_imul_load" 16
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fmul")
+				   (and (eq_attr "fp_int_src" "true")
+					(eq_attr "memory" "!none"))))
+			"c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu0,c86-4g-m7-fpu_0_2")
+
+;; FDIV
+(define_insn_reservation "c86_4g_m7_fp_div" 15
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fdiv")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1*7")
+
+(define_insn_reservation "c86_4g_m7_fp_div_load" 22
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fdiv")
+				   (and (eq_attr "fp_int_src" "false")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1*7")
+
+(define_insn_reservation "c86_4g_m7_fp_idiv_load" 26
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fdiv")
+				   (and (eq_attr "fp_int_src" "true")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu1*7")
+
+(define_insn_reservation "c86_4g_m7_fp_fsgn" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (eq_attr "type" "fsgn"))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+;; FCMP
+(define_insn_reservation "c86_4g_m7_fp_fcmp" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fcmp")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-double,c86-4g-m7-fpu0,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_fp_fcmp_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "fcmp")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu0,c86-4g-m7-fpu1")
+
+;; MMX
+(define_insn_reservation "c86_4g_m7_fp_mmx" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (eq_attr "type" "mmx"))
+			 "c86-4g-m7-direct")
+
+(define_insn_reservation "c86_4g_m7_mmx_add_cmp" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxadd,mmxcmp")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_mmx_add_cmp_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxadd,mmxcmp")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_mmx_cvt" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxcvt")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_mmx_cvt_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxcvt")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_mmx_shift" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxshft")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_mmx_shift_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxshft")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_mmx_shift_avg" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxshft")
+				   (and (eq_attr "c86_attr" "avg")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_mmx_shift_avg_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxshft")
+				   (and (eq_attr "c86_attr" "avg")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+;; SADBW
+(define_insn_reservation "c86_4g_m7_mmx_shift_sadbw" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxshft")
+				   (and (eq_attr "c86_attr" "sadbw")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0")
+
+(define_insn_reservation "c86_4g_m7_mmx_shift_sadbw_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxshft")
+				   (and (eq_attr "c86_attr" "sadbw")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0")
+
+(define_insn_reservation "c86_4g_m7_mmx_mov" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxmov")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_mmx_mov_store" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxmov")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-m7-direct,c86-4g-m7-store,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_mmx_mov_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxmov")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_mmx_mul" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxmul")
+				   (eq_attr "memory" "none")))
+			  "c86-4g-m7-direct,c86-4g-m7-fpu0")
+
+(define_insn_reservation "c86_4g_m7_mmx_mul_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mmxmul")
+				   (eq_attr "memory" "load")))
+			  "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0")
+
+;; PINSR
+(define_insn_reservation "c86_4g_m7_sse_pinsr_reg" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,mmxcvt")
+				   (and (eq_attr "c86_attr" "insr")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-ieu2,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_sse_pinsr_reg_load" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,mmxcvt")
+				   (and (eq_attr "c86_attr" "insr")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx_vpinsr_reg" 2
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insr")
+				     (and (eq_attr "prefix" "!orig")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu2*2")
+
+(define_insn_reservation "c86_4g_m7_avx_vpinsr_reg_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insr")
+				     (and (eq_attr "prefix" "!orig")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1|c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+;; PERM
+(define_insn_reservation "c86_4g_m7_avx512_perm_xmm" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (ior (and (eq_attr "c86_attr" "perm2")
+						  (eq_attr "mode" "V4SF,V2DF,TI"))
+					     (and (eq_attr "c86_attr" "perm")
+						  (eq_attr "mode" "V8SF,V4DF,TI,OI")))
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_perm_xmm_opload" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (ior (and (eq_attr "c86_attr" "perm2")
+						  (eq_attr "mode" "V4SF,V2DF,TI"))
+					     (and (eq_attr "c86_attr" "perm")
+						  (eq_attr "mode" "V8SF,V4DF,TI,OI")))
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_permi2_ymm" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm2")
+				    (and (eq_attr "mode" "V8SF,V4DF,OI")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_permi2_zmm" 16
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm2")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_permi2_ymm_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm2")
+				    (and (eq_attr "mode" "V8SF,V4DF,OI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_permi2_zmm_load" 23
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm2")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_perm_zmm_imm" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				     (and (match_operand 2 "immediate_operand")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2x4")
+
+(define_insn_reservation "c86_4g_m7_avx512_perm_zmm_imm_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				     (and (match_operand 2 "immediate_operand")
+					  (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2x4")
+
+(define_insn_reservation "c86_4g_m7_avx512_perm_zmm_noimm" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				     (and (match_operand 2 "nonimmediate_operand")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_sse_perm_zmm_noimm_load" 15
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				     (and (match_operand 2 "nonimmediate_operand")
+					 (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx_perm_ymm" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm")
+				     (and (eq_attr "prefix" "!evex")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx_perm_ymem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "perm")
+				     (and (eq_attr "prefix" "!evex")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; VINSERT
+(define_insn_reservation "c86_4g_m7_avx512_insertx_ymm" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1")
+				   (and (eq_attr "c86_attr" "insertx")
+				    (and (eq_attr "mode" "V8SF,V4DF,OI")
+				     (and (eq_attr "prefix" "evex")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2x2,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_insertx_ymem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1")
+				   (and (eq_attr "c86_attr" "insertx")
+				    (and (eq_attr "mode" "V8SF,V4DF,OI")
+				     (and (eq_attr "prefix" "evex")
+					  (eq_attr "memory" "load,both"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2x2,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_insertx_zxmm" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insertx")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				    (and (match_test "GET_MODE_SIZE (GET_MODE (operands[2]))==16")
+					 (match_operand 2 "register_operand"))))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_0_2x4,c86-4g-m7-fpu_0_2x4")
+
+(define_insn_reservation "c86_4g_m7_avx512_insertx_zxmem" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insertx")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				    (and (match_test "GET_MODE_SIZE (GET_MODE (operands[2]))==16")
+					  (match_operand 2 "memory_operand"))))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_0_2x4,c86-4g-m7-fpu_0_2x4")
+
+(define_insn_reservation "c86_4g_m7_avx512_insertx_zymm" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insertx")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				    (and (match_test "GET_MODE_SIZE (GET_MODE (operands[2]))==32")
+					  (match_operand 2 "register_operand"))))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_1_3,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_insertx_zymem" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insertx")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				    (and (match_test "GET_MODE_SIZE (GET_MODE (operands[2]))==32")
+					  (match_operand 2 "memory_operand"))))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx_insertx_ymm" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1")
+				   (and (eq_attr "c86_attr" "insertx")
+				     (and (eq_attr "prefix" "!evex")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0*2")
+
+(define_insn_reservation "c86_4g_m7_avx_insertx_ymem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1")
+				   (and (eq_attr "c86_attr" "insertx")
+				     (and (eq_attr "prefix" "!evex")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0*2")
+
+;; SHUF/MULTISHIFTQB
+(define_insn_reservation "c86_4g_m7_avx512_shuf_xymm" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "shufx")
+				     (and (not (eq_attr "mode" "V8DF,V16SF,XI"))
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_shuf_zmm" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "shufx")
+				     (and (eq_attr "mode" "V8DF,V16SF,XI")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_shuf_xymem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "shufx")
+				     (and (not (eq_attr "mode" "V8DF,V16SF,XI"))
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_shuf_zmem" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "shufx")
+				     (and (eq_attr "mode" "V8DF,V16SF,XI")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; SSELOGIC
+(define_insn_reservation "c86_4g_m7_sselogic_xymm" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1")
+				   (and (eq_attr "c86_attr" "sselogic")
+					 (eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_sselogic_xymm_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1")
+				   (and (eq_attr "c86_attr" "sselogic")
+					 (eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+;; CMPESTR
+(define_insn_reservation "c86_4g_m7_avx512_cmpestr" 6
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "cmpestr")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_cmpestr_load" 13
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "cmpestr")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; SSELOG
+(define_insn_reservation "c86_4g_m7_avx512_log" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1")
+				   (and (eq_attr "c86_attr" "other")
+					  (eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_log_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1")
+				   (and (eq_attr "c86_attr" "other")
+					 (eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+;; SSELOG1
+;; VDBPSADBW
+(define_insn_reservation "c86_4g_m7_avx512_vdbpsadbw_xymm" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "mode" "OI,TI")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_0_2,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_vdbpsadbw_xymem" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "mode" "OI,TI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_0_2,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_vdbpsadbw_zmm" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "mode" "XI")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_vdbpsadbw_zmem" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "mode" "XI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; ABS
+(define_insn_reservation "c86_4g_m7_avx512_abs" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1,sse")
+				   (and (eq_attr "c86_attr" "abs")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_avx512_abs_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1,sse")
+				   (and (eq_attr "c86_attr" "abs")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "load,both")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+;; SIGN
+(define_insn_reservation "c86_4g_m7_avx_sign" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sign")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_avx_sign_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sign")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0|c86-4g-m7-fpu3")
+
+;; BLEND/ABS/AES
+(define_insn_reservation "c86_4g_m7_avx_blend" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "abs,blend,aes")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx_blend_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "abs,blend,aes")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx512_aes" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1,ssecvt,sse")
+				   (and (eq_attr "c86_attr" "aes")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_aes_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1,ssecvt,sse")
+				   (and (eq_attr "c86_attr" "aes")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx_aes" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "aes")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0|c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_avx_aes_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "aes")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0|c86-4g-m7-fpu1")
+
+;; EXTR
+(define_insn_reservation "c86_4g_m7_extr" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1,sselog,mmxcvt")
+				   (and (eq_attr "c86_attr" "extr")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu1,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_extr_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sselog1,sselog,mmxcvt")
+				   (and (eq_attr "c86_attr" "extr")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-m7-double,c86-4g-m7-store,c86-4g-m7-fpu1,c86-4g-m7-fpu_0_1")
+
+;; SSECOMI
+(define_insn_reservation "c86_4g_m7_avx_ssecomi_comi" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecomi")
+				   (and (eq_attr "prefix_extra" "0")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecomi_comi_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecomi")
+				   (and (eq_attr "prefix_extra" "0")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecomi_test" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecomi")
+				   (and (eq_attr "prefix_extra" "1")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1|c86-4g-m7-fpu2")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecomi_test_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecomi")
+				   (and (eq_attr "prefix_extra" "1")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1|c86-4g-m7-fpu2")
+
+;; SSEIMUL
+(define_insn_reservation "c86_4g_m7_avx512_imul" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseimul")
+				   (and (eq_attr "prefix" "evex")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_imul_mem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseimul")
+				   (and (eq_attr "prefix" "evex")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx_imul" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseimul")
+				   (and (eq_attr "prefix" "!evex")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_avx_imul_mem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseimul")
+				   (and (eq_attr "prefix" "!evex")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0|c86-4g-m7-fpu3")
+
+;; SSEMOV
+(define_insn_reservation "c86_4g_m7_avx512_mov_vmov" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov,sseiadd")
+				    (and (eq_attr "c86_attr" "other,blend,maxmin")
+					 (eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_avx512_mov_vmov_store" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "other")
+					 (eq_attr "memory" "store"))))
+			 "c86-4g-m7-direct,c86-4g-m7-store,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_avx512_mov_vmov_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov,sseiadd")
+				   (and (eq_attr "c86_attr" "other,blend,maxmin")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_avx512_vpmovx_y" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				    (and (eq_attr "prefix" "evex")
+				     (and (eq_attr "mode" "OI,V8SF,V4DF")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_vpmovx_y_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov,sselog1")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				    (and (eq_attr "prefix" "evex")
+				     (and (eq_attr "mode" "OI,V8SF,V4DF")
+					  (eq_attr "memory" "load,both"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2x2")
+
+(define_insn_reservation "c86_4g_m7_avx512_vpmovx_z" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				     (and (eq_attr "mode" "XI")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2x4")
+
+(define_insn_reservation "c86_4g_m7_avx512_vpmovx_z_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				     (and (eq_attr "mode" "XI")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2x4")
+
+(define_insn_reservation "c86_4g_m7_avx512_vpmovx_x" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				    (and (eq_attr "prefix" "evex")
+				     (and (eq_attr "mode" "TI,SI")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_vpmovx_x_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				    (and (eq_attr "prefix" "evex")
+				     (and (eq_attr "mode" "TI,SI")
+					  (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx_vpmovx_xx" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1|c86-4g-m7-fpu2")
+
+(define_insn_reservation "c86_4g_m7_avx_vpmovx_xx_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "vpmovx")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "load,both")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1|c86-4g-m7-fpu2")
+
+;; EXPAND
+(define_insn_reservation "c86_4g_m7_avx512_expand" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "expand,compress")
+				    (and (not (eq_attr "mode" "XI,V16SF,V8DF"))
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu3*2,c86-4g-m7-fpu1*2|c86-4g-m7-fpu3*2")
+
+(define_insn_reservation "c86_4g_m7_avx512_expand_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "expand,compress")
+				    (and (not (eq_attr "mode" "XI,V16SF,V8DF"))
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu3*2,c86-4g-m7-fpu1*2|c86-4g-m7-fpu3*2")
+
+(define_insn_reservation "c86_4g_m7_avx512_expand_z" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "expand,compress")
+				    (and (eq_attr "mode" "XI,V16SF,V8DF")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_expand_z_load" 17
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "expand,compress")
+				    (and (eq_attr "mode" "XI,V16SF,V8DF")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; MOVNT
+(define_insn_reservation "c86_4g_m7_avx512_movnt_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "movnt")
+				   (and (eq_attr "mode" "XI,V16SF,V8DF")
+					(eq_attr "memory" "load")))))
+			 "c86-4g-m7-double,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_movnt_store" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "movnt")
+				    (and (eq_attr "mode" "XI,V16SF,V8DF")
+					 (eq_attr "memory" "store")))))
+			 "c86-4g-m7-direct,c86-4g-m7-store,c86-4g-m7-fpu1*2")
+
+(define_insn_reservation "c86_4g_m7_sse_movnt_store" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov,mmxmov")
+				   (and (eq_attr "c86_attr" "movnt")
+				    (and (not (eq_attr "mode" "XI,V16SF,V8DF"))
+					 (eq_attr "memory" "!none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-store,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_sse_movnt_xy" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "movnt")
+				    (and (not (eq_attr "mode" "XI,V16SF,V8DF"))
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+;; BLENDV
+(define_insn_reservation "c86_4g_m7_avx512_blendv" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "blendv")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx512_blendv_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov")
+				   (and (eq_attr "c86_attr" "blendv")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+;; SSEMOV2
+(define_insn_reservation "c86_4g_m7_sse_mov2" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov2")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_sse_mov2_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemov2")
+				   (eq_attr "memory" "!none")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+;; SSEISHFT
+(define_insn_reservation "c86_4g_m7_avx512_sseishft_aligr" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseishft")
+				   (and (eq_attr "prefix_extra" "1")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseishft_aligr_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseishft")
+				   (and (eq_attr "prefix_extra" "1")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseishft_vshift" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseishft")
+				   (and (eq_attr "prefix_extra" "!1")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseishft_vshift_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseishft")
+				   (and (eq_attr "prefix_extra" "!1")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+
+;; SSEADD
+(define_insn_reservation "c86_4g_m7_avx512_sseadd_maxmin_xy" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sse")
+				   (and (eq_attr "c86_attr" "maxmin")
+				    (and (eq_attr "prefix" "evex")
+				      (and (eq_attr "memory" "none")
+					   (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseadd_maxmin_xy_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sse")
+				   (and (eq_attr "c86_attr" "maxmin")
+				    (and (eq_attr "prefix" "evex")
+				      (ior (eq_attr "memory" "load")
+					   (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx_sseadd_maxmin" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sse")
+				   (and (eq_attr "c86_attr" "maxmin")
+				    (and (eq_attr "prefix" "vex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx_sseadd_maxmin_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sse")
+				   (and (eq_attr "c86_attr" "maxmin")
+				    (and (eq_attr "prefix" "vex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_sse_sseadd_maxmin" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sse")
+				   (and (eq_attr "c86_attr" "maxmin")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_sse_sseadd_maxmin_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sse")
+				   (and (eq_attr "c86_attr" "maxmin")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+;; SUB/ADD
+(define_insn_reservation "c86_4g_m7_avx512_sseadd_xy" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd")
+				   (and (eq_attr "c86_attr" "other")
+					  (eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseadd_xy_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd")
+				   (and (eq_attr "c86_attr" "other")
+					 (eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu3")
+
+;; HADD/HSUB
+(define_insn_reservation "c86_4g_m7_avx_sseadd_hplus" 7
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sseadd1")
+				   (and (eq_attr "c86_attr" "hplus")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx_sseadd_hplus_load" 14
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseadd,sseadd1")
+				   (and (eq_attr "c86_attr" "hplus")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; SSEIADD
+(define_insn_reservation "c86_4g_m7_avx512_sseiadd_madd" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "sadbw,madd")
+					(and (ior (eq_attr "prefix" "evex")
+						  (eq_attr "mode" "XI"))
+					     (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseiadd_madd_mem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "sadbw,madd")
+					(and (ior (eq_attr "prefix" "evex")
+						  (eq_attr "mode" "XI"))
+					     (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx_sseiadd_sadbw" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "prefix" "vex,maybe_evex")
+				     (and (eq_attr "mode" "TI,OI")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx_sseiadd_sadbw_mem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "prefix" "vex,maybe_evex")
+				     (and (eq_attr "mode" "TI,OI")
+					  (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_sse_sseiadd_sadbw" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_sse_sseiadd_sadbw_mem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "sadbw")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_sse_sseiadd_madd" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "madd")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0")
+
+(define_insn_reservation "c86_4g_m7_sse_sseiadd_madd_mem" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "madd")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0")
+
+;; AVG
+(define_insn_reservation "c86_4g_m7_avx512_sseiadd_avg" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "avg")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_avx512_sseiadd_avg_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "avg")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_avx_sseiadd_hplus" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd,sseiadd1")
+				   (and (eq_attr "c86_attr" "hplus")
+				    (and (eq_attr "prefix" "vex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx_sseiadd_hplus_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd,sseiadd1")
+				   (and (eq_attr "c86_attr" "hplus")
+				    (and (eq_attr "prefix" "vex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_sse_sseiadd_hplus" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd,sseiadd1")
+				   (and (eq_attr "c86_attr" "hplus")
+				    (and (eq_attr "prefix" "orig")
+				     (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector,c86-4g-m7-fpu0*2")
+
+(define_insn_reservation "c86_4g_m7_sse_sseiadd_hplus_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sseiadd,sseiadd1")
+				   (and (eq_attr "c86_attr" "hplus")
+				    (and (eq_attr "prefix" "orig")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load,c86-4g-m7-fpu0*2")
+
+;; SSEMUL
+(define_insn_reservation "c86_4g_m7_avx512_ssemul" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu0")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssemul_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemul")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu0")
+
+;; SSEDIV
+(define_insn_reservation "c86_4g_m7_avx512_ssediv" 13
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssediv")
+				   (and (not (eq_attr "mode" "V16SF,V8DF"))
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu3*7")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssediv_mem" 20
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssediv")
+				   (and (not (eq_attr "mode" "V16SF,V8DF"))
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu3*7")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssediv_z" 24
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssediv")
+				   (and (eq_attr "mode" "V16SF,V8DF")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu3*7")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssediv_zmem" 31
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssediv")
+				   (and (eq_attr "mode" "V16SF,V8DF")
+					 (eq_attr "memory" "load"))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu3*7")
+
+;; SSECMP
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				   (and (eq_attr "prefix" "evex")
+				    (and (eq_attr "mode" "V2DF,V4DF,V8SF,V4SF,SF,DF")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_0_2,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				   (and (eq_attr "prefix" "evex")
+				    (and (eq_attr "mode" "V2DF,V4DF,V8SF,V4SF,SF,DF")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_0_2,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_z" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				     (and (eq_attr "c86_attr" "other")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_z_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				    (and (eq_attr "mode" "V16SF,V8DF,XI")
+				     (and (eq_attr "c86_attr" "other")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_vp" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				   (and (eq_attr "prefix" "evex")
+				    (and (eq_attr "mode" "TI,OI")
+				     (and (eq_attr "c86_attr" "other")
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_vp_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				   (and (eq_attr "prefix" "evex")
+				    (and (eq_attr "mode" "TI,OI")
+				     (and (eq_attr "c86_attr" "other")
+					  (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecmp_vp" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				   (and (eq_attr "prefix" "!evex")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecmp_vp_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				   (and (eq_attr "prefix" "!evex")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu")
+
+;; VPTEST
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_test" 6
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				    (and (eq_attr "mode" "TI,OI")
+				     (and (eq_attr "c86_attr" "ptest")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_test_load" 13
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				    (and (eq_attr "mode" "TI,OI")
+				     (and (eq_attr "c86_attr" "ptest")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu1,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_test_z" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				    (and (eq_attr "mode" "XI")
+				     (and (eq_attr "c86_attr" "ptest")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecmp_test_z_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecmp")
+				    (and (eq_attr "mode" "XI")
+				     (and (eq_attr "c86_attr" "ptest")
+					  (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+;; SSECVT
+(define_insn_reservation "c86_4g_m7_avx512_ssecvt_xy" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "c86_attr" "other")
+				    (and (eq_attr "prefix" "evex")
+				     (and (eq_attr "mode" "TI,V4SF,V2DF,OI,V8SF,V4DF")
+				      (and (not (ior (match_operand:V8DI 1 "register_operand")
+						     (match_operand:V8DF 1 "register_operand")))
+					   (eq_attr "memory" "none")))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecvt_xy_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "prefix" "evex")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (eq_attr "mode" "TI,V4SF,V2DF,OI,V8SF,V4DF")
+				      (and (not (ior (match_operand:V8DI 1 "register_operand")
+						     (match_operand:V8DF 1 "register_operand")))
+					   (eq_attr "memory" "!none")))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecvt_y_z" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "mode" "OI,V8SF,V4DF")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (ior (match_operand:V8DI 1 "register_operand")
+					       (match_operand:V8DF 1 "register_operand"))
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecvt_y_z_load" 15
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "mode" "OI,V8SF,V4DF")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (ior (match_operand:V8DI 1 "memory_operand")
+					       (match_operand:V8DF 1 "memory_operand"))
+					  (eq_attr "memory" "!none"))))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecvt_z" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "c86_attr" "other")
+				    (and (eq_attr "mode" "XI,V16SF,V8DF")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_ssecvt_z_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "c86_attr" "other")
+				    (and (eq_attr "mode" "XI,V16SF,V8DF")
+					 (eq_attr "memory" "!none")))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecvt" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "prefix" "!evex")
+				     (and (eq_attr "mmx_isa" "base")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+(define_insn_reservation "c86_4g_m7_avx_ssecvt_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "prefix" "!evex")
+				    (and (eq_attr "mmx_isa" "base")
+					 (eq_attr "memory" "!none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu2|c86-4g-m7-fpu3")
+
+;; CVTPI
+(define_insn_reservation "c86_4g_m7_sse_ssecvt_pspi" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "mode" "SF,DI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_sse_ssecvt_pspi_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "mode" "SF,DI")
+					 (eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1")
+
+(define_insn_reservation "c86_4g_m7_sse_ssecvt_pi" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				    (and (not (eq_attr "mode" "SF,DI"))
+				     (and (eq_attr "mmx_isa" "native")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu1,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_sse_ssecvt_pi_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (not (eq_attr "mode" "SF,DI"))
+				    (and (eq_attr "mmx_isa" "native")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu1,c86-4g-m7-fpu_0_1")
+
+;; SSEMULADD
+(define_insn_reservation "c86_4g_m7_avx512_muladd" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemuladd")
+				   (and (eq_attr "c86_attr" "other")
+				    (and (not (eq_attr "isa" "fma,fma4"))
+					 (eq_attr "mode" "V32HF,V16SF,V8DF,XI")
+					  (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_muladd_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemuladd")
+				   (and (eq_attr "c86_attr" "other")
+				    (and (not (eq_attr "isa" "fma,fma4"))
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_muladd_madd" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemuladd,sse")
+				   (and (eq_attr "c86_attr" "madd,rcp")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_muladd_madd_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemuladd,sse")
+				   (and (eq_attr "c86_attr" "madd,rcp")
+				    (and (eq_attr "prefix" "evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_fma_muladd" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemuladd")
+				   (and (eq_attr "isa" "fma,fma4")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_fma_muladd_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "ssemuladd")
+				   (and (eq_attr "isa" "fma,fma4")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+;; SSE
+(define_insn_reservation "c86_4g_m7_avx512_sse_range" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (eq_attr "length_immediate" "!1")
+				      (and (eq_attr "prefix" "evex")
+				       (and (eq_attr "c86_decode" "direct")
+					   (eq_attr "memory" "none")))))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_range_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (eq_attr "length_immediate" "!1")
+				      (and (eq_attr "c86_decode" "direct")
+				       (and (eq_attr "prefix" "evex")
+					    (eq_attr "memory" "load")))))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_2")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_conflict_x" 2
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_decode" "vector")
+				    (and (eq_attr "mode" "TI")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_conflict_x_load" 9
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_decode" "vector")
+				    (and (eq_attr "mode" "TI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_conflict_y" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_decode" "vector")
+				    (and (eq_attr "mode" "OI")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_conflict_y_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_decode" "vector")
+				    (and (eq_attr "mode" "OI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_conflict_z" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_decode" "vector")
+				    (and (eq_attr "mode" "XI")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_conflict_z_load" 15
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_decode" "vector")
+				    (and (eq_attr "mode" "XI")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_class" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_attr" "other")
+				    (and (eq_attr "length_immediate" "1")
+				     (and (not (eq_attr "mode" "V32HF,V16SF,V8DF"))
+					  (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu_1_3,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_class_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (eq_attr "length_immediate" "1")
+				      (and (not (eq_attr "mode" "V32HF,V16SF,V8DF"))
+					   (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-double,c86-4g-m7-load,c86-4g-m7-fpu_1_3,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_class_z" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (eq_attr "length_immediate" "1")
+				      (and (eq_attr "mode" "V32HF,V16SF,V8DF")
+					   (eq_attr "memory" "none"))))))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_class_z_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				    (and (eq_attr "c86_attr" "other")
+				     (and (eq_attr "length_immediate" "1")
+				      (and (eq_attr "mode" "V32HF,V16SF,V8DF")
+					   (eq_attr "memory" "load"))))))
+			 "c86-4g-m7-vector,c86-4g-m7-load")
+
+(define_insn_reservation "c86_4g_m7_avx_sse" 5
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_attr" "rcp,other")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "none")))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx_sse_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_attr" "rcp,other")
+				    (and (eq_attr "prefix" "!evex")
+					 (eq_attr "memory" "load")))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu_0_1")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_sqrt" 16
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_attr" "sqrt")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu1*7|c86-4g-m7-fpu3*7")
+
+(define_insn_reservation "c86_4g_m7_avx512_sse_sqrt_load" 23
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "c86_attr" "sqrt")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load,c86-4g-m7-fpu1*7|c86-4g-m7-fpu3*7")
+
+;; MSKLOG/MSKMOV
+(define_insn_reservation "c86_4g_m7_avx512_msklog" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "msklog")
+				   (eq_attr "c86_decode" "direct")))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_msklog_vector" 4
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "msklog")
+				   (eq_attr "c86_decode" "vector")))
+			 "c86-4g-m7-vector")
+
+(define_insn_reservation "c86_4g_m7_avx512_mskmov_reg_k" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mskmov")
+				  (and (match_operand 0 "register_operand" "r")
+				       (eq_attr "memory" "none"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu3,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_mskmov_xy_k" 2
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mskmov")
+				   (ior (match_operand:V2DI 0 "register_operand" "v")
+					(match_operand:V4DI 0 "register_operand" "v"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu3,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_mskmov_z_k" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mskmov")
+				   (match_operand:V8DI 0 "register_operand" "v")))
+			 "c86-4g-m7-vector,c86-4g-m7-fpu3*2,c86-4g-m7-fpu1*2|c86-4g-m7-fpu3*2")
+
+(define_insn_reservation "c86_4g_m7_avx512_mskmov_k_k" 1
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mskmov")
+				  (and (match_operand 0 "register_operand" "k")
+				       (match_operand 1 "register_operand" "k"))))
+			 "c86-4g-m7-direct,c86-4g-m7-fpu_1_3")
+
+(define_insn_reservation "c86_4g_m7_avx512_mskmov_k_reg" 3
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mskmov")
+				  (and (match_operand 0 "register_operand" "k")
+				       (match_operand 1 "register_operand" "r"))))
+			 "c86-4g-m7-double,c86-4g-m7-fpu1*2,c86-4g-m7-fpu1*2|c86-4g-m7-fpu3*2")
+
+(define_insn_reservation "c86_4g_m7_avx512_mskmov_k_m" 8
+			 (and (eq_attr "cpu" "c86_4g_m7")
+			      (and (eq_attr "type" "mskmov")
+				  (and (match_operand 0 "register_operand" "k")
+				       (match_operand 1 "memory_operand"))))
+			 "c86-4g-m7-direct,c86-4g-m7-load")
diff --git a/gcc/config/i386/c86-4g.md b/gcc/config/i386/c86-4g.md
new file mode 100644
index 000000000000..66c4e2cf744f
--- /dev/null
+++ b/gcc/config/i386/c86-4g.md
@@ -0,0 +1,1204 @@
+;; Copyright (C) 2026 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; <http://www.gnu.org/licenses/>.
+;;
+
+
+(define_attr "c86_decode" "direct,vector,double"
+  (const_string "direct"))
+
+(define_attr "c86_attr" "other,abs,sqrt,maxmin,blend,blendv,rcp,movnt,avg,
+			       sign,sadbw,insr,perm2,perm,insertx,shufx,madd,
+			       compress,sselogic,cmpestr,extr,vpmovx,expand,aes,
+			       hplus,ptest"
+  (const_string "other"))
+
+;; HYGON Scheduling
+;; Modeling automatons for decoders, integer execution pipes,
+;; AGU pipes and floating point execution units.
+(define_automaton "c86_4g, c86_4g_ieu, c86_4g_fp, c86_4g_agu")
+
+;; Decoders unit has 4 decoders and all of them can decode fast path
+;; and vector type instructions.
+(define_cpu_unit "c86-4g-decode0" "c86_4g")
+(define_cpu_unit "c86-4g-decode1" "c86_4g")
+(define_cpu_unit "c86-4g-decode2" "c86_4g")
+(define_cpu_unit "c86-4g-decode3" "c86_4g")
+
+;; Currently blocking all decoders for vector path instructions as
+;; they are dispatched separetely as microcode sequence.
+;; Fix me: Need to revisit this.
+(define_reservation "c86-4g-vector" "c86-4g-decode0+c86-4g-decode1+c86-4g-decode2+c86-4g-decode3")
+
+;; Direct instructions can be issued to any of the four decoders.
+(define_reservation "c86-4g-direct" "c86-4g-decode0|c86-4g-decode1|c86-4g-decode2|c86-4g-decode3")
+
+;; Fix me: Need to revisit this later to simulate fast path double behavior.
+(define_reservation "c86-4g-double" "c86-4g-direct")
+
+
+;; Integer unit 4 ALU pipes.
+(define_cpu_unit "c86-4g-ieu0" "c86_4g_ieu")
+(define_cpu_unit "c86-4g-ieu1" "c86_4g_ieu")
+(define_cpu_unit "c86-4g-ieu2" "c86_4g_ieu")
+(define_cpu_unit "c86-4g-ieu3" "c86_4g_ieu")
+(define_reservation "c86-4g-ieu" "c86-4g-ieu0|c86-4g-ieu1|c86-4g-ieu2|c86-4g-ieu3")
+
+;; 2 AGU pipes in c86_4g
+;; According to CPU diagram last AGU unit is used only for stores.
+(define_cpu_unit "c86-4g-agu0" "c86_4g_agu")
+(define_cpu_unit "c86-4g-agu1" "c86_4g_agu")
+(define_reservation "c86-4g-agu-reserve" "c86-4g-agu0|c86-4g-agu1")
+
+;; Load is 4 cycles.  We do not model reservation of load unit.
+;;(define_reservation "c86-4g-load" "c86-4g-agu-reserve, nothing, nothing, nothing")
+(define_reservation "c86-4g-load" "c86-4g-agu-reserve")
+(define_reservation "c86-4g-store" "c86-4g-agu-reserve")
+
+;; vectorpath (microcoded) instructions are single issue instructions.
+;; So, they occupy all the integer units.
+(define_reservation "c86-4g-ivector" "c86-4g-ieu0+c86-4g-ieu1
+				      +c86-4g-ieu2+c86-4g-ieu3
+				      +c86-4g-agu0+c86-4g-agu1")
+
+;; Floating point unit 4 FP pipes.
+(define_cpu_unit "c86-4g-fp0" "c86_4g_fp")
+(define_cpu_unit "c86-4g-fp1" "c86_4g_fp")
+(define_cpu_unit "c86-4g-fp2" "c86_4g_fp")
+(define_cpu_unit "c86-4g-fp3" "c86_4g_fp")
+
+(define_reservation "c86-4g-fpu" "c86-4g-fp0|c86-4g-fp1|c86-4g-fp2|c86-4g-fp3")
+
+(define_reservation "c86-4g-fvector" "c86-4g-fp0+c86-4g-fp1
+				      +c86-4g-fp2+c86-4g-fp3
+				      +c86-4g-agu0+c86-4g-agu1")
+
+;; Call instruction
+(define_insn_reservation "c86_4g_call" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (eq_attr "type" "call,callv"))
+			 "c86-4g-double,c86-4g-store,c86-4g-ieu0+c86-4g-ieu3")
+
+;; General instructions
+(define_insn_reservation "c86_4g_push" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "push")
+				   (eq_attr "memory" "store")))
+			 "c86-4g-direct,c86-4g-store")
+
+(define_insn_reservation "c86_4g_push_load" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "push")
+				   (eq_attr "memory" "both")))
+			 "c86-4g-direct,c86-4g-load+c86-4g-store")
+
+(define_insn_reservation "c86_4g_pop" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "pop")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load")
+
+(define_insn_reservation "c86_4g_pop_mem" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "pop")
+				   (eq_attr "memory" "both")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-store")
+
+;; Leave
+(define_insn_reservation "c86_4g_leave" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (eq_attr "type" "leave"))
+			 "c86-4g-double,c86-4g-ieu+c86-4g-store")
+
+;; Integer Instructions or General instructions
+;; Multiplications
+;; Reg operands
+(define_insn_reservation "c86_4g_imul" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "imul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-ieu1")
+
+(define_insn_reservation "c86_4g_imul_mem" 7
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "imul")
+				   (eq_attr "memory" "!none")))
+			 "c86-4g-direct,c86-4g-load, c86-4g-ieu1")
+
+;; Divisions
+;; Reg operands
+(define_insn_reservation "c86_4g_idiv_DI" 41
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "DI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-ieu2*41")
+
+(define_insn_reservation "c86_4g_idiv_SI" 25
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "SI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-ieu2*25")
+
+(define_insn_reservation "c86_4g_idiv_HI" 17
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "HI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-ieu2*17")
+
+(define_insn_reservation "c86_4g_idiv_QI" 15
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "QI")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-ieu2*15")
+
+;; Mem operands
+(define_insn_reservation "c86_4g_idiv_mem_DI" 45
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "DI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-ieu2*41")
+
+(define_insn_reservation "c86_4g_idiv_mem_SI" 29
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "SI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-ieu2*25")
+
+(define_insn_reservation "c86_4g_idiv_mem_HI" 21
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "HI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-ieu2*17")
+
+(define_insn_reservation "c86_4g_idiv_mem_QI" 19
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "idiv")
+				   (and (eq_attr "mode" "QI")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-ieu2*15")
+
+;; STR ISHIFT which are micro coded.
+;; Fix me: Latency need to be rechecked.
+(define_insn_reservation "c86_4g_str_ishift" 6
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "str,ishift")
+				   (eq_attr "memory" "both,store")))
+			 "c86-4g-vector,c86-4g-ivector")
+
+;; MOV - integer moves
+(define_insn_reservation "c86_4g_load_imov_double" 2
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "imovx")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-ieu")
+
+(define_insn_reservation "c86_4g_load_imov_direct" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "!double")
+				   (and (eq_attr "type" "imov,imovx")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-ieu")
+
+(define_insn_reservation "c86_4g_load_imov_double_store" 2
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "imovx")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-double,c86-4g-ieu,c86-4g-store")
+
+(define_insn_reservation "c86_4g_load_imov_direct_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "!double")
+				   (and (eq_attr "type" "imov,imovx")
+					(eq_attr "memory" "store"))))
+				   "c86-4g-direct,c86-4g-ieu,c86-4g-store")
+
+(define_insn_reservation "c86_4g_load_imov_double_load" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "imovx")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-ieu")
+
+(define_insn_reservation "c86_4g_load_imov_direct_load" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "!double")
+				   (and (eq_attr "type" "imov,imovx")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load")
+
+;; INTEGER/GENERAL instructions
+;; register/imm operands only: ALU, ICMP, NEG, NOT, ROTATE, ISHIFT, TEST
+(define_insn_reservation "c86_4g_insn" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift,ishift1,test,setcc,incdec,icmov")
+				   (eq_attr "memory" "none,unknown")))
+			 "c86-4g-direct,c86-4g-ieu")
+
+(define_insn_reservation "c86_4g_insn_load" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift,ishift1,test,setcc,incdec,icmov")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-ieu")
+
+;; FIXME: The instructions matched here has only two operands, which means memory type can only be none, load or both.
+;; Store memory type handling should never take effect here?
+(define_insn_reservation "c86_4g_insn_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift1,test,setcc,incdec")
+				   (eq_attr "memory" "store")))
+			 "c86-4g-direct,c86-4g-ieu,c86-4g-store")
+
+(define_insn_reservation "c86_4g_insn_both" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "alu,icmp,negnot,rotate,rotate1,ishift1,test,setcc,incdec")
+				   (eq_attr "memory" "both")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-ieu,c86-4g-store")
+
+;; Special latency for multi type.
+(define_insn_reservation "c86_4g_fp_fcomp" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "memory" "none")
+				   (and (eq_attr "unit" "i387")
+					(eq_attr "type" "multi"))))
+			 "c86-4g-double,c86-4g-fp0|c86-4g-fp2")
+
+;; Fix me: Other vector type insns keeping latency 6 as of now.
+(define_insn_reservation "c86_4g_ieu_vector" 6
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "memory" "none")
+				   (and (eq_attr "unit" "!i387")
+					(eq_attr "type" "other,str,multi"))))
+			 "c86-4g-vector,c86-4g-ivector")
+
+;; ALU1 register operands.
+(define_insn_reservation "c86_4g_alu1_vector" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "vector")
+				   (and (eq_attr "type" "alu1")
+					(eq_attr "memory" "none,unknown"))))
+			 "c86-4g-vector,c86-4g-ivector")
+
+(define_insn_reservation "c86_4g_alu1_double" 2
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "alu1")
+					(eq_attr "memory" "none,unknown"))))
+			 "c86-4g-double,c86-4g-ieu")
+
+(define_insn_reservation "c86_4g_alu1_direct" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "alu1")
+					(eq_attr "memory" "none,unknown"))))
+			 "c86-4g-direct,c86-4g-ieu")
+
+;; Branches : Fix me need to model conditional branches.
+(define_insn_reservation "c86_4g_branch" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "ibr")
+					(eq_attr "memory" "none")))
+			  "c86-4g-direct")
+
+;; Indirect branches check latencies.
+(define_insn_reservation "c86_4g_indirect_branch_mem" 6
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "ibr")
+					(eq_attr "memory" "load")))
+			 "c86-4g-vector,c86-4g-ivector")
+
+;; LEA executes in ALU units with 1 cycle latency.
+(define_insn_reservation "c86_4g_lea" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (eq_attr "type" "lea"))
+			 "c86-4g-direct,c86-4g-ieu")
+
+;;  Floating point
+(define_insn_reservation "c86_4g_fp_cmov" 6
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (eq_attr "type" "fcmov"))
+			 "c86-4g-vector,c86-4g-fvector")
+
+
+(define_insn_reservation "c86_4g_fp_mov_direct_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_fp_mov_direct_store" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-direct,c86-4g-fp2|c86-4g-fp3,c86-4g-store")
+
+(define_insn_reservation "c86_4g_fp_mov_double" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_fp_mov_double_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "double")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_fp_mov_direct" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fmov")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp1")
+
+;; SQRT
+(define_insn_reservation "c86_4g_fp_sqrt" 22
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fpspc")
+				   (eq_attr "c86_attr" "sqrt")))
+			 "c86-4g-direct,c86-4g-fp1*22")
+
+(define_insn_reservation "c86_4g_sse_sqrt_sf" 14
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SF,V4SF,V8SF")
+				   (and (eq_attr "memory" "none,unknown")
+					(and (eq_attr "c86_attr" "sqrt")
+					     (eq_attr "type" "sse")))))
+			 "c86-4g-direct,c86-4g-fp1*14")
+
+(define_insn_reservation "c86_4g_sse_sqrt_sf_mem" 21
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SF,V4SF,V8SF")
+				   (and (eq_attr "memory" "load")
+					(and (eq_attr "c86_attr" "sqrt")
+					     (eq_attr "type" "sse")))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1*14")
+
+(define_insn_reservation "c86_4g_sse_sqrt_df" 20
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "DF,V2DF,V4DF")
+				   (and (eq_attr "memory" "none,unknown")
+					(and (eq_attr "c86_attr" "sqrt")
+					     (eq_attr "type" "sse")))))
+			 "c86-4g-direct,c86-4g-fp1*20")
+
+(define_insn_reservation "c86_4g_sse_sqrt_df_mem" 27
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "DF,V2DF,V4DF")
+				   (and (eq_attr "memory" "load")
+					(and (eq_attr "c86_attr" "sqrt")
+					     (eq_attr "type" "sse")))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1*20")
+
+;; RCP
+(define_insn_reservation "c86_4g_sse_rcp" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V4SF,V8SF,SF")
+				   (and (eq_attr "memory" "none")
+					(and (eq_attr "c86_attr" "rcp")
+					     (eq_attr "type" "sse")))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_rcp_mem" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V4SF,V8SF,SF")
+				   (and (eq_attr "memory" "load")
+					(and (eq_attr "c86_attr" "rcp")
+					     (eq_attr "type" "sse")))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+;; TODO: AGU?
+(define_insn_reservation "c86_4g_fp_spc_direct" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_decode" "direct")
+				   (and (eq_attr "type" "fpspc")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-direct,c86-4g-fp3")
+
+;; FABS
+(define_insn_reservation "c86_4g_fp_absneg" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (eq_attr "type" "fsgn"))
+			 "c86-4g-direct,c86-4g-fp1|c86-4g-fp3")
+
+;; FCMP
+(define_insn_reservation "c86_4g_fp_fcmp" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				  (and (eq_attr "memory" "none")
+				  (and (eq_attr "c86_decode" "double")
+				       (eq_attr "type" "fcmp"))))
+			 "c86-4g-double,c86-4g-fp0,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_fp_fcmp_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "memory" "load")
+				   (and (eq_attr "c86_decode" "double")
+					(eq_attr "type" "fcmp"))))
+			 "c86-4g-double,c86-4g-load, c86-4g-fp0,c86-4g-fp1")
+
+;;FADD FSUB FMUL
+(define_insn_reservation "c86_4g_fp_op_mul" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fop,fmul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_fp_op_mul_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fop,fmul")
+				   (and (eq_attr "fp_int_src" "false")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_fp_op_imul_load" 16
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fop,fmul")
+				   (and (eq_attr "fp_int_src" "true")
+					(eq_attr "memory" "load"))))
+			"c86-4g-double,c86-4g-load,c86-4g-fp0,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_fp_op_div" 15
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fdiv")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp1*15")
+
+(define_insn_reservation "c86_4g_fp_op_div_load" 22
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fdiv")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1*15")
+
+(define_insn_reservation "c86_4g_fp_op_idiv_load" 27
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "fdiv")
+				   (and (eq_attr "fp_int_src" "true")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp1*19")
+
+;; MMX, SSE, SSEn.n, AVX, AVX2 instructions
+(define_insn_reservation "c86_4g_fp_insn" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (eq_attr "type" "mmx"))
+			 "c86-4g-direct,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_mmx_add" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxadd")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1|c86-4g-fp3")
+
+(define_insn_reservation "c86_4g_mmx_add_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxadd")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1|c86-4g-fp3")
+
+(define_insn_reservation "c86_4g_mmx_hadd" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseadd1")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_mmx_hadd_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseadd1")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_mmx_cmp" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxcmp")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp3")
+
+(define_insn_reservation "c86_4g_mmx_cmp_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxcmp")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp3")
+
+(define_insn_reservation "c86_4g_mmx_cvt_pck_shuf" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxcvt,sseshuf,sseshuf1")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_mmx_cvt_pck_shuf_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxcvt,sseshuf,sseshuf1")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_mmx_shift" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxshft")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_mmx_move" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxmov")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_mmx_shift_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxshft")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_mmx_move_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxshft")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_mmx_move_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxshft,mmxmov")
+				   (eq_attr "memory" "store,both")))
+			  "c86-4g-direct,c86-4g-fp2,c86-4g-store")
+
+(define_insn_reservation "c86_4g_mmx_mul" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxmul")
+				   (eq_attr "memory" "none")))
+			  "c86-4g-direct,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_mmx_mul_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "mmxmul")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
+
+;; sseabs
+(define_insn_reservation "c86_4g_sse_abs" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_attr" "abs")
+				   (and (eq_attr "type" "sselog1")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_sse_pinsr_reg" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insr")
+					(and (match_operand 2 "register_operand")
+					     (eq_attr "memory" "none")))))
+			 "c86-4g-direct,c86-4g-ieu2,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_pinsr" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "insr")
+					(and (not (match_operand 2 "register_operand"))
+					     (eq_attr "memory" "none")))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_log" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_log_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_sign" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sign")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_sse_sign_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "sign")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
+
+
+(define_insn_reservation "c86_4g_sse_log1" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_log1_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sselog1")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "!none"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_extrq" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "prefix_data16" "1"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_movsdup" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sse")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "prefix" "vex"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_alignr" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "prefix_extra" "1"))
+			      (and (eq_attr "type" "sseishft")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_ishift" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "prefix_extra" "!1"))
+			      (and (eq_attr "type" "sseishft")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_ishift_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "prefix_extra" "!1"))
+			      (and (eq_attr "type" "sseishft")
+				   (eq_attr "memory" "!none")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_insertimm" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseins")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "length_immediate" "2"))))
+			 "c86-4g-direct,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sse_insert" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseins")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "length_immediate" "!2"))))
+			 "c86-4g-direct,c86-4g-fpu,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sse_comi" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SF,DF,V4SF,V2DF")
+				   (and (eq_attr "prefix" "!vex")
+					(and (eq_attr "prefix_extra" "0")
+					     (and (eq_attr "type" "ssecomi")
+						  (eq_attr "memory" "none"))))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_comi_load" 12
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "SF,DF,V4SF,V2DF"))
+			      (and (eq_attr "prefix_extra" "0")
+				   (and (eq_attr "type" "ssecomi")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_comi_double" 2
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V4SF,V2DF,TI"))
+			      (and (eq_attr "prefix" "vex")
+				   (and (eq_attr "prefix_extra" "0")
+					(and (eq_attr "type" "ssecomi")
+					     (eq_attr "memory" "none")))))
+			 "c86-4g-double,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_comi_double_load" 10
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V4SF,V2DF,TI"))
+			      (and (eq_attr "prefix" "vex")
+				   (and (eq_attr "prefix_extra" "0")
+					(and (eq_attr "type" "ssecomi")
+					     (eq_attr "memory" "load")))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp0|c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_test" 4
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
+			      (and (eq_attr "prefix_extra" "1")
+				   (and (eq_attr "type" "ssecomi")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_test_load" 11
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
+			      (and (eq_attr "prefix_extra" "1")
+				   (and (eq_attr "type" "ssecomi")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_avx256_test" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V8SF,V4DF,OI"))
+			      (and (eq_attr "prefix_extra" "1")
+				   (and (eq_attr "type" "ssecomi")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_avx256_test_load" 15
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V8SF,V4DF,OI"))
+			      (and (eq_attr "prefix_extra" "1")
+				   (and (eq_attr "type" "ssecomi")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp1,c86-4g-fp1")
+
+;; SSE moves
+;; Fix me:  Need to revist this again some of the moves may be restricted
+;; to some fpu pipes.
+
+;; movnt doesn't touch cache, so latency modeling has little impact.
+(define_insn_reservation "c86_4g_sse_movnt_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_attr" "movnt")
+				   (and (eq_attr "type" "ssemov,mmxmov,ssecvt")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load")
+
+(define_insn_reservation "c86_4g_sse_movnt_store" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "c86_attr" "movnt")
+				   (and (eq_attr "type" "ssemov,mmxmov,ssecvt")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-direct,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_sse_mov" 2
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SI")
+				   (and (eq_attr "isa" "avx")
+					(and (eq_attr "type" "ssemov")
+					     (eq_attr "memory" "none")))))
+			 "c86-4g-direct,c86-4g-ieu0")
+
+(define_insn_reservation "c86_4g_avx_mov" 2
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "TI")
+				   (and (eq_attr "isa" "avx")
+					(and (eq_attr "type" "ssemov")
+					     (and (match_operand:SI 1 "register_operand")
+						  (eq_attr "memory" "none"))))))
+			 "c86-4g-direct,c86-4g-ieu2")
+
+(define_insn_reservation "c86_4g_sseavx_mov" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
+			      (and (eq_attr "prefix_extra" "0")
+				   (and (eq_attr "type" "ssemov")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_sseavx_blend" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "SF,DF,V4SF,V2DF"))
+			      (and (eq_attr "type" "ssemov,sselog1")
+				   (and (eq_attr "c86_attr" "blend,blendv")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sseavx_mov_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SF,DF,V4SF,V2DF,TI")
+				   (and (eq_attr "type" "ssemov")
+					(eq_attr "memory" "store"))))
+			"c86-4g-direct,c86-4g-fpu,c86-4g-store")
+
+(define_insn_reservation "c86_4g_sseavx_mov_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "SF,DF,V4SF,V2DF,TI"))
+			       (and (eq_attr "type" "ssemov")
+				    (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_avx256_mov" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF,V4DF,OI")
+				   (and (eq_attr "type" "ssemov")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_avx256_mov_store" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF,V4DF,OI")
+				   (and (eq_attr "type" "ssemov")
+					(eq_attr "memory" "store"))))
+			 "c86-4g-double,c86-4g-fpu,c86-4g-store")
+
+(define_insn_reservation "c86_4g_avx256_mov_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF,V4DF,OI")
+				   (and (eq_attr "type" "ssemov")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fpu")
+
+;; SSE max & min
+(define_insn_reservation "c86_4g_sse_maxmin" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "SF,DF,V4SF,V8SF,V2DF,V4DF,TI"))
+			      (and (eq_attr "type" "sseadd")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "c86_attr" "maxmin"))))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_maxmin_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "SF,DF,V4SF,V8SF,V2DF,V4DF,TI"))
+			      (and (eq_attr "type" "sseadd")
+				   (and (eq_attr "memory" "load")
+					(eq_attr "c86_attr" "maxmin"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_pmaxmin" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "TI,OI"))
+			      (and (eq_attr "type" "mmxadd,sseiadd")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "c86_attr" "maxmin"))))
+			 "c86-4g-direct,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_sse_pmaxmin_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "TI,OI"))
+			      (and (eq_attr "type" "mmxadd,sseiadd")
+				   (and (eq_attr "memory" "load")
+					(eq_attr "c86_attr" "maxmin"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
+
+;; SSE avg
+(define_insn_reservation "c86_4g_sse_avg" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "c86_attr" "avg"))
+			      (and (eq_attr "type" "sseiadd,mmxshft")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_sse_avg_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "c86_attr" "avg"))
+			      (and (eq_attr "type" "sseiadd,mmxshft")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp3")
+
+;;MMX sadbw
+(define_insn_reservation "c86_4g_sse_sadbw" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseiadd,mmxshft")
+				   (and (eq_attr "c86_attr" "sadbw")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sse_sadbw_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseiadd,mmxshft")
+				   (and (eq_attr "c86_attr" "sadbw")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
+
+;; SSE add
+(define_insn_reservation "c86_4g_sse_add" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseadd")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "c86_attr" "other"))))
+			 "c86-4g-direct,c86-4g-fp1|c86-4g-fp3")
+
+(define_insn_reservation "c86_4g_sse_add_load" 10
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseadd")
+				   (and (eq_attr "memory" "load")
+					(eq_attr "c86_attr" "!maxmin"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1|c86-4g-fp3")
+
+(define_insn_reservation "c86_4g_sse_fma" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "ssemuladd")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_fma_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "ssemuladd")
+				   (eq_attr "memory" "load")))
+			"c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_iadd" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseiadd")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fpu")
+
+(define_insn_reservation "c86_4g_sse_iadd_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "sseiadd")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
+
+;; SSE conversions.
+(define_insn_reservation "c86_4g_ssecvtsf_si_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SI")
+				   (and (eq_attr "type" "sseicvt")
+					(and (match_operand:SF 1 "memory_operand")
+					     (eq_attr "memory" "load")))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp3,c86-4g-ieu0")
+
+(define_insn_reservation "c86_4g_ssecvtdf_si" 5
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SI")
+				   (and (match_operand:DF 1 "register_operand")
+					(and (eq_attr "type" "sseicvt")
+					     (eq_attr "memory" "none")))))
+			 "c86-4g-double,c86-4g-fp3,c86-4g-ieu0")
+
+(define_insn_reservation "c86_4g_ssecvtdf_si_load" 12
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "SI")
+				   (and (eq_attr "type" "sseicvt")
+					(and (match_operand:DF 1 "memory_operand")
+					     (eq_attr "memory" "load")))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp3,c86-4g-ieu0")
+
+;; All other used ssecvt fp3 pipes
+;; Check: Need to revisit this again.
+;; Some SSE converts may use different pipe combinations.
+(define_insn_reservation "c86_4g_ssecvt" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-direct,c86-4g-fp1")
+
+(define_insn_reservation "c86_4g_ssecvt_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "type" "ssecvt")
+				   (and (eq_attr "c86_attr" "other")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1")
+
+;; SSE div
+(define_insn_reservation "c86_4g_ssediv_ss_ps" 10
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V4SF,SF"))
+			      (and (eq_attr "type" "ssediv")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp1*10")
+
+(define_insn_reservation "c86_4g_ssediv_ss_ps_load" 17
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V4SF,SF"))
+			      (and (eq_attr "type" "ssediv")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1*10")
+
+(define_insn_reservation "c86_4g_ssediv_sd_pd" 13
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "V2DF,DF"))
+			      (and (eq_attr "type" "ssediv")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp1*13")
+
+(define_insn_reservation "c86_4g_ssediv_sd_pd_load" 20
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					       (eq_attr "mode" "V2DF,DF"))
+			      (and (eq_attr "type" "ssediv")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp1*13")
+
+
+(define_insn_reservation "c86_4g_ssediv_avx256_ps" 10
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "type" "ssediv"))))
+			 "c86-4g-double,c86-4g-fp1*10")
+
+(define_insn_reservation "c86_4g_ssediv_avx256_ps_load" 17
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF")
+				   (and (eq_attr "type" "ssediv")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp1*10")
+
+(define_insn_reservation "c86_4g_ssediv_avx256_pd" 13
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V4DF")
+				   (and (eq_attr "type" "ssediv")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-fp1*13")
+
+(define_insn_reservation "c86_4g_ssediv_avx256_pd_load" 20
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V4DF")
+				   (and (eq_attr "type" "ssediv")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp1*13")
+;; SSE MUL
+(define_insn_reservation "c86_4g_ssemul_ss_ps" 3
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "V8SF,V4SF,SF"))
+			      (and (eq_attr "type" "ssemul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_ssemul_ss_ps_load" 10
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "V8SF,V4SF,SF"))
+			      (and (eq_attr "type" "ssemul")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_ssemul_sd_pd" 4
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "V4DF,V2DF,DF"))
+			      (and (eq_attr "type" "ssemul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_ssemul_sd_pd_load" 11
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "V4DF,V2DF,DF"))
+			      (and (eq_attr "type" "ssemul")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+;;SSE imul
+(define_insn_reservation "c86_4g_sseimul" 3
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "TI"))
+			      (and (eq_attr "type" "sseimul")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sseimul_avx256" 4
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "OI")
+				   (and (eq_attr "type" "sseimul")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sseimul_load" 10
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "TI"))
+			      (and (eq_attr "type" "sseimul")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sseimul_avx256_load" 11
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "OI")
+				   (and (eq_attr "type" "sseimul")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sseimul_di" 3
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "DI")
+				   (and (eq_attr "memory" "none")
+					(eq_attr "type" "sseimul"))))
+			 "c86-4g-direct,c86-4g-fp0")
+
+(define_insn_reservation "c86_4g_sseimul_load_di" 10
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "DI")
+				   (and (eq_attr "type" "sseimul")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0")
+
+;; SSE compares
+(define_insn_reservation "c86_4g_sse_cmp" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					(eq_attr "mode" "SF,DF,V4SF,V2DF"))
+			       (and (eq_attr "type" "ssecmp")
+				    (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_cmp_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+					 (eq_attr "mode" "SF,DF,V4SF,V2DF"))
+			      (and (eq_attr "type" "ssecmp")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+
+(define_insn_reservation "c86_4g_sse_cmp_avx256" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF,V4DF")
+				   (and (eq_attr "type" "ssecmp")
+					(eq_attr "memory" "none"))))
+			"c86-4g-double,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_cmp_avx256_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "V8SF,V4DF")
+				   (and (eq_attr "type" "ssecmp")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fp0|c86-4g-fp2")
+
+(define_insn_reservation "c86_4g_sse_icmp" 1
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "QI,HI,SI,DI,TI"))
+			      (and (eq_attr "type" "ssecmp")
+				   (eq_attr "memory" "none")))
+			 "c86-4g-direct,c86-4g-fpu")
+
+
+(define_insn_reservation "c86_4g_sse_icmp_load" 8
+			 (and (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+				   (eq_attr "mode" "QI,HI,SI,DI,TI"))
+			      (and (eq_attr "type" "ssecmp")
+				   (eq_attr "memory" "load")))
+			 "c86-4g-direct,c86-4g-load,c86-4g-fpu")
+
+
+(define_insn_reservation "c86_4g_sse_icmp_avx256" 1
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "OI")
+				   (and (eq_attr "type" "ssecmp")
+					(eq_attr "memory" "none"))))
+			 "c86-4g-double,c86-4g-fpu")
+
+
+(define_insn_reservation "c86_4g_sse_icmp_avx256_load" 8
+			 (and (eq_attr "cpu" "c86_4g_m4,c86_4g_m6")
+			      (and (eq_attr "mode" "OI")
+				   (and (eq_attr "type" "ssecmp")
+					(eq_attr "memory" "load"))))
+			 "c86-4g-double,c86-4g-load,c86-4g-fpu")
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index f493360b1e83..c48556afa6e0 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -235,6 +235,10 @@
 #define signature_SHANGHAI_ecx	0x20206961
 #define signature_SHANGHAI_edx	0x68676e61
 
+#define signature_HYGON_ebx	0x6f677948
+#define signature_HYGON_ecx	0x656e6975
+#define signature_HYGON_edx	0x6e65476e
+
 #ifndef __x86_64__
 /* At least one cpu (Winchip 2) does not set %ebx and %ecx
    for cpuid leaf 1. Forcibly zero the two registers before
diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc
index 1d0ad950a9ad..cd6a25e87ced 100644
--- a/gcc/config/i386/driver-i386.cc
+++ b/gcc/config/i386/driver-i386.cc
@@ -501,6 +501,16 @@ const char *host_detect_local_cpu (int argc, const char **argv)
       else
 	processor = PROCESSOR_PENTIUM;
     }
+  else if (vendor == VENDOR_HYGON)
+    {
+      processor = PROCESSOR_GENERIC;
+      if (model == 4)
+	processor = PROCESSOR_C86_4G_M4;
+      else if (model == 6)
+	processor = PROCESSOR_C86_4G_M6;
+      else if (model >= 7)
+	processor = PROCESSOR_C86_4G_M7;
+    }
   else if (vendor == VENDOR_CENTAUR)
     {
       processor = PROCESSOR_GENERIC;
@@ -850,6 +860,15 @@ const char *host_detect_local_cpu (int argc, const char **argv)
     case PROCESSOR_SHIJIDADAO:
       cpu = "shijidadao";
       break;
+    case PROCESSOR_C86_4G_M4:
+      cpu = "c86-4g-m4";
+      break;
+    case PROCESSOR_C86_4G_M6:
+      cpu = "c86-4g-m6";
+      break;
+    case PROCESSOR_C86_4G_M7:
+      cpu = "c86-4g-m7";
+      break;
 
     default:
       /* Use something reasonable.  */
diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc
index 15e82956d0da..bf686c359e5c 100644
--- a/gcc/config/i386/i386-c.cc
+++ b/gcc/config/i386/i386-c.cc
@@ -303,7 +303,18 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
       def_or_undef (parse_in, "__novalake");
       def_or_undef (parse_in, "__novalake__");
       break;
-
+    case PROCESSOR_C86_4G_M4:
+      def_or_undef (parse_in, "__c86_4g_m4");
+      def_or_undef (parse_in, "__c86_4g_m4__");
+      break;
+    case PROCESSOR_C86_4G_M6:
+      def_or_undef (parse_in, "__c86_4g_m6");
+      def_or_undef (parse_in, "__c86_4g_m6__");
+      break;
+    case PROCESSOR_C86_4G_M7:
+      def_or_undef (parse_in, "__c86_4g_m7");
+      def_or_undef (parse_in, "__c86_4g_m7__");
+      break;
     /* use PROCESSOR_max to not set/unset the arch macro.  */
     case PROCESSOR_max:
       break;
@@ -512,6 +523,15 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
     case PROCESSOR_NOVALAKE:
       def_or_undef (parse_in, "__tune_novalake__");
       break;
+    case PROCESSOR_C86_4G_M4:
+      def_or_undef (parse_in, "__tune_c86_4g_m4__");
+      break;
+    case PROCESSOR_C86_4G_M6:
+      def_or_undef (parse_in, "__tune_c86_4g_m6__");
+      break;
+    case PROCESSOR_C86_4G_M7:
+      def_or_undef (parse_in, "__tune_c86_4g_m7__");
+      break;
     case PROCESSOR_INTEL:
     case PROCESSOR_GENERIC:
       break;
diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 7459cde4ba8b..7ffe9cd2a38c 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -185,6 +185,10 @@ along with GCC; see the file COPYING3.  If not see
 #define m_ZNVER (m_ZNVER1 | m_ZNVER2 | m_ZNVER3 | m_ZNVER4 | m_ZNVER5 | m_ZNVER6)
 #define m_AMD_MULTIPLE (m_ATHLON_K8 | m_AMDFAM10 | m_BDVER | m_BTVER \
 			| m_ZNVER)
+#define m_C86_4G_M4 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M4)
+#define m_C86_4G_M6 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M6)
+#define m_C86_4G_M7 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M7)
+#define m_C86_4G (m_C86_4G_M4 | m_C86_4G_M6 | m_C86_4G_M7)
 
 #define m_GENERIC (HOST_WIDE_INT_1U<<PROCESSOR_GENERIC)
 
@@ -814,7 +818,10 @@ static const struct processor_costs *processor_cost_table[] =
   &znver3_cost,		/* PROCESSOR_ZNVER3.		*/
   &znver4_cost,		/* PROCESSOR_ZNVER4.		*/
   &znver5_cost,		/* PROCESSOR_ZNVER5.		*/
-  &znver5_cost		/* PROCESSOR_ZNVER6.		*/
+  &znver5_cost,		/* PROCESSOR_ZNVER6.		*/
+  &c86_4g_m4_cost,	/* PROCESSOR_C86_4G_M4.		*/
+  &c86_4g_m6_cost,	/* PROCESSOR_C86_4G_M6.		*/
+  &c86_4g_m7_cost	/* PROCESSOR_C86_4G_M7.		*/
 };
 
 /* Guarantee that the array is aligned with enum processor_type.  */
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 660a921e28f9..1974f05a0344 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -25829,7 +25829,10 @@ ix86_reassociation_width (unsigned int op, machine_mode mode)
       /* Znver1-4 Integer vector instructions execute in FP unit
 	 and can execute 3 additions and one multiplication per cycle.  */
       if ((ix86_tune == PROCESSOR_ZNVER1 || ix86_tune == PROCESSOR_ZNVER2
-	   || ix86_tune == PROCESSOR_ZNVER3 || ix86_tune == PROCESSOR_ZNVER4)
+	   || ix86_tune == PROCESSOR_ZNVER3 || ix86_tune == PROCESSOR_ZNVER4
+	   || ix86_tune == PROCESSOR_C86_4G_M4
+	   || ix86_tune == PROCESSOR_C86_4G_M6
+	   || ix86_tune == PROCESSOR_C86_4G_M7)
    	  && INTEGRAL_MODE_P (mode) && op != PLUS && op != MINUS)
 	return 1;
       /* Znver5 can do 2 integer multiplications per cycle with latency
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index d515505a21a5..e4e6faab7931 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2385,6 +2385,9 @@ enum processor_type
   PROCESSOR_ZNVER4,
   PROCESSOR_ZNVER5,
   PROCESSOR_ZNVER6,
+  PROCESSOR_C86_4G_M4,
+  PROCESSOR_C86_4G_M6,
+  PROCESSOR_C86_4G_M7,
   PROCESSOR_max
 };
 
@@ -2548,6 +2551,21 @@ constexpr wide_int_bitmask PTA_LUJIAZUI = PTA_64BIT | PTA_MMX | PTA_SSE
 constexpr wide_int_bitmask PTA_YONGFENG = PTA_LUJIAZUI | PTA_AVX | PTA_AVX2
   | PTA_F16C | PTA_FMA | PTA_SHA;
 
+constexpr wide_int_bitmask PTA_C86_4G_M4 = PTA_64BIT | PTA_MMX | PTA_SSE
+  | PTA_SSE2 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3
+  | PTA_SSE4_1 | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_AVX2
+  | PTA_BMI | PTA_BMI2 | PTA_F16C | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE
+  | PTA_XSAVEOPT | PTA_FSGSBASE | PTA_RDRND | PTA_MOVBE | PTA_MWAITX | PTA_ADX
+  | PTA_RDSEED | PTA_CLZERO | PTA_CLFLUSHOPT | PTA_XSAVEC | PTA_XSAVES
+  | PTA_SHA | PTA_LZCNT | PTA_POPCNT;
+constexpr wide_int_bitmask PTA_C86_4G_M6 = PTA_C86_4G_M4;
+constexpr wide_int_bitmask PTA_C86_4G_M7 = PTA_C86_4G_M4 | PTA_AVX512F
+  | PTA_AVX512DQ | PTA_AVX512IFMA | PTA_AVX512CD | PTA_AVX512BW | PTA_AVX512VL
+  | PTA_AVX512BF16 | PTA_AVX512VBMI | PTA_AVX512VBMI2 | PTA_GFNI
+  | PTA_AVX512VNNI | PTA_AVX512BITALG | PTA_AVX512VPOPCNTDQ
+  | PTA_AVX512VP2INTERSECT | PTA_VAES | PTA_AVXVNNI | PTA_VPCLMULQDQ
+  | PTA_WBNOINVD | PTA_CLWB;
+
 #ifndef GENERATOR_FILE
 
 #include "insn-attr-common.h"
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index e446e02eb3c1..2109320595e2 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -530,7 +530,7 @@
 (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,nehalem,
 		    atom,slm,glm,haswell,generic,lujiazui,yongfeng,amdfam10,bdver1,
 		    bdver2,bdver3,bdver4,btver2,znver1,znver2,znver3,znver4,
-		    znver5,znver6"
+		    znver5,znver6,c86_4g_m4,c86_4g_m6,c86_4g_m7"
   (const (symbol_ref "ix86_schedule")))
 
 ;; A basic instruction type.  Refinements due to arguments to be
@@ -1427,6 +1427,8 @@
 (include "haswell.md")
 (include "lujiazui.md")
 (include "yongfeng.md")
+(include "c86-4g.md")
+(include "c86-4g-m7.md")
 
 

 ;; Operand and operator predicates and constraints
@@ -2038,6 +2040,7 @@
    (set_attr "athlon_decode" "vector")
    (set_attr "amdfam10_decode" "direct")
    (set_attr "bdver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "znver1_decode" "double")])
 
 (define_insn "*cmpx<unord><MODEF:mode>"
@@ -2091,6 +2094,7 @@
    (set_attr "amdfam10_decode" "direct")
    (set_attr "bdver1_decode" "double")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set (attr "enabled")
      (if_then_else
        (match_test ("SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH"))
@@ -2482,6 +2486,7 @@
     }
 }
   [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
+   (set_attr "c86_attr" "sselogic,sselogic,*,*")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -2506,6 +2511,7 @@
 }
   [(set_attr "isa" "*,avx2,*,*")
    (set_attr "type" "sselog1,sselog1,ssemov,ssemov")
+   (set_attr "c86_attr" "sselogic,sselogic,*,*")
    (set_attr "prefix" "vex")
    (set_attr "mode" "OI")])
 
@@ -2548,6 +2554,10 @@
 	      (const_string "sselog1")
 	   ]
 	   (const_string "ssemov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "2,3")
+       (const_string "sselogic")
+       (const_string "*")))
    (set (attr "prefix")
      (if_then_else (eq_attr "type" "sselog1,ssemov")
        (const_string "maybe_vex")
@@ -2691,6 +2701,10 @@
 	      (const_string "lea")
 	   ]
 	   (const_string "imov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "12")
+       (const_string "sselogic")
+       (const_string "*")))
    (set (attr "modrm")
      (if_then_else
        (and (eq_attr "alternative" "4") (eq_attr "type" "imov"))
@@ -2911,6 +2925,10 @@
 	      (const_string "lea")
 	   ]
 	   (const_string "imov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "8")
+       (const_string "sselogic")
+       (const_string "*")))
    (set (attr "prefix")
      (if_then_else (eq_attr "type" "sselog1,ssemov")
        (const_string "maybe_vex")
@@ -3085,6 +3103,10 @@
 	      (const_string "imovx")
 	   ]
 	   (const_string "imov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "11")
+       (const_string "sselogic")
+       (const_string "*")))
    (set (attr "prefix")
 	(cond [(eq_attr "alternative" "4,5,6,7,8")
 		 (const_string "vex")
@@ -3366,6 +3388,7 @@
    (set_attr "pent_pair" "np")
    (set_attr "athlon_decode" "vector")
    (set_attr "amdfam10_decode" "double")
+   (set_attr "c86_decode" "vector")
    (set_attr "bdver1_decode" "double")])
 
 (define_insn "*swap<mode>"
@@ -3391,6 +3414,7 @@
    (set_attr "pent_pair" "np")
    (set_attr "athlon_decode" "vector")
    (set_attr "amdfam10_decode" "double")
+   (set_attr "c86_decode" "vector")
    (set_attr "bdver1_decode" "double")])
 
 (define_peephole2
@@ -4068,6 +4092,7 @@
 }
   [(set_attr "isa" "*,*,*,x64,x64")
    (set_attr "type" "sselog1,ssemov,ssemov,multi,multi")
+   (set_attr "c86_attr" "sselogic,*,*,*,*")
    (set (attr "prefix")
      (if_then_else (eq_attr "type" "sselog1,ssemov")
        (const_string "maybe_vex")
@@ -4239,6 +4264,10 @@
 		 (const_string "sselog1")
 	      ]
 	      (const_string "ssemov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "12,16")
+       (const_string "sselogic")
+       (const_string "*")))
    (set (attr "modrm")
      (if_then_else (eq_attr "alternative" "11")
        (const_string "0")
@@ -4411,6 +4440,10 @@
 		 (const_string "mmxmov")
 	      ]
 	      (const_string "ssemov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "5")
+       (const_string "sselogic")
+       (const_string "*")))
    (set (attr "prefix")
      (if_then_else (eq_attr "type" "sselog1,ssemov")
        (const_string "maybe_vex")
@@ -4759,6 +4792,10 @@
 	      (const_string "mskmov")
 	   ]
 	   (const_string "imovx")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "10,11")
+       (const_string "vpmovx")
+       (const_string "*")))
    (set (attr "prefix_extra")
      (if_then_else (eq_attr "alternative" "10,11")
        (const_string "1")
@@ -5168,6 +5205,10 @@
      (if_then_else (eq_attr "prefix_0f" "0")
 	(const_string "double")
 	(const_string "direct")))
+   (set (attr "c86_decode")
+     (if_then_else (eq_attr "prefix_0f" "0")
+	(const_string "double")
+	(const_string "direct")))
    (set (attr "modrm")
      (if_then_else (eq_attr "prefix_0f" "0")
 	(const_string "0")
@@ -6075,6 +6116,7 @@
   [(set_attr "type" "fmov")
    (set_attr "mode" "<MODE>")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "fp_int_src" "true")])
 
 (define_insn "float<SWI48x:mode>xf2"
@@ -6085,6 +6127,7 @@
   [(set_attr "type" "fmov")
    (set_attr "mode" "XF")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "fp_int_src" "true")])
 
 (define_expand "float<SWI48x:mode><MODEF:mode>2"
@@ -6119,6 +6162,7 @@
    (set_attr "amdfam10_decode" "*,vector,double")
    (set_attr "bdver1_decode" "*,double,direct")
    (set_attr "znver1_decode" "double,*,*")
+   (set_attr "c86_decode" "double,*,*")
    (set_attr "fp_int_src" "true")
    (set (attr "enabled")
      (if_then_else
@@ -6157,6 +6201,7 @@
   [(set_attr "type" "fmov")
    (set_attr "mode" "<MODEF:MODE>")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "fp_int_src" "true")])
 
 ;; Try TARGET_USE_VECTOR_CONVERTS, but not so hard as to require extra memory
@@ -12930,6 +12975,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "DI")])
 
 ;; Turn *anddi_1 into *andsi_1_zext if possible.
@@ -13965,6 +14011,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "DI")])
 
 (define_insn_and_split "*xordi_1_btc"
@@ -13989,6 +14036,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "DI")])
 
 ;; Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b & mask)
@@ -19168,6 +19216,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "<MODE>")])
 
 ;; Avoid useless masking of count operand.
@@ -19236,6 +19285,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "<MODE>")])
 
 ;; Avoid useless masking of count operand.
@@ -19377,6 +19427,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "DI")])
 
 (define_insn "*btrq_imm"
@@ -19390,6 +19441,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "DI")])
 
 (define_insn "*btcq_imm"
@@ -19403,6 +19455,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "DI")])
 
 ;; Allow Nocona to avoid these instructions if a register is available.
@@ -21382,6 +21435,7 @@
    (set_attr "prefix_0f" "1")
    (set_attr "prefix_rep" "1")
    (set_attr "btver2_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "<MODE>")])
 
 ; False dependency happens when destination is only updated by tzcnt,
@@ -21401,6 +21455,7 @@
    (set_attr "prefix_0f" "1")
    (set_attr "prefix_rep" "1")
    (set_attr "btver2_decode" "double")
+   (set_attr "c86_decode" "double")
    (set_attr "mode" "<MODE>")])
 
 (define_insn "*bsf<mode>_1"
@@ -21415,6 +21470,7 @@
    (set_attr "prefix_0f" "1")
    (set_attr "btver2_decode" "double")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "<MODE>")])
 
 (define_insn_and_split "ctz<mode>2"
@@ -21477,6 +21533,7 @@
     gcc_unreachable ();
 }
   [(set_attr "type" "alu1")
+   (set_attr "c86_decode" "double")
    (set_attr "prefix_0f" "1")
    (set_attr "prefix_rep" "1")
    (set_attr "mode" "<MODE>")])
@@ -21502,6 +21559,7 @@
      (clobber (reg:CC FLAGS_REG))])]
   "ix86_expand_clear (operands[0]);"
   [(set_attr "type" "alu1")
+   (set_attr "c86_decode" "double")
    (set_attr "prefix_0f" "1")
    (set_attr "prefix_rep" "1")
    (set_attr "mode" "SI")])
@@ -21522,6 +21580,7 @@
   "TARGET_BMI && TARGET_64BIT"
   "tzcnt{l}\t{%1, %k0|%k0, %1}"
   [(set_attr "type" "alu1")
+   (set_attr "c86_decode" "double")
    (set_attr "prefix_0f" "1")
    (set_attr "prefix_rep" "1")
    (set_attr "mode" "SI")])
@@ -21599,6 +21658,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "DI")])
 
 (define_insn "bsr_rex64_1"
@@ -21611,6 +21671,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "DI")])
 
 (define_insn "bsr_rex64_1_zext"
@@ -21626,6 +21687,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "DI")])
 
 (define_insn "bsr"
@@ -21640,6 +21702,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "SI")])
 
 (define_insn "bsr_1"
@@ -21652,6 +21715,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "SI")])
 
 (define_insn "bsr_zext_1"
@@ -21666,6 +21730,7 @@
   [(set_attr "type" "alu1")
    (set_attr "prefix_0f" "1")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "SI")])
 
 ; As bsr is undefined behavior on zero and for other input
@@ -22983,6 +23048,7 @@
    (set_attr "pent_pair" "np,*,*")
    (set_attr "athlon_decode" "vector,*,*")
    (set_attr "amdfam10_decode" "double,*,*")
+   (set_attr "c86_decode" "vector,*,*")
    (set_attr "bdver1_decode" "double,*,*")
    (set_attr "mode" "QI,HI,HI")])
 
@@ -22995,6 +23061,7 @@
    (set_attr "pent_pair" "np")
    (set_attr "athlon_decode" "vector")
    (set_attr "amdfam10_decode" "double")
+   (set_attr "c86_decode" "vector")
    (set_attr "bdver1_decode" "double")
    (set_attr "mode" "QI")])
 
@@ -23019,6 +23086,7 @@
    (set_attr "pent_pair" "np")
    (set_attr "athlon_decode" "vector")
    (set_attr "amdfam10_decode" "double")
+   (set_attr "c86_decode" "vector")
    (set_attr "bdver1_decode" "double")
    (set_attr "mode" "QI")])
 
@@ -24099,6 +24167,7 @@
   [(set_attr "type" "fpspc")
    (set_attr "mode" "XF")
    (set_attr "athlon_decode" "direct")
+   (set_attr "c86_attr" "sqrt")
    (set_attr "amdfam10_decode" "direct")
    (set_attr "bdver1_decode" "direct")])
 
@@ -24267,6 +24336,7 @@
   "fprem"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "fmodxf3"
@@ -24339,6 +24409,7 @@
   "fprem1"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "remainderxf3"
@@ -24414,6 +24485,7 @@
   "f<sincos>"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "<sincos><mode>2"
@@ -24445,6 +24517,7 @@
   "fsincos"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "sincos<mode>3"
@@ -24478,6 +24551,7 @@
   "fptan"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "tanxf2"
@@ -24520,6 +24594,7 @@
   "fpatan"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "atan2<mode>3"
@@ -24823,6 +24898,7 @@
   "fyl2x"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "logxf2"
@@ -24920,6 +24996,7 @@
   "fyl2xp1"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "log1pxf2"
@@ -24960,6 +25037,7 @@
   "fxtract"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "logbxf2"
@@ -25040,6 +25118,7 @@
   "f2xm1"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_insn "fscalexf4_i387"
@@ -25055,6 +25134,7 @@
   "fscale"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "expNcorexf3"
@@ -25373,6 +25453,7 @@
   "frndint"
   [(set_attr "type" "fpspc")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "XF")])
 
 (define_expand "rinthf2"
@@ -27191,6 +27272,7 @@
    v<maxmin_float><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "prefix" "orig,vex")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "type" "sseadd")
    (set_attr "mode" "<MODE>")])
 
@@ -27235,6 +27317,7 @@
    v<ieee_maxmin><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "prefix" "orig,maybe_evex")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "type" "sseadd")
    (set_attr "mode" "<MODE>")])
 
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index a23474716a64..8c50480b76bc 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -664,6 +664,7 @@
   [(set_attr "isa" "*,x64")
    (set_attr "mmx_isa" "native,*")
    (set_attr "type" "mmxmov,ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "mode" "DI")])
 
 (define_expand "movq_<mode>_to_sse"
@@ -1324,6 +1325,7 @@
    vblendps\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*")
    (set_attr "prefix_extra" "1")
@@ -1344,6 +1346,7 @@
    vblendvps\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blendv")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*")
    (set_attr "prefix_extra" "1")
@@ -3599,6 +3602,7 @@
   [(set_attr "isa" "*,sse2_noavx,avx")
    (set_attr "mmx_isa" "native,*,*")
    (set_attr "type" "mmxmul,sseiadd,sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "mode" "DI,TI,TI")])
 
 (define_expand "mmx_pmulhrwv4hi3"
@@ -4346,6 +4350,7 @@
    vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blendv")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,orig,vex")
@@ -4422,6 +4427,7 @@
    vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blendv")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,orig,vex")
@@ -5040,6 +5046,7 @@
   "%vpmov<extsuffix>bw\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -5072,6 +5079,7 @@
   "%vpmov<extsuffix>wd\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -5104,6 +5112,7 @@
   "%vpmov<extsuffix>bd\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -5130,6 +5139,7 @@
   "%vpmov<extsuffix>bw\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -5306,6 +5316,7 @@
    (set_attr "addr" "gpr16,*")
    (set_attr "prefix_extra" "1")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insr")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "TI")])
@@ -5345,6 +5356,7 @@
   [(set_attr "isa" "*,sse2_noavx,avx,sse4")
    (set_attr "mmx_isa" "native,*,*,*")
    (set_attr "type" "mmxcvt,sselog,sselog,sselog")
+   (set_attr "c86_attr" "insr")
    (set_attr "length_immediate" "1")
    (set_attr "mode" "DI,TI,TI,TI")])
 
@@ -5395,6 +5407,7 @@
 }
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insr")
    (set_attr "addr" "gpr16,*")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -5417,6 +5430,7 @@
    (set_attr "addr" "*,*,gpr16,*")
    (set_attr "mmx_isa" "native,*,*,*")
    (set_attr "type" "mmxcvt,sselog1,sselog1,sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,maybe_vex,maybe_vex,maybe_evex")
    (set_attr "mode" "DI,TI,TI,TI")])
@@ -5452,6 +5466,7 @@
    (set_attr "addr" "*,*,gpr16,*,*,*")
    (set_attr "mmx_isa" "native,*,*,*,*,*")
    (set_attr "type" "mmxcvt,sselog1,sselog1,sselog1,sseishft1,sseishft1")
+   (set_attr "c86_attr" "extr,extr,extr,extr,*,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,maybe_vex,maybe_vex,maybe_evex,orig,maybe_evex")
    (set_attr "mode" "DI,TI,TI,TI,TI,TI")])
@@ -5470,6 +5485,7 @@
   [(set_attr "isa" "*,sse2")
    (set_attr "mmx_isa" "native,*")
    (set_attr "type" "mmxcvt,sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,maybe_vex")
    (set_attr "mode" "DI,TI")])
@@ -5488,6 +5504,7 @@
   [(set_attr "isa" "noavx,noavx,avx,avx")
    (set_attr "addr" "*,gpr16,*,*")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -5503,6 +5520,7 @@
   "%vpextrb\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -5629,6 +5647,7 @@
    vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,orig,vex")
@@ -5647,6 +5666,7 @@
    vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,orig,vex")
@@ -5829,6 +5849,7 @@
 		      (const_string "*")))
    (set_attr "mmx_isa" "native,*,*,*,*,native,*,*")
    (set_attr "type" "mmxcvt,ssemov,ssemov,sseshuf1,sseshuf1,mmxmov,ssemov,imov")
+   (set_attr "c86_attr" "*,extr,extr,*,*,*,*,*")
    (set (attr "length_immediate")
      (if_then_else (eq_attr "alternative" "1,2,3,4")
 		   (const_string "1")
@@ -5856,6 +5877,7 @@
   "%vpextrd\t{$1, %1, %k0|%k0, %1, 1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -6010,6 +6032,7 @@
 }
   [(set_attr "isa" "noavx,avx,sse4")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insr")
    (set_attr "length_immediate" "1")
    (set_attr "mode" "TI")])
 
@@ -6062,6 +6085,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,vex")
@@ -6080,6 +6104,7 @@
   [(set_attr "isa" "*,sse4_noavx,avx")
    (set_attr "addr" "*,gpr16,*")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
    (set_attr "mode" "TI")])
@@ -6113,6 +6138,7 @@
   [(set_attr "isa" "*,sse4_noavx,avx,noavx,avx")
    (set_attr "addr" "*,gpr16,*,*,*")
    (set_attr "type" "sselog1,sselog1,sselog1,sseishft1,sseishft1")
+   (set_attr "c86_attr" "extr,extr,extr,*,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex,orig,maybe_evex,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -6126,6 +6152,7 @@
   "TARGET_SSE2"
   "%vpextrw\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
    (set_attr "mode" "TI")])
@@ -6144,6 +6171,7 @@
   [(set_attr "isa" "noavx,noavx,avx,avx")
    (set_attr "addr" "*,gpr16,*,*")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -6159,6 +6187,7 @@
   "%vpextrb\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -6511,6 +6540,7 @@
   [(set_attr "isa" "*,sse2_noavx,avx")
    (set_attr "mmx_isa" "native,*,*")
    (set_attr "type" "mmxshft,sseiadd,sseiadd")
+   (set_attr "c86_attr" "sadbw")
    (set_attr "mode" "DI,TI,TI")])
 
 (define_expand "reduc_<code>_scal_<mode>"
@@ -6890,6 +6920,7 @@
   "maskmovq\t{%2, %1|%1, %2}"
   [(set_attr "type" "mmxcvt")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "DI")])
 
 (define_int_iterator EMMS
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 5a613bd97278..d6dbdb51f80b 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -1794,6 +1794,11 @@
     }
 }
   [(set_attr "type" "ssemov")
+   (set (attr "c86_attr")
+     (if_then_else (and (match_test "REG_P (operands[1])")
+			(match_test "REGNO (operands[1]) != REGNO (operands[0])"))
+       (const_string "blend")
+       (const_string "*")))
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -1808,6 +1813,7 @@
     vmovdqu<ssescalarsize>\t{%2, %0%{%3%}%N1|%0%{%3%}%N1, %2}
     vpblendm<sseintmodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "*,blend")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -2034,6 +2040,7 @@
   "TARGET_SSE2"
   "movnti\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "prefix_data16" "0")
    (set_attr "mode" "<MODE>")])
 
@@ -2045,6 +2052,7 @@
   "TARGET_SSE"
   "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "prefix" "maybe_vex")
    (set_attr "mode" "<MODE>")])
 
@@ -2060,6 +2068,7 @@
        (match_test "TARGET_AVX")
      (const_string "*")
      (const_string "1")))
+   (set_attr "c86_attr" "movnt")
    (set_attr "prefix" "maybe_vex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -2359,6 +2368,7 @@
   "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "mode" "<MODE>")
    (set_attr "type" "msklog")
+   (set_attr "c86_decode" "vector")
    (set_attr "prefix" "vex")])
 
 (define_insn "*kortest<mode>"
@@ -2371,6 +2381,7 @@
   "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "mode" "<MODE>")
    (set_attr "type" "msklog")
+   (set_attr "c86_decode" "vector")
    (set_attr "prefix" "vex")])
 
 (define_insn "kortest<mode>_ccc"
@@ -2939,6 +2950,7 @@
    (set_attr "addr" "*,gpr16")
    (set_attr "atom_sse_attr" "rcp")
    (set_attr "btver2_sse_attr" "rcp")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "maybe_vex")
    (set_attr "mode" "<MODE>")])
 
@@ -2958,6 +2970,7 @@
    (set_attr "addr" "*,gpr16")
    (set_attr "atom_sse_attr" "rcp")
    (set_attr "btver2_sse_attr" "rcp")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "SF")])
 
@@ -2978,6 +2991,7 @@
    (set_attr "addr" "*,gpr16")
    (set_attr "atom_sse_attr" "rcp")
    (set_attr "btver2_sse_attr" "rcp")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "SF")])
 
@@ -3027,6 +3041,7 @@
   "TARGET_AVX512F"
   "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -3041,6 +3056,7 @@
   "TARGET_AVX512F"
   "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -3058,6 +3074,7 @@
   "TARGET_AVX512F"
   "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -3093,6 +3110,7 @@
    (set_attr "type" "sse")
    (set_attr "atom_sse_attr" "sqrt")
    (set_attr "btver2_sse_attr" "sqrt")
+   (set_attr "c86_attr" "sqrt")
    (set_attr "prefix" "maybe_vex")
    (set_attr "mode" "<MODE>")])
 
@@ -3112,6 +3130,7 @@
    (set_attr "atom_sse_attr" "sqrt")
    (set_attr "prefix" "<round_scalar_prefix>")
    (set_attr "btver2_sse_attr" "sqrt")
+   (set_attr "c86_attr" "sqrt")
    (set_attr "mode" "<ssescalarmode>")])
 
 (define_insn "*<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>"
@@ -3131,6 +3150,7 @@
    (set_attr "atom_sse_attr" "sqrt")
    (set_attr "prefix" "<round_scalar_prefix>")
    (set_attr "btver2_sse_attr" "sqrt")
+   (set_attr "c86_attr" "sqrt")
    (set_attr "mode" "<ssescalarmode>")])
 
 (define_expand "rsqrt<mode>2"
@@ -3181,6 +3201,7 @@
   "TARGET_AVX512F"
   "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -3195,6 +3216,7 @@
   "TARGET_AVX512F"
   "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -3212,6 +3234,7 @@
   "TARGET_AVX512F"
   "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "rcp")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -3336,6 +3359,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd")
    (set_attr "btver2_sse_attr" "maxmin")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix" "<mask_prefix3>")
    (set_attr "mode" "<MODE>")])
 
@@ -3469,6 +3493,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd")
    (set_attr "btver2_sse_attr" "maxmin")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix" "<mask_prefix3>")
    (set_attr "mode" "<MODE>")])
 
@@ -3493,6 +3518,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd")
    (set_attr "btver2_sse_attr" "maxmin")
+   (set_attr "c86_attr" "maxmin")
    (set (attr "prefix")
      (cond [(eq_attr "alternative" "0")
 	      (const_string "orig")
@@ -3540,6 +3566,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sse")
    (set_attr "btver2_sse_attr" "maxmin")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix" "<round_saeonly_scalar_prefix>")
    (set_attr "mode" "<ssescalarmode>")])
 
@@ -3736,6 +3763,7 @@
   "TARGET_AVX"
   "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "prefix" "vex")
    (set_attr "mode" "V4DF")])
@@ -3781,6 +3809,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "addr" "*,gpr16")
    (set_attr "type" "sseadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "V2DF")])
 
@@ -3803,6 +3832,7 @@
    vhsubpd\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "*,gpr16")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "V2DF")])
@@ -3823,6 +3853,7 @@
    vhaddpd\t{%1, %1, %0|%0, %1, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "V2DF")])
 
@@ -3841,6 +3872,7 @@
    vhsubpd\t{%1, %1, %0|%0, %1, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "V2DF")])
 
@@ -3884,6 +3916,7 @@
   "TARGET_AVX"
   "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "prefix" "vex")
    (set_attr "mode" "V8SF")])
@@ -3915,6 +3948,7 @@
    vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "*,gpr16")
    (set_attr "atom_unit" "complex")
    (set_attr "prefix" "orig,vex")
@@ -4253,6 +4287,7 @@
   "TARGET_AVX512DQ || (VALID_AVX512FP16_REG_MODE (<MODE>mode))"
   "vreduce<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "aes")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -4269,6 +4304,7 @@
   "TARGET_AVX512DQ || (VALID_AVX512FP16_REG_MODE (<MODE>mode))"
   "vreduce<ssescalarmodesuffix>\t{%3, <round_saeonly_scalar_mask_op4>%2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2<round_saeonly_scalar_mask_op4>, %3}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "aes")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<MODE>")])
 
@@ -4937,6 +4973,7 @@
    vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}
    vptestnm<ssemodesuffix>\t{%1, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %1}"
   [(set_attr "type" "ssecmp")
+   (set_attr "c86_attr" "*,ptest")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -5026,6 +5063,7 @@
    vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}
    vptestnm<ssemodesuffix>\t{%1, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %1}"
   [(set_attr "type" "ssecmp")
+   (set_attr "c86_attr" "*,ptest")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -5635,6 +5673,7 @@
   [(set_attr "isa" "noavx,avx_noavx512f,avx512dq,avx512f")
    (set_attr "addr" "*,gpr16,*,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "orig,maybe_vex,evex,evex")
    (set (attr "mode")
 	(cond [(and (match_test "<mask_applied>")
@@ -5686,6 +5725,7 @@
   return "";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "evex")
    (set (attr "mode")
         (if_then_else (match_test "TARGET_AVX512DQ")
@@ -5762,6 +5802,7 @@
 }
   [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "orig,maybe_evex,evex,evex")
    (set (attr "mode")
 	(cond [(and (match_test "<mask_applied>")
@@ -5809,6 +5850,7 @@
   return "";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "evex")
    (set (attr "mode")
         (if_then_else (match_test "TARGET_AVX512DQ")
@@ -5926,6 +5968,7 @@
 }
   [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "orig,vex,evex,evex")
    (set (attr "mode")
 	(cond [(eq_attr "alternative" "2")
@@ -6056,6 +6099,7 @@
 }
   [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "orig,vex,evex,evex")
    (set (attr "mode")
 	(cond [(eq_attr "alternative" "2")
@@ -6118,6 +6162,7 @@
 }
   [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set (attr "prefix_data16")
      (if_then_else
        (and (eq_attr "alternative" "0")
@@ -8860,6 +8905,7 @@
    (set_attr "bdver1_decode" "double,direct,*")
    (set_attr "btver2_decode" "double,double,double")
    (set_attr "znver1_decode" "double,double,double")
+   (set_attr "c86_decode" "double,double,double")
    (set (attr "length_vex")
 	(if_then_else
 	  (and (match_test "<MODE>mode == DImode")
@@ -9321,6 +9367,7 @@
    (set_attr "bdver1_decode" "double,direct,*")
    (set_attr "btver2_decode" "double,double,double")
    (set_attr "znver1_decode" "double,double,double")
+   (set_attr "c86_decode" "double,double,double")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "DF")])
 
@@ -12250,6 +12297,10 @@
 	      (const_string "ssemov2")
 	   ]
 	   (const_string "ssemov")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "9,10,11")
+		   (const_string "insr")
+		   (const_string "*")))
    (set (attr "addr")
      (if_then_else (eq_attr "alternative" "9,10")
 		   (const_string "gpr16")
@@ -12324,6 +12375,13 @@
      (if_then_else (eq_attr "alternative" "0,1,2,3,6,7,10")
 		   (const_string "ssemov")
 		   (const_string "sselog")))
+   (set (attr "c86_attr")
+	(cond [(eq_attr "alternative" "6,7,10")
+		 (const_string "blend")
+	       (eq_attr "alternative" "4,5,8,9,11,12")
+		 (const_string "insr")
+	      ]
+	      (const_string "*")))
    (set (attr "prefix_data16")
      (if_then_else (eq_attr "alternative" "4,5")
 		   (const_string "1")
@@ -12692,6 +12750,7 @@
   [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*,*,*")
    (set_attr "type" "sselog,sselog,sselog,*,*")
+   (set_attr "c86_attr" "extr,extr,extr,*,*")
    (set_attr "prefix_data16" "1,1,1,*,*")
    (set_attr "prefix_extra" "1,1,1,*,*")
    (set_attr "length_immediate" "1,1,1,*,*")
@@ -13591,6 +13650,7 @@
   [(set_attr "isa" "*,sse4_noavx,avx,noavx,avx")
    (set_attr "addr" "*,gpr16,*,*,*")
    (set_attr "type" "sselog1,sselog1,sselog1,sseishft1,sseishft1")
+   (set_attr "c86_attr" "extr,extr,extr,other,other")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "TI")])
 
@@ -14381,6 +14441,7 @@
   "TARGET_AVX512F"
   "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
   [(set_attr "prefix" "evex")
+   (set_attr "c86_attr" "shufx")
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_mode_attr vec_extract_imm_predicate
@@ -16996,6 +17057,7 @@
    "TARGET_AVX512BW && <mask_mode512bit_condition>"
    "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -17067,6 +17129,7 @@
   "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix" "vex")
    (set_attr "mode" "OI")])
 
@@ -17125,6 +17188,7 @@
    vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "atom_unit" "simul")
    (set_attr "prefix_data16" "1,*")
    (set_attr "prefix" "orig,vex")
@@ -17992,6 +18056,7 @@
   "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "vex")
    (set_attr "mode" "OI")])
@@ -18033,6 +18098,7 @@
   "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -18044,6 +18110,7 @@
   "TARGET_AVX512BW && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -18142,6 +18209,7 @@
    vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix_extra" "1")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "prefix" "orig,orig,vex")
@@ -18158,6 +18226,7 @@
    vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "addr" "gpr16,*")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "TI")])
@@ -18226,6 +18295,7 @@
    vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "prefix_extra" "1,1,*")
    (set_attr "prefix" "orig,orig,vex")
@@ -18243,6 +18313,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "maxmin")
    (set_attr "prefix" "orig,vex")
    (set_attr "mode" "TI")])
 
@@ -18912,6 +18983,7 @@
   [(set_attr "isa" "noavx,avx_noavx512f,avx512f,*,*")
    (set_attr "addr" "*,gpr16,*,*,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set (attr "prefix_data16")
      (if_then_else
        (and (eq_attr "alternative" "0")
@@ -19018,6 +19090,7 @@
   "TARGET_AVX512F"
   "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -19142,6 +19215,7 @@
   [(set_attr "isa" "noavx,avx_noavx512f,avx512f")
    (set_attr "addr" "*,gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set (attr "prefix_data16")
      (if_then_else
        (and (eq_attr "alternative" "0")
@@ -19239,6 +19313,7 @@
   [(set_attr "isa" "noavx,avx_noavx512f,avx512f")
    (set_attr "addr" "*,gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set (attr "prefix_data16")
      (if_then_else
        (and (eq_attr "alternative" "0")
@@ -19275,6 +19350,7 @@
    (set_attr "prefix" "orig,vex,evex")
    (set_attr "prefix_data16" "1,*,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "sselogic")
    (set_attr "mode" "TI")])
 
 (define_expand "one_cmplv1ti2"
@@ -20250,6 +20326,7 @@
 }
   [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>,avx2")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insr")
    (set (attr "addr")
 	(if_then_else (eq_attr "alternative" "0,1")
 		      (const_string "gpr16")
@@ -20363,6 +20440,7 @@
     }
 }
   [(set_attr "type" "sselog,ssemov,ssemov")
+   (set_attr "c86_attr" "insertx,*,*")
    (set_attr "length_immediate" "1,0,0")
    (set_attr "prefix" "evex,vex,evex")
    (set_attr "mode" "<sseinsnmode>,<ssequarterinsnmode>,<ssequarterinsnmode>")])
@@ -20395,6 +20473,7 @@
   return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -20433,6 +20512,7 @@
   "TARGET_AVX512DQ"
   "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -20450,6 +20530,7 @@
   "TARGET_AVX512DQ"
   "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -20465,6 +20546,7 @@
   "TARGET_AVX512F"
   "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
@@ -20480,6 +20562,7 @@
   "TARGET_AVX512F"
   "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
@@ -20529,6 +20612,7 @@
   return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "shufx")
    (set_attr "addr" "gpr16,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
@@ -20592,6 +20676,7 @@
   return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "shufx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -20628,6 +20713,7 @@
   return "vshuf<shuffletype>64x2\t{%2, %1, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %1, %2}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "shufx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -20691,6 +20777,7 @@
   return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "shufx")
    (set_attr "addr" "gpr16,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
@@ -20778,6 +20865,7 @@
   return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "shufx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -20830,6 +20918,7 @@
   return "vshuf<shuffletype>32x4\t{%2, %1, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %1, %2}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "shufx")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -21434,6 +21523,7 @@
   [(set_attr "isa" "sse2_noavx,avx,sse4_noavx,avx")
    (set_attr "addr" "*,*,gpr16,*")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set (attr "prefix_extra")
      (if_then_else
        (eq (const_string "<MODE>mode") (const_string "V8HImode"))
@@ -21455,6 +21545,7 @@
   "%vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set (attr "prefix_extra")
      (if_then_else
        (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
@@ -21475,6 +21566,7 @@
   "%vpextrb\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -21609,6 +21701,7 @@
 }
   [(set_attr "isa" "noavx,avx,avx512dq,noavx,noavx,avx")
    (set_attr "type" "sselog1,sselog1,sselog1,sseishft1,sseishft1,sseishft1")
+   (set_attr "c86_attr" "extr,extr,*,*,*,*")
    (set (attr "addr")
 	(if_then_else (eq_attr "alternative" "0")
 		      (const_string "gpr16")
@@ -21631,6 +21724,7 @@
   "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
   [(set_attr "isa" "noavx,avx,avx512dq")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "extr")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "maybe_vex")
@@ -21703,6 +21797,10 @@
 	      (const_string "imov")
 	   ]
 	   (const_string "sselog1")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "0,1,2")
+		   (const_string "extr")
+		   (const_string "other")))
    (set (attr "addr")
 	(if_then_else (eq_attr "alternative" "0")
 		      (const_string "gpr16")
@@ -21868,6 +21966,10 @@
 	      (const_string "mmxmov")
 	   ]
 	   (const_string "sselog")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "0,1,2,3")
+		   (const_string "insr")
+		   (const_string "other")))
    (set (attr "addr")
      (if_then_else (eq_attr "alternative" "0,1")
 		   (const_string "gpr16")
@@ -22026,6 +22128,10 @@
        (eq_attr "alternative" "0,1,2,3,4,5")
        (const_string "sselog")
        (const_string "ssemov2")))
+   (set (attr "c86_attr")
+     (if_then_else (eq_attr "alternative" "0,1,2,3")
+		   (const_string "insr")
+		   (const_string "other")))
    (set (attr "addr")
      (if_then_else (eq_attr "alternative" "0,1")
 		   (const_string "gpr16")
@@ -22245,6 +22351,7 @@
    vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "avg")
    (set_attr "prefix_data16" "1,*")
    (set_attr "prefix" "orig,<mask_prefix>")
    (set_attr "mode" "<sseinsnmode>")])
@@ -22273,6 +22380,7 @@
    vpsadbw\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "sadbw")
    (set_attr "atom_unit" "simul")
    (set_attr "prefix_data16" "1,*")
    (set_attr "prefix" "orig,maybe_evex")
@@ -22287,6 +22395,7 @@
   "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "<MODE>")])
 
@@ -22300,6 +22409,7 @@
   "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "<MODE>")])
 
@@ -22437,6 +22547,7 @@
   "%vpmovmskb\t{%1, %0|%0, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set (attr "prefix_data16")
      (if_then_else
        (match_test "TARGET_AVX")
@@ -22455,6 +22566,7 @@
   "%vpmovmskb\t{%1, %k0|%k0, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set (attr "prefix_data16")
      (if_then_else
        (match_test "TARGET_AVX")
@@ -22473,6 +22585,7 @@
   "%vpmovmskb\t{%1, %k0|%k0, %1}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set (attr "prefix_data16")
      (if_then_else
        (match_test "TARGET_AVX")
@@ -22822,6 +22935,7 @@
   return "%vmaskmovdqu\t{%2, %1|%1, %2}";
 }
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "prefix_data16" "1")
    (set (attr "length_address")
      (symbol_ref ("Pmode != word_mode")))
@@ -22830,6 +22944,7 @@
      (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
    (set_attr "prefix" "maybe_vex")
    (set_attr "znver1_decode" "vector")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "TI")])
 
 (define_insn "sse_ldmxcsr"
@@ -22922,6 +23037,7 @@
   "TARGET_AVX2"
   "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "vex")
@@ -22948,6 +23064,7 @@
    vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "atom_unit" "complex")
    (set_attr "prefix_extra" "1")
@@ -22989,6 +23106,7 @@
 }
   [(set_attr "mmx_isa" "native,sse_noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "atom_unit" "complex")
    (set_attr "prefix_extra" "1")
    (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
@@ -23012,6 +23130,7 @@
   "TARGET_AVX2"
   "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "vex")
@@ -23036,6 +23155,7 @@
    vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "atom_unit" "complex")
    (set_attr "prefix_data16" "1,*")
@@ -23076,6 +23196,7 @@
 }
   [(set_attr "mmx_isa" "native,sse_noavx,avx")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "hplus")
    (set_attr "addr" "gpr16")
    (set_attr "atom_unit" "complex")
    (set_attr "prefix_extra" "1")
@@ -23132,6 +23253,7 @@
   "TARGET_AVX2"
   "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "vex")
    (set_attr "mode" "OI")])
@@ -23147,6 +23269,7 @@
    "TARGET_AVX512BW"
    "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
   [(set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -23223,6 +23346,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "atom_unit" "simul")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,vex")
@@ -23259,6 +23383,7 @@
   [(set_attr "isa" "*,noavx,avx")
    (set_attr "mmx_isa" "native,*,*")
    (set_attr "type" "sseiadd")
+   (set_attr "c86_attr" "madd")
    (set_attr "atom_unit" "simul")
    (set_attr "prefix_extra" "1")
    (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
@@ -23542,6 +23667,7 @@
    vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "sign")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,vex")
@@ -23561,6 +23687,7 @@
   [(set_attr "isa" "*,noavx,avx")
    (set_attr "mmx_isa" "native,*,*")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "sign")
    (set_attr "prefix_extra" "1")
    (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
    (set_attr "mode" "DI,TI,TI")])
@@ -23710,6 +23837,7 @@
    (set_attr "type" "sselog1")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_vex")
+   (set_attr "c86_attr" "abs")
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_insn "abs<mode>2_mask"
@@ -23722,6 +23850,7 @@
   "TARGET_AVX512F"
   "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "abs")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -23735,6 +23864,7 @@
   "TARGET_AVX512BW"
   "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "abs")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -23767,6 +23897,7 @@
   "TARGET_SSE4A"
   "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "mode" "<MODE>")])
 
 (define_insn "sse4a_vmmovnt<mode>"
@@ -23779,6 +23910,7 @@
   "TARGET_SSE4A"
   "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "mode" "<ssescalarmode>")])
 
 (define_insn "sse4a_extrqi"
@@ -23855,6 +23987,7 @@
    vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "addr" "gpr16")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*")
@@ -23876,6 +24009,7 @@
    vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blendv")
    (set_attr "addr" "gpr16")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*")
@@ -23909,6 +24043,7 @@
 }
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blendv")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*")
    (set_attr "prefix_extra" "1")
@@ -24114,6 +24249,7 @@
    (set_attr "prefix" "orig,orig,vex")
    (set_attr "btver2_decode" "vector,vector,vector")
    (set_attr "znver1_decode" "vector,vector,vector")
+   (set_attr "c86_decode" "vector,vector,vector")
    (set_attr "mode" "<MODE>")])
 
 ;; Mode attribute used by `vmovntdqa' pattern
@@ -24129,6 +24265,7 @@
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "movnt")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -24153,6 +24290,7 @@
    (set_attr "prefix" "orig,orig,vex")
    (set_attr "btver2_decode" "vector,vector,vector")
    (set_attr "znver1_decode" "vector,vector,vector")
+   (set_attr "c86_decode" "vector,vector,vector")
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_insn "avx10_2_mpsadbw<mask_name>"
@@ -24212,6 +24350,7 @@
    vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blendv")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "*,*,1")
@@ -24353,6 +24492,7 @@
    vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -24425,6 +24565,7 @@
   return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
 }
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -24440,6 +24581,7 @@
   "TARGET_AVX2"
   "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "blend")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -24466,6 +24608,7 @@
   "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
   "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -24520,6 +24663,7 @@
   "TARGET_AVX512BW"
   "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -24579,6 +24723,7 @@
   "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -24595,6 +24740,7 @@
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -24741,6 +24887,7 @@
   "TARGET_AVX512F"
   "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -24762,6 +24909,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -24773,6 +24921,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -24850,6 +24999,7 @@
   "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -24863,6 +25013,7 @@
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -24940,6 +25091,7 @@
   "TARGET_AVX512F"
   "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -24993,6 +25145,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -25052,6 +25205,7 @@
   "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -25065,6 +25219,7 @@
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -25209,6 +25364,7 @@
   "TARGET_AVX512F"
   "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -25219,6 +25375,7 @@
   "TARGET_AVX512F"
   "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -25292,6 +25449,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -25303,6 +25461,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -25383,6 +25542,7 @@
   "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -25396,6 +25556,7 @@
   [(set_attr "isa" "noavx,avx")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "TI")])
@@ -25445,6 +25606,7 @@
   "TARGET_AVX512F"
   "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -25464,6 +25626,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -25475,6 +25638,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_evex")
    (set_attr "mode" "OI")])
@@ -25547,6 +25711,7 @@
   "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -25560,6 +25725,7 @@
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -25635,6 +25801,7 @@
   "TARGET_AVX512F"
   "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -25686,6 +25853,7 @@
   "TARGET_AVX2 && <mask_avx512vl_condition>"
   "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix" "maybe_evex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "OI")])
@@ -25741,6 +25909,7 @@
   "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -25754,6 +25923,7 @@
   [(set_attr "isa" "noavx,noavx,avx")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "ssemov")
+   (set_attr "c86_attr" "vpmovx")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,orig,maybe_evex")
    (set_attr "mode" "TI")])
@@ -26206,6 +26376,7 @@
 }
   [(set_attr "isa" "noavx,noavx,noavx512f,avx512f")
    (set_attr "type" "ssecvt")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16,gpr16,gpr16,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*,*")
@@ -26243,6 +26414,7 @@
 }
   [(set_attr "isa" "noavx,noavx,noavx512f,avx512f")
    (set_attr "type" "ssecvt")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16,gpr16,gpr16,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix_data16" "1,1,*,*")
@@ -26512,6 +26684,7 @@
   "TARGET_SSE4_2"
   "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "cmpestr")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_vex")
@@ -26540,6 +26713,7 @@
   "TARGET_SSE4_2"
   "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "cmpestr")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -26566,6 +26740,7 @@
    %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
    %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "cmpestr")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -26643,6 +26818,7 @@
   "TARGET_SSE4_2"
   "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "cmpestr")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -26667,6 +26843,7 @@
   "TARGET_SSE4_2"
   "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "cmpestr")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -26691,6 +26868,7 @@
    %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
    %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "cmpestr")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -26877,6 +27055,7 @@
   "TARGET_XOP"
   "vphadd<u>bw\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -26909,6 +27088,7 @@
   "TARGET_XOP"
   "vphadd<u>bd\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -26957,6 +27137,7 @@
   "TARGET_XOP"
   "vphadd<u>bq\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -26977,6 +27158,7 @@
   "TARGET_XOP"
   "vphadd<u>wd\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -27005,6 +27187,7 @@
   "TARGET_XOP"
   "vphadd<u>wq\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -27023,6 +27206,7 @@
   "TARGET_XOP"
   "vphadd<u>dq\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -27047,6 +27231,7 @@
   "TARGET_XOP"
   "vphsubbw\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -27067,6 +27252,7 @@
   "TARGET_XOP"
   "vphsubwd\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -27085,6 +27271,7 @@
   "TARGET_XOP"
   "vphsubdq\t{%1, %0|%0, %1}"
   [(set_attr "type" "sseiadd1")
+   (set_attr "c86_attr" "hplus")
    (set_attr "prefix" "vex")
    (set_attr "prefix_extra" "1")
    (set_attr "mode" "TI")])
@@ -27791,6 +27978,7 @@
    vaesenc\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx,vaes_avx512vl")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,maybe_evex,evex")
@@ -27809,6 +27997,7 @@
    vaesenclast\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx,vaes_avx512vl")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,maybe_evex,evex")
@@ -27827,6 +28016,7 @@
    vaesdec\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx,vaes_avx512vl")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,maybe_evex,evex")
@@ -27846,6 +28036,7 @@
   [(set_attr "isa" "noavx,avx,vaes_avx512vl")
    (set_attr "addr" "gpr16,gpr16,*")
    (set_attr "type" "sselog1")
+   (set_attr "c86_attr" "aes")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "orig,maybe_evex,evex")
    (set_attr "btver2_decode" "double,double,double")
@@ -27858,6 +28049,7 @@
   "TARGET_AES"
   "%vaesimc\t{%1, %0|%0, %1}"
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "maybe_vex")
@@ -27871,6 +28063,7 @@
   "TARGET_AES"
   "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "aes")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -27894,6 +28087,7 @@
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "orig,vex,evex")
+   (set_attr "c86_decode" "*,vector,vector")
    (set_attr "mode" "TI")])
 
 (define_expand "avx_vzeroall"
@@ -28011,6 +28205,7 @@
   return "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm")
    (set_attr "prefix" "<mask_prefix2>")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28023,6 +28218,7 @@
   "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
   "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm")
    (set_attr "prefix" "<mask_prefix2>")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28035,6 +28231,7 @@
   "TARGET_AVX512BW && <mask_mode512bit_condition>"
   "vpermw\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm")
    (set_attr "prefix" "<mask_prefix2>")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28253,6 +28450,7 @@
   return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm")
    (set_attr "prefix" "<mask_prefix2>")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28328,6 +28526,7 @@
   return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm")
    (set_attr "prefix" "<mask_prefix2>")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28434,6 +28633,7 @@
    vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
    vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "shufx,*")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28446,6 +28646,7 @@
    vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
    vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "shufx,*")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28698,6 +28899,7 @@
    vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
   [(set_attr "isa" "noavx512vl,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
    (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
+   (set_attr "c86_attr" "*,insertx,*,*,insertx,*,insertx")
    (set (attr "addr")
 	(if_then_else (eq_attr "alternative" "0")
 		      (const_string "gpr16")
@@ -28756,6 +28958,7 @@
    vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
    vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "shufx,*")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -28769,6 +28972,7 @@
    vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
    vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "shufx,*")
    (set_attr "length_immediate" "1,*")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -28786,6 +28990,7 @@
    vshuf<shuffletype>64x2\t{$0x0, %<xtg_mode>1, %<xtg_mode>1, %0<mask_operand2>|%0<mask_operand2>, %<xtg_mode>1, %<xtg_mode>1, 0x0}
    vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "shufx,*")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -28883,6 +29088,7 @@
   "TARGET_AVX512F"
   "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm2")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28899,6 +29105,7 @@
   "TARGET_AVX512F"
   "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm2")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28928,6 +29135,7 @@
    vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
    vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm2")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -28959,6 +29167,7 @@
   "TARGET_AVX512F"
   "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "perm2")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -29037,6 +29246,7 @@
   return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
 }
   [(set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -29144,6 +29354,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex")
@@ -29168,6 +29379,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex")
@@ -29191,6 +29403,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex")
@@ -29214,6 +29427,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex")
@@ -29236,6 +29450,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex,evex")
@@ -29258,6 +29473,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16,*")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex,evex")
@@ -29283,6 +29499,7 @@
    vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "addr" "gpr16,*")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
@@ -29310,6 +29527,7 @@
   [(set_attr "isa" "noavx512vl,avx512vl")
    (set_attr "addr" "gpr16")
    (set_attr "type" "sselog")
+   (set_attr "c86_attr" "insertx")
    (set_attr "prefix_extra" "1")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "vex,evex")
@@ -29329,6 +29547,7 @@
     return "vmaskmov<ssefltmodesuffix>\t{%1, %2, %0|%0, %2, %1}";
 }
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "blend")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "vex")
@@ -29350,6 +29569,7 @@
     return "vmaskmov<ssefltmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
 }
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "blend")
    (set_attr "addr" "gpr16")
    (set_attr "prefix_extra" "1")
    (set_attr "prefix" "vex")
@@ -29745,6 +29965,7 @@
   [(set_attr "isa" "noavx512f,avx512f,*,*")
    (set_attr "addr" "gpr16,*,*,*")
    (set_attr "type" "sselog,sselog,ssemov,ssemov")
+   (set_attr "c86_attr" "insertx,insertx,*,*")
    (set_attr "prefix_extra" "1,1,*,*")
    (set_attr "length_immediate" "1,1,*,*")
    (set_attr "prefix" "maybe_evex")
@@ -30355,6 +30576,7 @@
   "TARGET_AVX512F"
   "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "compress")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -30368,6 +30590,7 @@
   "TARGET_AVX512VBMI2"
   "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "compress")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -30381,6 +30604,7 @@
   "TARGET_AVX512F"
   "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "compress")
    (set_attr "prefix" "evex")
    (set_attr "memory" "store")
    (set_attr "mode" "<sseinsnmode>")])
@@ -30395,6 +30619,7 @@
   "TARGET_AVX512VBMI2"
   "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "compress")
    (set_attr "prefix" "evex")
    (set_attr "memory" "store")
    (set_attr "mode" "<sseinsnmode>")])
@@ -30419,6 +30644,7 @@
   "TARGET_AVX512F"
   "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "expand")
    (set_attr "prefix" "evex")
    (set_attr "memory" "none,load")
    (set_attr "mode" "<sseinsnmode>")])
@@ -30433,6 +30659,7 @@
   "TARGET_AVX512VBMI2"
   "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
   [(set_attr "type" "ssemov")
+   (set_attr "c86_attr" "expand")
    (set_attr "prefix" "evex")
    (set_attr "memory" "none,load")
    (set_attr "mode" "<sseinsnmode>")])
@@ -30625,6 +30852,7 @@
    "TARGET_AVX512BW"
   "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
   [(set_attr "type" "sselog1")
+   (set_attr "c86_attr" "sadbw")
    (set_attr "length_immediate" "1")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -30636,6 +30864,7 @@
   "TARGET_AVX512CD"
   "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "sse")
+   (set_attr "c86_attr" "abs")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -30648,6 +30877,7 @@
   "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
   [(set_attr "type" "sse")
    (set_attr "prefix" "evex")
+   (set_attr "c86_decode" "vector")
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_insn "sha1msg1"
@@ -30910,6 +31140,7 @@
   "TARGET_AVX512IFMA"
   "vpmadd52<vpmadd52type>\t{%3, %2, %0|%0, %2, %3}"
   [(set_attr "type" "ssemuladd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix" "evex")
    (set_attr "mode" "XI")])
 
@@ -30926,6 +31157,7 @@
   vpmadd52<vpmadd52type>\t{%3, %2, %0|%0, %2, %3}"
   [(set_attr "isa" "avxifma,avx512ifmavl")
    (set_attr "type" "ssemuladd")
+   (set_attr "c86_attr" "madd")
    (set_attr "addr" "gpr16,*")
    (set_attr "prefix" "vex,evex")
    (set_attr "mode" "<sseinsnmode>")])
@@ -30943,6 +31175,7 @@
   "TARGET_AVX512IFMA"
   "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3}"
   [(set_attr "type" "ssemuladd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -30959,6 +31192,7 @@
   "TARGET_AVX512IFMA"
   "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
   [(set_attr "type" "ssemuladd")
+   (set_attr "c86_attr" "madd")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
@@ -31562,6 +31796,7 @@
 }
 [(set_attr "isa" "avx,vaes_avx512vl")
  (set_attr "type" "sselog1")
+ (set_attr "c86_attr" "aes")
  (set_attr "addr" "gpr16,*")
  (set_attr "mode" "TI")])
 
@@ -31580,6 +31815,7 @@
 }
 [(set_attr "isa" "avx,vaes_avx512vl")
  (set_attr "type" "sselog1")
+ (set_attr "c86_attr" "aes")
  (set_attr "addr" "gpr16,*")
  (set_attr "mode" "TI")])
 
@@ -31598,6 +31834,7 @@
 }
 [(set_attr "isa" "avx,vaes_avx512vl")
  (set_attr "type" "sselog1")
+ (set_attr "c86_attr" "aes")
  (set_attr "addr" "gpr16,*")
  (set_attr "mode" "TI")])
 
@@ -31616,6 +31853,7 @@
 }
 [(set_attr "isa" "avx,vaes_avx512vl")
  (set_attr "type" "sselog1")
+ (set_attr "c86_attr" "aes")
  (set_attr "addr" "gpr16,*")
  (set_attr "mode" "TI")])
 
diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h
index 99d97ab03147..7819fdf7c021 100644
--- a/gcc/config/i386/x86-tune-costs.h
+++ b/gcc/config/i386/x86-tune-costs.h
@@ -4420,3 +4420,303 @@ struct processor_costs core_cost = {
   COSTS_N_INSNS (2),			/* Branch mispredict scale.  */
 };
 
+/*  C86_4G_M4 has optimized REP instruction for medium sized blocks, but for
+    very small blocks it is better to use loop.  For large blocks, libcall
+    can do nontemporary accesses and beat inline considerably.  */
+static stringop_algs c86_4g_m4_memcpy[2] = {
+  /* 32-bit tuning.  */
+  {libcall, {{6, loop, false},
+	     {14, unrolled_loop, false},
+	     {-1, libcall, false}}},
+  /* 64-bit tuning.  */
+  {libcall, {{16, loop, false},
+	     {128, rep_prefix_8_byte, false},
+	     {-1, libcall, false}}}};
+static stringop_algs c86_4g_m4_memset[2] = {
+  /* 32-bit tuning.  */
+  {libcall, {{8, loop, false},
+	     {24, unrolled_loop, false},
+	     {128, rep_prefix_4_byte, false},
+	     {-1, libcall, false}}},
+  /* 64-bit tuning.  */
+  {libcall, {{48, unrolled_loop, false},
+	     {128, rep_prefix_8_byte, false},
+	     {-1, libcall, false}}}};
+static const
+struct processor_costs c86_4g_m4_cost = {
+  {
+  /* Start of register allocator costs.  integer->integer move cost is 2.  */
+
+  /* reg-reg moves are done by renaming and thus they are even cheaper than
+     1 cycle.  Because reg-reg move cost is 2 and the following tables
+     correspond to doubles of latencies, we do not model this correctly.
+     It does not seem to make practical difference to bump prices up even
+     more.  */
+  6,					/* cost for loading QImode using
+					   movzbl.  */
+  {6, 6, 6},				/* cost of loading integer registers
+					   in QImode, HImode and SImode.
+					   Relative to reg-reg move (2).  */
+  {8, 8, 8},				/* cost of storing integer
+					   registers.  */
+  2,					/* cost of reg,reg fld/fst.  */
+  {6, 6, 16},				/* cost of loading fp registers
+					   in SFmode, DFmode and XFmode.  */
+  {8, 8, 16},				/* cost of storing fp registers
+					   in SFmode, DFmode and XFmode.  */
+  2,					/* cost of moving MMX register.  */
+  {6, 6},				/* cost of loading MMX registers
+					   in SImode and DImode.  */
+  {8, 8},				/* cost of storing MMX registers
+					   in SImode and DImode.  */
+  2, 3, 6,				/* cost of moving XMM,YMM,ZMM register.  */
+  {6, 6, 6, 12, 24},			/* cost of loading SSE registers
+					   in 32,64,128,256 and 512-bit.  */
+  {8, 8, 8, 16, 32},			/* cost of storing SSE registers
+					   in 32,64,128,256 and 512-bit.  */
+  6, 6,				/* SSE->integer and integer->SSE moves.  */
+  8, 8,				/* mask->integer and integer->mask moves */
+  {6, 6, 6},				/* cost of loading mask register
+					   in QImode, HImode, SImode.  */
+  {8, 8, 8},				/* cost if storing mask register
+					   in QImode, HImode, SImode.  */
+  2,					/* cost of moving mask register.  */
+  /* End of register allocator costs.  */
+  },
+
+  COSTS_N_INSNS (1),			/* cost of an add instruction.  */
+  COSTS_N_INSNS (1),			/* cost of a lea instruction.  */
+  COSTS_N_INSNS (1),			/* variable shift costs.  */
+  COSTS_N_INSNS (1),			/* constant shift costs.  */
+  {COSTS_N_INSNS (3),			/* cost of starting multiply for QI.  */
+   COSTS_N_INSNS (3),			/*				 HI.  */
+   COSTS_N_INSNS (3),			/*				 SI.  */
+   COSTS_N_INSNS (3),			/*				 DI.  */
+   COSTS_N_INSNS (3)},			/*			      other.  */
+  0,					/* cost of multiply per each bit
+					    set.  */
+   /* Depending on parameters, idiv can get faster on HYGON.  This is upper
+      bound.  */
+  {COSTS_N_INSNS (16),			/* cost of a divide/mod for QI.  */
+   COSTS_N_INSNS (22),			/*			    HI.  */
+   COSTS_N_INSNS (30),			/*			    SI.  */
+   COSTS_N_INSNS (45),			/*			    DI.  */
+   COSTS_N_INSNS (45)},			/*			    other.  */
+  COSTS_N_INSNS (1),			/* cost of movsx.  */
+  COSTS_N_INSNS (1),			/* cost of movzx.  */
+  8,					/* "large" insn.  */
+  9,					/* MOVE_RATIO.  */
+  6,					/* CLEAR_RATIO */
+  {6, 6, 6},				/* cost of loading integer registers
+					   in QImode, HImode and SImode.
+					   Relative to reg-reg move (2).  */
+  {8, 8, 8},				/* cost of storing integer
+					   registers.  */
+  {6, 6, 6, 12, 24},			/* cost of loading SSE register
+					   in 32bit, 64bit, 128bit, 256bit and 512bit */
+  {8, 8, 8, 16, 32},			/* cost of storing SSE register
+					   in 32bit, 64bit, 128bit, 256bit and 512bit */
+  {6, 6, 6, 12, 24},			/* cost of unaligned loads.  */
+  {8, 8, 8, 16, 32},			/* cost of unaligned stores.  */
+  2, 3, 6,				/* cost of moving XMM,YMM,ZMM register.  */
+  6,					/* cost of moving SSE register to integer.  */
+  6,					/* cost of moving integer register to SSE.  */
+
+  18, 8,				/* Gather load static, per_elt.  */
+  18, 10,				/* Gather store static, per_elt.  */
+  32,					/* size of l1 cache.  */
+  512,					/* size of l2 cache.  */
+  64,					/* size of prefetch block.  */
+  /* C86_4G_M4 processors never drop prefetches; if they cannot be performed
+     immediately, they are queued.  We set number of simultaneous prefetches
+     to a large constant to reflect this (it probably is not a good idea not
+     to limit number of prefetches at all, as their execution also takes some
+     time).  */
+  100,					/* number of parallel prefetches.  */
+  3,					/* Branch cost.  */
+  COSTS_N_INSNS (5),			/* cost of FADD and FSUB insns.  */
+  COSTS_N_INSNS (5),			/* cost of FMUL instruction.  */
+
+  COSTS_N_INSNS (15),			/* cost of FDIV instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FABS instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FCHS instruction.  */
+
+  COSTS_N_INSNS (10),			/* cost of FSQRT instruction.  */
+
+  COSTS_N_INSNS (1),			/* cost of cheap SSE instruction.  */
+  COSTS_N_INSNS (3),			/* cost of ADDSS/SD SUBSS/SD insns.  */
+  COSTS_N_INSNS (3),			/* cost of MULSS instruction.  */
+  COSTS_N_INSNS (4),			/* cost of MULSD instruction.  */
+  COSTS_N_INSNS (5),			/* cost of FMA SS instruction.  */
+  COSTS_N_INSNS (5),			/* cost of FMA SD instruction.  */
+  COSTS_N_INSNS (10),			/* cost of DIVSS instruction.  */
+
+  COSTS_N_INSNS (13),			/* cost of DIVSD instruction.  */
+  COSTS_N_INSNS (10),			/* cost of SQRTSS instruction.  */
+  COSTS_N_INSNS (15),			/* cost of SQRTSD instruction.  */
+
+  COSTS_N_INSNS (4),			/* cost of CVTSS2SD etc.  */
+  COSTS_N_INSNS (5),			/* cost of 256bit VCVTPS2PD etc.  */
+  COSTS_N_INSNS (10),			/* cost of 512bit VCVTPS2PD etc.  */
+  COSTS_N_INSNS (5),			/* cost of CVTSI2SS instruction.  */
+  COSTS_N_INSNS (5),			/* cost of CVT(T)SS2SI instruction.  */
+  COSTS_N_INSNS (5),			/* cost of CVTPI2PS instruction.  */
+  COSTS_N_INSNS (4),			/* cost of CVT(T)PS2PI instruction.  */
+
+  4, 4, 3, 6,				/* reassoc int, fp, vec_int, vec_fp.  */
+  {8, 1, 6},				/* latency times throughput of
+					   FMA/DOT_PROD_EXPR/SAD_EXPR,
+					   it's used to determine unroll
+					   factor in the vectorizer.  */
+  4,					/* Limit how much the autovectorizer
+					   may unroll a loop.  */
+  c86_4g_m4_memcpy,
+  c86_4g_m4_memset,
+  COSTS_N_INSNS (4),			/* cond_taken_branch_cost.  */
+  COSTS_N_INSNS (2),			/* cond_not_taken_branch_cost.  */
+  "16",					/* Loop alignment.  */
+  "16",					/* Jump alignment.  */
+  "0:0:8",				/* Label alignment.  */
+  "16",					/* Func alignment.  */
+  4,					/* Small unroll limit.  */
+  2,					/* Small unroll factor.  */
+  COSTS_N_INSNS (2),			/* Branch mispredict scale.  */
+};
+
+struct processor_costs c86_4g_m6_cost = c86_4g_m4_cost;
+
+struct processor_costs c86_4g_m7_cost = {
+  {
+  /* Start of register allocator costs.  integer->integer move cost is 2.  */
+
+  /* reg-reg moves are done by renaming and thus they are even cheaper than
+     1 cycle.  Because reg-reg move cost is 2 and following tables correspond
+     to doubles of latencies, we do not model this correctly.  It does not
+     seem to make practical difference to bump prices up even more.  */
+  6,					/* cost for loading QImode using
+					   movzbl.  */
+  {6, 6, 6},				/* cost of loading integer registers
+					   in QImode, HImode and SImode.
+					   Relative to reg-reg move (2).  */
+  {8, 8, 8},				/* cost of storing integer
+					   registers.  */
+  2,					/* cost of reg,reg fld/fst.  */
+  {14, 14, 17},				/* cost of loading fp registers
+					   in SFmode, DFmode and XFmode.  */
+  {12, 12, 16},				/* cost of storing fp registers
+					   in SFmode, DFmode and XFmode.  */
+  2,					/* cost of moving MMX register.  */
+  {6, 6},				/* cost of loading MMX registers
+					   in SImode and DImode.  */
+  {8, 8},				/* cost of storing MMX registers
+					   in SImode and DImode.  */
+  2, 2, 3,				/* cost of moving XMM,YMM,ZMM
+					   register.  */
+  {6, 6, 10, 10, 12},			/* cost of loading SSE registers
+					   in 32,64,128,256 and 512-bit.  */
+  {8, 8, 8, 12, 12},			/* cost of storing SSE registers
+					   in 32,64,128,256 and 512-bit.  */
+  6, 8,					/* SSE->integer and integer->SSE
+					   moves.  */
+  8, 8,					/* mask->integer and integer->mask moves */
+  {6, 6, 6},				/* cost of loading mask register
+					   in QImode, HImode, SImode.  */
+  {8, 8, 8},				/* cost if storing mask register
+					   in QImode, HImode, SImode.  */
+  2,					/* cost of moving mask register.  */
+  /* End of register allocator costs.  */
+  },
+
+  COSTS_N_INSNS (1),			/* cost of an add instruction.  */
+
+  COSTS_N_INSNS (1),			/* cost of a lea instruction.  */
+  COSTS_N_INSNS (1),			/* variable shift costs.  */
+  COSTS_N_INSNS (1),			/* constant shift costs.  */
+  {COSTS_N_INSNS (3),			/* cost of starting multiply for QI.  */
+   COSTS_N_INSNS (3),			/* 				 HI.  */
+   COSTS_N_INSNS (3),			/*				 SI.  */
+   COSTS_N_INSNS (3),			/*				 DI.  */
+   COSTS_N_INSNS (3)},			/*			other.  */
+  0,					/* cost of multiply per each bit
+					   set.  */
+  {COSTS_N_INSNS (15),			/* cost of a divide/mod for QI.  */
+   COSTS_N_INSNS (17),			/* 			    HI.  */
+   COSTS_N_INSNS (25),			/*			    SI.  */
+   COSTS_N_INSNS (41),			/*			    DI.  */
+   COSTS_N_INSNS (41)},			/*			    other.  */
+  COSTS_N_INSNS (1),			/* cost of movsx.  */
+  COSTS_N_INSNS (1),			/* cost of movzx.  */
+  8,					/* "large" insn.  */
+  9,					/* MOVE_RATIO.  */
+  6,					/* CLEAR_RATIO */
+  {6, 6, 6},				/* cost of loading integer registers
+					   in QImode, HImode and SImode.
+					   Relative to reg-reg move (2).  */
+  {8, 8, 8},				/* cost of storing integer
+					   registers.  */
+  {6, 6, 10, 10, 12},			/* cost of loading SSE registers
+					   in 32bit, 64bit, 128bit, 256bit and 512bit */
+  {8, 8, 8, 12, 12},			/* cost of storing SSE register
+					   in 32bit, 64bit, 128bit, 256bit and 512bit */
+  {6, 6, 10, 10, 12},			/* cost of unaligned loads.  */
+  {8, 8, 8, 12, 12},			/* cost of unaligned stores.  */
+  2, 2, 3,				/* cost of moving XMM,YMM,ZMM
+					   register.  */
+  6,					/* cost of moving SSE register to integer.  */
+  6,					/* cost of moving integer register to SSE.  */
+
+  14, 10,				/* Gather load static, per_elt.  */
+  14, 20,				/* Gather store static, per_elt.  */
+  32,					/* size of l1 cache.  */
+  512,					/* size of l2 cache.  */
+  64,					/* size of prefetch block.  */
+
+  100,					/* number of parallel prefetches.  */
+  3,					/* Branch cost.  */
+  COSTS_N_INSNS (5),			/* cost of FADD and FSUB insns.  */
+  COSTS_N_INSNS (5),			/* cost of FMUL instruction.  */
+
+  COSTS_N_INSNS (15),			/* cost of FDIV instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FABS instruction.  */
+  COSTS_N_INSNS (1),			/* cost of FCHS instruction.  */
+
+  COSTS_N_INSNS (22),			/* cost of FSQRT instruction.  */
+
+  COSTS_N_INSNS (1),			/* cost of cheap SSE instruction.  */
+  COSTS_N_INSNS (3),			/* cost of ADDSS/SD SUBSS/SD insns.  */
+  COSTS_N_INSNS (3),			/* cost of MULSS instruction.  */
+  COSTS_N_INSNS (3),			/* cost of MULSD instruction.  */
+  COSTS_N_INSNS (4),			/* cost of FMA SS instruction.  */
+  COSTS_N_INSNS (4),			/* cost of FMA SD instruction.  */
+  COSTS_N_INSNS (13),			/* cost of DIVSS instruction.  */
+
+  COSTS_N_INSNS (10),			/* cost of DIVSD instruction.  */
+  COSTS_N_INSNS (14),			/* cost of SQRTSS instruction.  */
+  COSTS_N_INSNS (20),			/* cost of SQRTSD instruction.  */
+
+  COSTS_N_INSNS (4),			/* cost of CVTSS2SD etc.  */
+  COSTS_N_INSNS (5),			/* cost of 256bit VCVTPS2PD etc.  */
+  COSTS_N_INSNS (10),			/* cost of 512bit VCVTPS2PD etc.  */
+  COSTS_N_INSNS (5),			/* cost of CVTSI2SS instruction.  */
+  COSTS_N_INSNS (5),			/* cost of CVT(T)SS2SI instruction.  */
+  COSTS_N_INSNS (5),			/* cost of CVTPI2PS instruction.  */
+  COSTS_N_INSNS (4),			/* cost of CVT(T)PS2PI instruction.  */
+  4, 4, 3, 6,				/* reassoc int, fp, vec_int, vec_fp.  */
+  {8, 8, 6},				/* latency times throughput of
+					   FMA/DOT_PROD_EXPR/SAD_EXPR,
+					   it's used to determine unroll
+					   factor in the vectorizer.  */
+  4,					/* Limit how much the autovectorizer
+					   may unroll a loop.  */
+  c86_4g_m4_memcpy,
+  c86_4g_m4_memset,
+  COSTS_N_INSNS (4),			/* cond_taken_branch_cost.  */
+  COSTS_N_INSNS (2),			/* cond_not_taken_branch_cost.  */
+  "16",					/* Loop alignment.  */
+  "16",					/* Jump alignment.  */
+  "0:0:8",				/* Label alignment.  */
+  "16",					/* Func alignment.  */
+  4,					/* Small unroll limit.  */
+  2,					/* Small unroll factor.  */
+  COSTS_N_INSNS (2),			/* Branch mispredict scale.  */
+};
diff --git a/gcc/config/i386/x86-tune-sched.cc b/gcc/config/i386/x86-tune-sched.cc
index e22676577895..4fc955a12a5a 100644
--- a/gcc/config/i386/x86-tune-sched.cc
+++ b/gcc/config/i386/x86-tune-sched.cc
@@ -91,6 +91,9 @@ ix86_issue_rate (void)
        is limits of the decoders.  */
     case PROCESSOR_ZNVER5:
     case PROCESSOR_ZNVER6:
+    case PROCESSOR_C86_4G_M4:
+    case PROCESSOR_C86_4G_M6:
+    case PROCESSOR_C86_4G_M7:
       return 4;
 
     case PROCESSOR_ICELAKE_CLIENT:
@@ -440,6 +443,9 @@ ix86_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost,
     case PROCESSOR_ZNVER4:
     case PROCESSOR_ZNVER5:
     case PROCESSOR_ZNVER6:
+    case PROCESSOR_C86_4G_M4:
+    case PROCESSOR_C86_4G_M6:
+    case PROCESSOR_C86_4G_M7:
       /* Stack engine allows to execute push&pop instructions in parall.  */
       if ((insn_type == TYPE_PUSH || insn_type == TYPE_POP)
 	  && (dep_insn_type == TYPE_PUSH || dep_insn_type == TYPE_POP))
diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def
index 9c1e586bc023..5f070e9c09f5 100644
--- a/gcc/config/i386/x86-tune.def
+++ b/gcc/config/i386/x86-tune.def
@@ -42,7 +42,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 DEF_TUNE (X86_TUNE_SCHEDULE, "schedule",
           m_PENT | m_LAKEMONT | m_PPRO | m_CORE_ALL | m_BONNELL | m_SILVERMONT
 	  | m_INTEL | m_K6_GEODE | m_AMD_MULTIPLE | m_ZHAOXIN | m_GOLDMONT
-	  | m_GOLDMONT_PLUS | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM
+	  | m_GOLDMONT_PLUS | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G
 	  | m_GENERIC)
 
 /* X86_TUNE_PARTIAL_REG_DEPENDENCY: Enable more register renaming
@@ -53,7 +53,7 @@ DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency",
           m_P4_NOCONA | m_CORE2 | m_NEHALEM  | m_SANDYBRIDGE | m_CORE_AVX2
 	  | m_BONNELL | m_SILVERMONT | m_GOLDMONT | m_GOLDMONT_PLUS | m_INTEL
 	  | m_AMD_MULTIPLE | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID
-	  | m_CORE_ATOM | m_GENERIC)
+	  | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: This knob promotes all store
    destinations to be 128bit to allow register renaming on 128bit SSE units,
@@ -64,7 +64,7 @@ DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency",
 DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY, "sse_partial_reg_dependency",
           m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10
 	  | m_BDVER | m_ZNVER | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID
-	  | m_CORE_ATOM | m_GENERIC)
+	  | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY: This knob avoids
    partial write to the destination in scalar SSE conversion from FP
@@ -73,7 +73,7 @@ DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY,
 	  "sse_partial_reg_fp_converts_dependency",
 	  m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10
 	  | m_BDVER | m_ZNVER | m_ZHAOXIN | m_CORE_HYBRID | m_CORE_ATOM
-	  | m_GENERIC)
+	  | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY: This knob avoids partial
    write to the destination in scalar SSE conversion from integer to FP.  */
@@ -81,7 +81,7 @@ DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY,
 	  "sse_partial_reg_converts_dependency",
 	  m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10
 	  | m_BDVER | m_ZNVER | m_ZHAOXIN | m_CORE_HYBRID | m_CORE_ATOM
-	  | m_GENERIC)
+	  | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_DEST_FALSE_DEP_FOR_GLC: This knob inserts zero-idiom before
    several insns to break false dependency on the dest register for GLC
@@ -113,32 +113,33 @@ DEF_TUNE (X86_TUNE_MOVX, "movx",
           m_PPRO | m_P4_NOCONA | m_CORE2 | m_NEHALEM  | m_SANDYBRIDGE
 	  | m_BONNELL | m_SILVERMONT | m_GOLDMONT | m_INTEL
 	  | m_GOLDMONT_PLUS | m_GEODE | m_AMD_MULTIPLE | m_ZHAOXIN
-	  | m_CORE_AVX2 | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_CORE_AVX2 | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM
+	  | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_MEMORY_MISMATCH_STALL: Avoid partial stores that are followed by
    full sized loads.  */
 DEF_TUNE (X86_TUNE_MEMORY_MISMATCH_STALL, "memory_mismatch_stall",
           m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL
 	  | m_GOLDMONT | m_GOLDMONT_PLUS | m_AMD_MULTIPLE | m_ZHAOXIN
-	  | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_FUSE_CMP_AND_BRANCH_32: Fuse compare with a subsequent
    conditional jump instruction for 32 bit TARGET.  */
 DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_32, "fuse_cmp_and_branch_32",
-	  m_CORE_ALL | m_BDVER | m_ZNVER | m_ZHAOXIN | m_GENERIC)
+	  m_CORE_ALL | m_BDVER | m_ZNVER | m_ZHAOXIN | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_FUSE_CMP_AND_BRANCH_64: Fuse compare with a subsequent
    conditional jump instruction for TARGET_64BIT.  */
 DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_64, "fuse_cmp_and_branch_64",
 	  m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BDVER
-	  | m_ZNVER | m_ZHAOXIN | m_GENERIC)
+	  | m_ZNVER | m_ZHAOXIN | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS: Fuse compare with a
    subsequent conditional jump instruction when the condition jump
    check sign flag (SF) or overflow flag (OF).  */
 DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS, "fuse_cmp_and_branch_soflags",
 	  m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BDVER
-	  | m_ZNVER | m_ZHAOXIN | m_GENERIC)
+	  | m_ZNVER | m_ZHAOXIN | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_FUSE_ALU_AND_BRANCH: Fuse alu with a subsequent conditional
    jump instruction when the alu instruction produces the CCFLAG consumed by
@@ -201,14 +202,15 @@ DEF_TUNE (X86_TUNE_EPILOGUE_USING_MOVE, "epilogue_using_move",
 /* X86_TUNE_USE_LEAVE: Use "leave" instruction in epilogues where it fits.  */
 DEF_TUNE (X86_TUNE_USE_LEAVE, "use_leave",
 	  m_386 | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE | m_ZHAOXIN
-	  | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_PUSH_MEMORY: Enable generation of "push mem" instructions.
    Some chips, like 486 and Pentium works faster with separate load
    and push instructions.  */
 DEF_TUNE (X86_TUNE_PUSH_MEMORY, "push_memory",
           m_386 | m_P4_NOCONA | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE
-	  | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G
+	  | m_GENERIC)
 
 /* X86_TUNE_SINGLE_PUSH: Enable if single push insn is preferred
    over esp subtraction.  */
@@ -292,7 +294,7 @@ DEF_TUNE (X86_TUNE_INTEGER_DFMODE_MOVES, "integer_dfmode_moves",
           ~(m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT
 	    | m_INTEL | m_GEODE | m_AMD_MULTIPLE | m_ZHAOXIN | m_GOLDMONT
 	    | m_GOLDMONT_PLUS | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM
-	    | m_GENERIC))
+	    | m_C86_4G | m_GENERIC))
 
 /* X86_TUNE_OPT_AGU: Optimize for Address Generation Unit. This flag
    will impact LEA instruction selection. */
@@ -339,14 +341,14 @@ DEF_TUNE (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB,
 DEF_TUNE (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES,
 	  "misaligned_move_string_pro_epilogues",
 	  m_386 | m_486 | m_CORE_ALL | m_AMD_MULTIPLE | m_ZHAOXIN | m_TREMONT
-	  | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_USE_SAHF: Controls use of SAHF.  */
 DEF_TUNE (X86_TUNE_USE_SAHF, "use_sahf",
 	  m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT
 	  | m_INTEL | m_K6_GEODE | m_K8 | m_AMDFAM10 | m_BDVER | m_BTVER
 	  | m_ZNVER | m_ZHAOXIN | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT
-	  | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_USE_CLTD: Controls use of CLTD and CTQO instructions.  */
 DEF_TUNE (X86_TUNE_USE_CLTD, "use_cltd",
@@ -357,7 +359,7 @@ DEF_TUNE (X86_TUNE_USE_CLTD, "use_cltd",
 DEF_TUNE (X86_TUNE_USE_BT, "use_bt",
 	  m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL | m_LAKEMONT
 	  | m_AMD_MULTIPLE | m_ZHAOXIN | m_GOLDMONT | m_GOLDMONT_PLUS
-	  | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_AVOID_FALSE_DEP_FOR_BMI: Avoid false dependency
    for bit-manipulation instructions.  */
@@ -391,7 +393,7 @@ DEF_TUNE (X86_TUNE_ONE_IF_CONV_INSN, "one_if_conv_insn",
 /* X86_TUNE_AVOID_MFENCE: Use lock prefixed instructions instead of mfence.  */
 DEF_TUNE (X86_TUNE_AVOID_MFENCE, "avoid_mfence",
 	 m_CORE_ALL | m_BDVER | m_ZNVER | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID
-	 | m_CORE_ATOM | m_GENERIC)
+	 | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_EXPAND_ABS: This enables a new abs pattern by
    generating instructions for abs (x) = (((signed) x >> (W-1) ^ x) -
@@ -419,10 +421,11 @@ DEF_TUNE (X86_TUNE_USE_SIMODE_FIOP, "use_simode_fiop",
           ~(m_PENT | m_LAKEMONT | m_PPRO | m_CORE_ALL | m_BONNELL
 	    | m_SILVERMONT | m_INTEL | m_AMD_MULTIPLE | m_ZHAOXIN | m_GOLDMONT
 	    | m_GOLDMONT_PLUS | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM
-	    | m_GENERIC))
+	    | m_C86_4G | m_GENERIC))
 
 /* X86_TUNE_USE_FFREEP: Use freep instruction instead of fstp.  */
-DEF_TUNE (X86_TUNE_USE_FFREEP, "use_ffreep", m_AMD_MULTIPLE | m_ZHAOXIN)
+DEF_TUNE (X86_TUNE_USE_FFREEP, "use_ffreep", m_AMD_MULTIPLE | m_ZHAOXIN
+	  | m_C86_4G)
 
 /* X86_TUNE_EXT_80387_CONSTANTS: Use fancy 80387 constants, such as PI.  */
 DEF_TUNE (X86_TUNE_EXT_80387_CONSTANTS, "ext_80387_constants",
@@ -446,30 +449,31 @@ DEF_TUNE (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL, "sse_unaligned_load_optimal",
 	  m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_SILVERMONT | m_INTEL
 	  | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_CORE_HYBRID
 	  | m_CORE_ATOM | m_AMDFAM10 | m_BDVER | m_BTVER | m_ZNVER | m_ZHAOXIN
-	  | m_GENERIC)
+	  | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL: Use movups for misaligned stores
    instead of a sequence loading registers by parts.  */
 DEF_TUNE (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL, "sse_unaligned_store_optimal",
 	  m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_SILVERMONT
 	  | m_INTEL | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_CORE_HYBRID
-	  | m_CORE_ATOM | m_BDVER | m_ZNVER | m_ZHAOXIN | m_GENERIC)
+	  | m_CORE_ATOM | m_BDVER | m_ZNVER | m_ZHAOXIN | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL: Use packed single
    precision 128bit instructions instead of double where possible.   */
 DEF_TUNE (X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL, "sse_packed_single_insn_optimal",
-	  m_BDVER | m_ZNVER)
+	  m_BDVER | m_ZNVER | m_C86_4G)
 
 /* X86_TUNE_SSE_TYPELESS_STORES: Always movaps/movups for 128bit stores.   */
 DEF_TUNE (X86_TUNE_SSE_TYPELESS_STORES, "sse_typeless_stores",
 	  m_AMD_MULTIPLE | m_ZHAOXIN | m_CORE_ALL | m_TREMONT | m_CORE_HYBRID
-	  | m_CORE_ATOM | m_GENERIC)
+	  | m_CORE_ATOM | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_SSE_LOAD0_BY_PXOR: Always use pxor to load0 as opposed to
    xorps/xorpd and other variants.  */
 DEF_TUNE (X86_TUNE_SSE_LOAD0_BY_PXOR, "sse_load0_by_pxor",
 	  m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BDVER | m_BTVER | m_ZNVER
-	  | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM | m_GENERIC)
+	  | m_ZHAOXIN | m_TREMONT | m_CORE_HYBRID | m_CORE_ATOM
+	  | m_C86_4G | m_GENERIC)
 
 /* X86_TUNE_INTER_UNIT_MOVES_TO_VEC: Enable moves in from integer
    to SSE registers.  If disabled, the moves will be done by storing
@@ -535,46 +539,49 @@ DEF_TUNE (X86_TUNE_AVOID_4BYTE_PREFIXES, "avoid_4byte_prefixes",
    elements.  */
 DEF_TUNE (X86_TUNE_USE_GATHER_2PARTS, "use_gather_2parts",
 	  ~(m_ZNVER | m_CORE_HYBRID | m_DIAMONDRAPIDS
-	    | m_YONGFENG | m_SHIJIDADAO | m_CORE_ATOM | m_GENERIC | m_GDS))
+	    | m_YONGFENG | m_SHIJIDADAO | m_CORE_ATOM | m_GENERIC | m_GDS
+	    | m_C86_4G))
 
 /* X86_TUNE_USE_SCATTER_2PARTS: Use scater instructions for vectors with 2
    elements.  */
 DEF_TUNE (X86_TUNE_USE_SCATTER_2PARTS, "use_scatter_2parts",
-	  ~(m_ZNVER4 | m_ZNVER5 | m_ZNVER6))
+	  ~(m_ZNVER4 | m_ZNVER5 | m_ZNVER6 | m_C86_4G_M7))
+
 
 /* X86_TUNE_USE_GATHER_4PARTS: Use gather instructions for vectors with 4
    elements.  */
 DEF_TUNE (X86_TUNE_USE_GATHER_4PARTS, "use_gather_4parts",
 	  ~(m_ZNVER | m_CORE_HYBRID | m_DIAMONDRAPIDS
-	    | m_YONGFENG | m_SHIJIDADAO | m_CORE_ATOM | m_GENERIC | m_GDS))
+	    | m_YONGFENG | m_SHIJIDADAO | m_CORE_ATOM | m_GENERIC | m_GDS
+	    | m_C86_4G))
 
 /* X86_TUNE_USE_SCATTER_4PARTS: Use scater instructions for vectors with 4
    elements.  */
 DEF_TUNE (X86_TUNE_USE_SCATTER_4PARTS, "use_scatter_4parts",
-	  ~(m_ZNVER4 | m_ZNVER5 | m_ZNVER6))
+	  ~(m_ZNVER4 | m_ZNVER5 | m_ZNVER6 | m_C86_4G_M7))
 
 /* X86_TUNE_USE_GATHER: Use gather instructions for vectors with 8 or more
    elements.  */
 DEF_TUNE (X86_TUNE_USE_GATHER_8PARTS, "use_gather_8parts",
 	  ~(m_ZNVER | m_CORE_HYBRID | m_CORE_ATOM
-	    | m_YONGFENG | m_SHIJIDADAO | m_GENERIC | m_GDS))
+	    | m_YONGFENG | m_SHIJIDADAO | m_GENERIC | m_GDS | m_C86_4G))
 
 /* X86_TUNE_USE_SCATTER: Use scater instructions for vectors with 8 or more
    elements.  */
 DEF_TUNE (X86_TUNE_USE_SCATTER_8PARTS, "use_scatter_8parts",
-	  ~(m_ZNVER4 | m_ZNVER5 | m_ZNVER6))
+	  ~(m_ZNVER4 | m_ZNVER5 | m_ZNVER6 | m_C86_4G_M7))
 
 /* X86_TUNE_AVOID_128FMA_CHAINS: Avoid creating loops with tight 128bit or
    smaller FMA chain.  */
 DEF_TUNE (X86_TUNE_AVOID_128FMA_CHAINS, "avoid_fma_chains", m_ZNVER
-          | m_YONGFENG | m_SHIJIDADAO | m_GENERIC)
+	  | m_YONGFENG | m_SHIJIDADAO | m_GENERIC | m_C86_4G)
 
 /* X86_TUNE_AVOID_256FMA_CHAINS: Avoid creating loops with tight 256bit or
    smaller FMA chain.  */
 DEF_TUNE (X86_TUNE_AVOID_256FMA_CHAINS, "avoid_fma256_chains",
 	  m_ZNVER2 | m_ZNVER3 | m_ZNVER4 | m_ZNVER5  | m_ZNVER6 | m_CORE_HYBRID
 	  | m_SAPPHIRERAPIDS | m_GRANITERAPIDS | m_GRANITERAPIDS_D
-	  | m_DIAMONDRAPIDS | m_CORE_ATOM | m_GENERIC)
+	  | m_DIAMONDRAPIDS | m_CORE_ATOM | m_GENERIC | m_C86_4G)
 
 /* X86_TUNE_AVOID_512FMA_CHAINS: Avoid creating loops with tight 512bit or
    smaller FMA chain.  */
@@ -597,7 +604,7 @@ DEF_TUNE (X86_TUNE_SSE_MOVCC_USE_BLENDV,
 /* X86_TUNE_V4SI_REDUCTION_PREFER_SHUFD: Prefer pshuf to reduce V16QI,
    V8HI, V8HI, V4SI, V4FI, V2DI modes when lshr are costlier. */
 DEF_TUNE (X86_TUNE_SSE_REDUCTION_PREFER_PSHUF,
-   "sse_reduction_prefer_pshuf", m_ZNVER4 | m_ZNVER5)
+   "sse_reduction_prefer_pshuf", m_ZNVER4 | m_ZNVER5 | m_C86_4G_M7)
 
 /*****************************************************************************/
 /* AVX instruction selection tuning (some of SSE flags affects AVX, too)     */
@@ -632,19 +639,21 @@ DEF_TUNE (X86_TUNE_AVX256_AVOID_VEC_PERM,
 	 "avx256_avoid_vec_perm", m_CORE_ATOM)
 
 /* X86_TUNE_AVX256_SPLIT_REGS: if true, AVX512 ops are split into two AVX256 ops.  */
-DEF_TUNE (X86_TUNE_AVX512_SPLIT_REGS, "avx512_split_regs", m_ZNVER4)
+DEF_TUNE (X86_TUNE_AVX512_SPLIT_REGS, "avx512_split_regs", m_ZNVER4
+	  | m_C86_4G_M7)
 
 /* It's better to align MOVE_MAX with prefer_vector_width to reduce
    risk of STLF stalls(small store followed by big load.)  */
 /* X86_TUNE_AVX256_MOVE_BY_PIECES: Optimize move_by_pieces with 256-bit
    AVX instructions.  */
 DEF_TUNE (X86_TUNE_AVX256_MOVE_BY_PIECES, "avx256_move_by_pieces",
-	  m_CORE_HYBRID | m_CORE_AVX2 | m_ZNVER1 | m_ZNVER2 | m_ZNVER3)
+	  m_CORE_HYBRID | m_CORE_AVX2 | m_ZNVER1 | m_ZNVER2 | m_ZNVER3
+	  | m_C86_4G_M4 | m_C86_4G_M6)
 
 /* X86_TUNE_AVX512_MOVE_BY_PIECES: Optimize move_by_pieces with 512-bit
    AVX instructions.  */
 DEF_TUNE (X86_TUNE_AVX512_MOVE_BY_PIECES, "avx512_move_by_pieces",
-	   m_ZNVER4 | m_ZNVER5 | m_ZNVER6)
+	   m_ZNVER4 | m_ZNVER5 | m_ZNVER6 | m_C86_4G_M7)
 
 /* X86_TUNE_AVX512_TWO_EPILOGUES: Use two vector epilogues for 512-bit
    vectorized loops.  */
@@ -654,7 +663,7 @@ DEF_TUNE (X86_TUNE_AVX512_TWO_EPILOGUES, "avx512_two_epilogues",
 /* X86_TUNE_AVX512_MAKED_EPILOGUES: Use two masked vector epilogues
    when fit.  */
 DEF_TUNE (X86_TUNE_AVX512_MASKED_EPILOGUES, "avx512_masked_epilogues",
-	  m_ZNVER4 | m_ZNVER5 | m_ZNVER6)
+	  m_ZNVER4 | m_ZNVER5 | m_ZNVER6 | m_C86_4G_M7)
 
 /*****************************************************************************/
 /*****************************************************************************/
@@ -796,4 +805,4 @@ DEF_TUNE (X86_TUNE_PROMOTE_QI_REGS, "promote_qi_regs", m_NONE)
 DEF_TUNE (X86_TUNE_SLOW_STC, "slow_stc", m_PENT4)
 
 /* X86_TUNE_USE_RCR: Controls use of rcr 1 instruction instead of shrd.  */
-DEF_TUNE (X86_TUNE_USE_RCR, "use_rcr", m_AMD_MULTIPLE)
+DEF_TUNE (X86_TUNE_USE_RCR, "use_rcr", m_AMD_MULTIPLE | m_C86_4G)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 47e0865c676c..236df039bea4 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29051,6 +29051,18 @@ AMD Family 1ah Zen version 5.
 
 @item znver6
 AMD Family 1ah Zen version 6.
+
+@item hygonfam18h
+HYGON Family 18h CPU.
+
+@item c86-4g-m4
+HYGON Family 18h model 4 dharma CPU.
+
+@item c86-4g-m6
+HYGON Family 18h model 6 shanghai CPU.
+
+@item c86-4g-m7
+HYGON Family 18h model 7 chengdu CPU.
 @end table
 
 Here is an example:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f2b50c315ff3..d6e43d969aa5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -35391,6 +35391,27 @@ instruction set support.
 
 @item geode
 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
+
+@item c86-4g-m4
+HYGON c86-4g-m4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSE4A, CX16, ABM, SSSE3,
+SSE4.1, SSE4.2, AES, PCLMUL, AVX, AVX2, BMI, BMI2, F16C, FMA, PRFCHW, FXSR, SHA,
+XSAVE, XSAVEOPT, XSAVEC, FSGSBASE, RDRND, MOVBE, MWAITX, ADX, RDSEED, CLZERO,
+CLFLUSHOPT, XSAVES, LZCNT, POPCNT instruction set support.
+
+@item c86-4g-m6
+HYGON c86-4g-m6 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSE4A, CX16, ABM, SSSE3,
+SSE4.1, SSE4.2, AES, PCLMUL, AVX, AVX2, BMI, BMI2, F16C, FMA, PRFCHW, FXSR, SHA,
+XSAVE, XSAVEOPT, XSAVEC, FSGSBASE, RDRND, MOVBE, MWAITX, ADX, RDSEED, CLZERO,
+CLFLUSHOPT, XSAVES, LZCNT, POPCNT instruction set support.
+
+@item c86-4g-m7
+HYGON c86-4g-m7 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSE4A, CX16, ABM, SSSE3,
+SSE4.1, SSE4.2, AES, PCLMUL, AVX, AVX2, BMI, BMI2, F16C, FMA, PRFCHW, FXSR, SHA,
+XSAVE, XSAVEOPT, XSAVEC, FSGSBASE, RDRND, MOVBE, MWAITX, ADX, RDSEED, CLZERO,
+CLFLUSHOPT, XSAVES, LZCNT, POPCNT, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
+AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, GFNI, AVX512VNNI, VAES,
+AVX512BITALG, AVX512VPOPCNTDQ, AVX512VP2INTERSECT, AVXVNNI, VPCLMULQDQ,
+WBNOINVD instruction set support.
 @end table
 
 @opindex mtune
diff --git a/gcc/testsuite/g++.target/i386/mv33.C b/gcc/testsuite/g++.target/i386/mv33.C
new file mode 100644
index 000000000000..8591690d2ccf
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/mv33.C
@@ -0,0 +1,42 @@
+// Test that dispatching can choose the right multiversion
+// for HYGON CPUs with the same internal GCC processor id
+
+// { dg-do run }
+// { dg-require-ifunc "" }
+// { dg-options "-O2" }
+
+#include <assert.h>
+
+int __attribute__ ((target("default")))
+foo ()
+{
+  return 0;
+}
+
+int __attribute__ ((target("arch=c86-4g-m4"))) foo () {
+  return 1;
+}
+
+int __attribute__ ((target("arch=c86-4g-m6"))) foo () {
+  return 2;
+}
+
+int __attribute__ ((target("arch=c86-4g-m7"))) foo () {
+  return 3;
+}
+
+int main ()
+{
+  int val = foo ();
+
+  if  (__builtin_cpu_is ("c86-4g-m4"))
+    assert (val == 1);
+  else if (__builtin_cpu_is ("c86-4g-m6"))
+    assert (val == 2);
+  else if (__builtin_cpu_is ("c86-4g-m7"))
+    assert (val == 3);
+  else
+    assert (val == 0);
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/builtin_target.c b/gcc/testsuite/gcc.target/i386/builtin_target.c
index 45554d8771d2..f26ba2be4c2d 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_target.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_target.c
@@ -54,6 +54,10 @@ check_detailed ()
       assert (__builtin_cpu_is ("amd"));
       get_amd_cpu (&cpu_model, &cpu_model2, cpu_features2);
       break;
+    case VENDOR_HYGON:
+      assert (__builtin_cpu_is ("hygon"));
+      get_hygon_cpu (&cpu_model, &cpu_model2, cpu_features2);
+      break;
     default:
       break;
     }
@@ -127,6 +131,8 @@ quick_check ()
 
   assert (__builtin_cpu_is ("bdver2") >= 0);
 
+  assert (__builtin_cpu_is ("c86-4g-m4") >= 0);
+
   return 0;
 }
 
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
index aa395185bc7a..43ccaa9d99f1 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc
+++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
@@ -239,6 +239,9 @@ extern void test_arch_znver3 (void)             __attribute__((__target__("arch=
 extern void test_arch_znver4 (void)             __attribute__((__target__("arch=znver4")));
 extern void test_arch_znver5 (void)             __attribute__((__target__("arch=znver5")));
 extern void test_arch_znver6 (void)             __attribute__((__target__("arch=znver6")));
+extern void test_arch_c86_4g_m4 (void)          __attribute__((__target__("arch=c86-4g-m4")));
+extern void test_arch_c86_4g_m6 (void)          __attribute__((__target__("arch=c86-4g-m6")));
+extern void test_arch_c86_4g_m7 (void)          __attribute__((__target__("arch=c86-4g-m7")));
 
 extern void test_tune_nocona (void)		__attribute__((__target__("tune=nocona")));
 extern void test_tune_core2 (void)		__attribute__((__target__("tune=core2")));
@@ -267,6 +270,9 @@ extern void test_tune_znver3 (void)             __attribute__((__target__("tune=
 extern void test_tune_znver4 (void)             __attribute__((__target__("tune=znver4")));
 extern void test_tune_znver5 (void)             __attribute__((__target__("tune=znver5")));
 extern void test_tune_znver6 (void)             __attribute__((__target__("tune=znver6")));
+extern void test_tune_c86_4g_m4 (void)          __attribute__((__target__("tune=c86-4g-m4")));
+extern void test_tune_c86_4g_m6 (void)          __attribute__((__target__("tune=c86-4g-m6")));
+extern void test_tune_c86_4g_m7 (void)          __attribute__((__target__("tune=c86-4g-m7")));
 
 extern void test_fpmath_sse (void)		__attribute__((__target__("sse2,fpmath=sse")));
 extern void test_fpmath_387 (void)		__attribute__((__target__("sse2,fpmath=387")));


More information about the Gcc-cvs mailing list