Hello, Patch in the bottom updates few UNSPEC insn patterns w/ new mode iterator. Additionally names were slightly changed.
Bootstrapped. AVX-512* tests on top of patch-set all pass under simulator. Is it ok for trunk? gcc/ * config/i386/i386.c (avx512f_getmantv2df_round): Rename to ... (avx512f_vgetmantv2df_round): this. (avx512f_getmantv4sf_round): Rename to ... (avx512f_vgetmantv4sf_round): this. (ix86_expand_args_builtin): Handle avx512vl_getmantv8sf_mask, avx512vl_getmantv4df_mask, avx512vl_getmantv4sf_mask, avx512vl_getmantv2df_mask. (ix86_expand_round_builtin): Handle avx512f_vgetmantv2df_round, avx512f_vgetmantv4sf_round. * config/i386/sse.md (define_insn "avx512f_storeu<ssemodesuffix>512_mask"): Delete. (define_insn "<avx512>_storeu<ssemodesuffix><avxsizesuffix>_mask"): New. (define_insn "<mask_codefor>rcp14<mode><mask_name>"): Use VF_AVX512VL. (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"): Ditto. (define_insn "avx512f_scalef<mode><mask_name><round_name>"): Delete. (define_insn "<avx512>_scalef<mode><mask_name><round_name>"): New. (define_insn "avx512f_getexp<mode><mask_name><round_saeonly_name>"): Delete. (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"): New. (define_expand "avx512f_fixupimm<mode>_maskz<round_saeonly_expand_name>"): Delete. (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"): New. (define_insn "avx512f_fixupimm<mode><sd_maskz_name><round_saeonly_name>"): Delete. (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"): New. (define_insn "avx512f_fixupimm<mode>_mask<round_saeonly_name>"): Delete. (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"): New. (define_insn "avx512f_rndscale<mode><mask_name><round_saeonly_name>"): Delete. (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"): New. (define_insn "avx512f_getmant<mode><mask_name><round_saeonly_name>"): Delete. (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"): New. (define_insn "avx512f_getmant<mode><round_saeonly_name>"): Rename to ... (define_insn "avx512f_vgetmant<mode><round_saeonly_name>"): this. -- Thanks, K diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 61b33782..ff37ffe 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -30317,8 +30317,8 @@ static const struct builtin_description bdesc_round_args[] = { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_sgetexpv4sf_round, "__builtin_ia32_getexpss128_round", IX86_BUILTIN_GETEXPSS128, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT }, { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_getmantv8df_mask_round, "__builtin_ia32_getmantpd512_mask", IX86_BUILTIN_GETMANTPD512, UNKNOWN, (int) V8DF_FTYPE_V8DF_INT_V8DF_QI_INT }, { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_getmantv16sf_mask_round, "__builtin_ia32_getmantps512_mask", IX86_BUILTIN_GETMANTPS512, UNKNOWN, (int) V16SF_FTYPE_V16SF_INT_V16SF_HI_INT }, - { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_getmantv2df_round, "__builtin_ia32_getmantsd_round", IX86_BUILTIN_GETMANTSD128, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT_INT }, - { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_getmantv4sf_round, "__builtin_ia32_getmantss_round", IX86_BUILTIN_GETMANTSS128, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT_INT }, + { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_vgetmantv2df_round, "__builtin_ia32_getmantsd_round", IX86_BUILTIN_GETMANTSD128, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT_INT }, + { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_vgetmantv4sf_round, "__builtin_ia32_getmantss_round", IX86_BUILTIN_GETMANTSS128, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT_INT }, { OPTION_MASK_ISA_AVX512F, CODE_FOR_smaxv8df3_mask_round, "__builtin_ia32_maxpd512_mask", IX86_BUILTIN_MAXPD512, UNKNOWN, (int) V8DF_FTYPE_V8DF_V8DF_V8DF_QI_INT }, { OPTION_MASK_ISA_AVX512F, CODE_FOR_smaxv16sf3_mask_round, "__builtin_ia32_maxps512_mask", IX86_BUILTIN_MAXPS512, UNKNOWN, (int) V16SF_FTYPE_V16SF_V16SF_V16SF_HI_INT }, { OPTION_MASK_ISA_AVX512F, CODE_FOR_sse2_vmsmaxv2df3_round, "__builtin_ia32_maxsd_round", IX86_BUILTIN_MAXSD_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT }, @@ -34110,6 +34110,10 @@ ix86_expand_args_builtin (const struct builtin_description *d, case CODE_FOR_avx_vpermilv4df: case CODE_FOR_avx512f_getmantv8df_mask: case CODE_FOR_avx512f_getmantv16sf_mask: + case CODE_FOR_avx512vl_getmantv8sf_mask: + case CODE_FOR_avx512vl_getmantv4df_mask: + case CODE_FOR_avx512vl_getmantv4sf_mask: + case CODE_FOR_avx512vl_getmantv2df_mask: error ("the last argument must be a 4-bit immediate"); return const0_rtx; @@ -34516,8 +34520,8 @@ ix86_expand_round_builtin (const struct builtin_description *d, { case CODE_FOR_avx512f_getmantv8df_mask_round: case CODE_FOR_avx512f_getmantv16sf_mask_round: - case CODE_FOR_avx512f_getmantv2df_round: - case CODE_FOR_avx512f_getmantv4sf_round: + case CODE_FOR_avx512f_vgetmantv2df_round: + case CODE_FOR_avx512f_vgetmantv4sf_round: error ("the immediate argument must be a 4-bit immediate"); return const0_rtx; case CODE_FOR_avx512f_cmpv8df3_mask_round: diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index b9aa581..d85f9a4 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1170,11 +1170,11 @@ ] (const_string "<MODE>")))]) -(define_insn "avx512f_storeu<ssemodesuffix>512_mask" - [(set (match_operand:VF_512 0 "memory_operand" "=m") - (vec_merge:VF_512 - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "v")] +(define_insn "<avx512>_storeu<ssemodesuffix><avxsizesuffix>_mask" + [(set (match_operand:VF_AVX512VL 0 "memory_operand" "=m") + (vec_merge:VF_AVX512VL + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "v")] UNSPEC_STOREU) (match_dup 0) (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))] @@ -1183,6 +1183,8 @@ switch (get_attr_mode (insn)) { case MODE_V16SF: + case MODE_V8SF: + case MODE_V4SF: return "vmovups\t{%1, %0%{%2%}|%0%{%2%}, %1}"; default: return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"; @@ -1702,9 +1704,9 @@ (set_attr "mode" "SF")]) (define_insn "<mask_codefor>rcp14<mode><mask_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 - [(match_operand:VF_512 1 "nonimmediate_operand" "vm")] + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")] UNSPEC_RCP14))] "TARGET_AVX512F" "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}" @@ -1797,9 +1799,9 @@ (set_attr "mode" "<MODE>")]) (define_insn "<mask_codefor>rsqrt14<mode><mask_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 - [(match_operand:VF_512 1 "nonimmediate_operand" "vm")] + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")] UNSPEC_RSQRT14))] "TARGET_AVX512F" "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}" @@ -7110,11 +7112,11 @@ [(set_attr "prefix" "evex") (set_attr "mode" "<ssescalarmode>")]) -(define_insn "avx512f_scalef<mode><mask_name><round_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "v") - (match_operand:VF_512 2 "<round_nimm_predicate>" "<round_constraint>")] +(define_insn "<avx512>_scalef<mode><mask_name><round_name>" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "v") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")] UNSPEC_SCALEF))] "TARGET_AVX512F" "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}" @@ -7167,9 +7169,9 @@ (set_attr "prefix" "evex") (set_attr "mode" "<sseinsnmode>")]) -(define_insn "avx512f_getexp<mode><mask_name><round_saeonly_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")] +(define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")] UNSPEC_GETEXP))] "TARGET_AVX512F" "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"; @@ -7233,28 +7235,28 @@ }) -(define_expand "avx512f_fixupimm<mode>_maskz<round_saeonly_expand_name>" - [(match_operand:VF_512 0 "register_operand") - (match_operand:VF_512 1 "register_operand") - (match_operand:VF_512 2 "register_operand") +(define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>" + [(match_operand:VF_AVX512VL 0 "register_operand") + (match_operand:VF_AVX512VL 1 "register_operand") + (match_operand:VF_AVX512VL 2 "register_operand") (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>") (match_operand:SI 4 "const_0_to_255_operand") (match_operand:<avx512fmaskmode> 5 "register_operand")] "TARGET_AVX512F" { - emit_insn (gen_avx512f_fixupimm<mode>_maskz_1<round_saeonly_expand_name> ( + emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> ( operands[0], operands[1], operands[2], operands[3], operands[4], CONST0_RTX (<MODE>mode), operands[5] <round_saeonly_expand_operand6>)); DONE; }) -(define_insn "avx512f_fixupimm<mode><sd_maskz_name><round_saeonly_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "0") - (match_operand:VF_512 2 "register_operand" "v") - (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>") +(define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "0") + (match_operand:VF_AVX512VL 2 "register_operand" "v") + (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>") (match_operand:SI 4 "const_0_to_255_operand")] UNSPEC_FIXUPIMM))] "TARGET_AVX512F" @@ -7262,13 +7264,13 @@ [(set_attr "prefix" "evex") (set_attr "mode" "<MODE>")]) -(define_insn "avx512f_fixupimm<mode>_mask<round_saeonly_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (vec_merge:VF_512 - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "0") - (match_operand:VF_512 2 "register_operand" "v") - (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>") +(define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (vec_merge:VF_AVX512VL + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "0") + (match_operand:VF_AVX512VL 2 "register_operand" "v") + (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>") (match_operand:SI 4 "const_0_to_255_operand")] UNSPEC_FIXUPIMM) (match_dup 1) @@ -7329,10 +7331,10 @@ [(set_attr "prefix" "evex") (set_attr "mode" "<ssescalarmode>")]) -(define_insn "avx512f_rndscale<mode><mask_name><round_saeonly_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 - [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>") +(define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>") (match_operand:SI 2 "const_0_to_255_operand")] UNSPEC_ROUND))] "TARGET_AVX512F" @@ -16758,10 +16760,10 @@ (set_attr "memory" "none,load") (set_attr "mode" "<sseinsnmode>")]) -(define_insn "avx512f_getmant<mode><mask_name><round_saeonly_name>" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (unspec:VF_512 - [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>") +(define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>") (match_operand:SI 2 "const_0_to_15_operand")] UNSPEC_GETMANT))] "TARGET_AVX512F" @@ -16769,7 +16771,7 @@ [(set_attr "prefix" "evex") (set_attr "mode" "<MODE>")]) -(define_insn "avx512f_getmant<mode><round_saeonly_name>" +(define_insn "avx512f_vgetmant<mode><round_saeonly_name>" [(set (match_operand:VF_128 0 "register_operand" "=v") (vec_merge:VF_128 (unspec:VF_128