Re: [PATCH V2] Rename ufix_trunc/ufloat* patterns to fixuns_trunc/floatuns* to align with standard pattern name.

2023-03-30 Thread Uros Bizjak via Gcc-patches
On Thu, Mar 30, 2023 at 1:43 PM liuhongt  wrote:
>
> > > Just rename the instruction and fix all its call sites. The name of
> > > the insn pattern is internal to the compiler and can be renamed at
> > > will.
> >
> > Ideally, we should standardize all the names to a standard name, so
> > e.g. ufix_  -> fixuns_ and ufloat -> floatuns.
>
> Updated.
>
> There's some typo for the standard pattern name for unsigned_{float,fix},
> it should be floatunsmn2/fixuns_truncmn2, not ufloatmn2/ufix_truncmn2
> in current trunk, the patch fix the typo, also change all though
> ufix_trunc/ufloat patterns.
>
> Also vcvttps2udq is available under AVX512VL, so it can be generated
> directly instead of being emulated via vcvttps2dq.
>
> gcc/ChangeLog:
>
> PR target/85048
> * config/i386/i386-builtin.def (BDESC): Adjust icode name from 
> ufloat/ufix to floatuns/fixuns.
> * config/i386/i386-expand.cc (ix86_expand_vector_convert_uns_vsivsf): 
> Adjust comments.
> * config/i386/sse.md 
> (ufloat2):
> Renamed to ..
> 
> (floatuns2):.. 
> this.
> 
> (_ufix_notrunc):
> Renamed to ..
> 
> (_fixuns_notrunc):
> .. this.
> (fix_truncv16sfv16si2):
> Renamed to ..
> 
> (fix_truncv16sfv16si2):.. this.
> (ufloat2): Renamed to ..
> (floatuns2): .. this.
> (ufloatv2siv2df2): Renamed to ..
> (floatunsv2siv2df2): .. this.
> (ufix_notrunc2):
> Renamed to ..
> (fixuns_notrunc2):
> .. this.
> (ufix_notruncv2dfv2si2): Renamed to ..
> (fixuns_notruncv2dfv2si2):.. this.
> (ufix_notruncv2dfv2si2_mask): Renamed to ..
> (fixuns_notruncv2dfv2si2_mask): .. this.
> (*ufix_notruncv2dfv2si2_mask_1): Renamed to ..
> (*fixuns_notruncv2dfv2si2_mask_1): .. this.
> (ufix_truncv2dfv2si2): Renamed to ..
> (*fixuns_truncv2dfv2si2): .. this.
> (ufix_truncv2dfv2si2_mask): Renamed to ..
> (fixuns_truncv2dfv2si2_mask): .. this.
> (*ufix_truncv2dfv2si2_mask_1): Renamed to ..
> (*fixuns_truncv2dfv2si2_mask_1): .. this.
> (ufix_truncv4dfv4si2): Renamed to ..
> (fixuns_truncv4dfv4si2): .. this.
> (ufix_notrunc2):
> Renamed to ..
> (fixuns_notrunc2):
> .. this.
> (ufix_trunc2): Renamed to ..
> (fixuns_trunc2):
> .. this.
>
> gcc/testsuite/ChangeLog:
>
> * g++.target/i386/pr85048.C: New test.

OK for trunk.

Thanks,
Uros.

> ---
>  gcc/config/i386/i386-builtin.def| 40 +++---
>  gcc/config/i386/i386-expand.cc  |  2 +-
>  gcc/config/i386/sse.md  | 69 +++--
>  gcc/testsuite/g++.target/i386/pr85048.C | 33 
>  4 files changed, 84 insertions(+), 60 deletions(-)
>  create mode 100644 gcc/testsuite/g++.target/i386/pr85048.C
>
> diff --git a/gcc/config/i386/i386-builtin.def 
> b/gcc/config/i386/i386-builtin.def
> index 17dfe40fac7..6dae6972d81 100644
> --- a/gcc/config/i386/i386-builtin.def
> +++ b/gcc/config/i386/i386-builtin.def
> @@ -1384,7 +1384,7 @@ BDESC (OPTION_MASK_ISA_AVX512F, 0, 
> CODE_FOR_avx512f_compressv8df_mask, "__builti
>  BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_compressv16sf_mask, 
> "__builtin_ia32_compresssf512_mask", IX86_BUILTIN_COMPRESSPS512, UNKNOWN, 
> (int) V16SF_FTYPE_V16SF_V16SF_UHI)
>  BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_floatv8siv8df2_mask, 
> "__builtin_ia32_cvtdq2pd512_mask", IX86_BUILTIN_CVTDQ2PD512, UNKNOWN, (int) 
> V8DF_FTYPE_V8SI_V8DF_UQI)
>  BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_vcvtps2ph512_mask_sae,  
> "__builtin_ia32_vcvtps2ph512_mask", IX86_BUILTIN_CVTPS2PH512, UNKNOWN, (int) 
> V16HI_FTYPE_V16SF_INT_V16HI_UHI)
> -BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_ufloatv8siv8df2_mask, 
> "__builtin_ia32_cvtudq2pd512_mask", IX86_BUILTIN_CVTUDQ2PD512, UNKNOWN, (int) 
> V8DF_FTYPE_V8SI_V8DF_UQI)
> +BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_floatunsv8siv8df2_mask, 
> "__builtin_ia32_cvtudq2pd512_mask", IX86_BUILTIN_CVTUDQ2PD512, UNKNOWN, (int) 
> V8DF_FTYPE_V8SI_V8DF_UQI)
>  BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_cvtusi2sd32, 
> "__builtin_ia32_cvtusi2sd32", IX86_BUILTIN_CVTUSI2SD32, UNKNOWN, (int) 
> V2DF_FTYPE_V2DF_UINT)
>  BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_expandv8df_mask, 
> "__builtin_ia32_expanddf512_mask", IX86_BUILTIN_EXPANDPD512, UNKNOWN, (int) 
> V8DF_FTYPE_V8DF_V8DF_UQI)
>  BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_expandv8df_maskz, 
> "__builtin_ia32_expanddf512_maskz", IX86_BUILTIN_EXPANDPD512Z, UNKNOWN, (int) 
> V8DF_FTYPE_V8DF_V8DF_UQI)
> @@ -1719,32 +1719,32 @@ BDESC (OPTION_MASK_ISA_AVX512DQ | 
> OPTION_MASK_ISA_AVX512VL, 0, CODE_FOR_fixuns_t
>  BDESC (OPTION_MASK_ISA_AVX512DQ | OPTION_MASK_ISA_AVX512VL, 0, 
> CODE_FOR_fixuns_truncv2dfv2di2_mask, "__builtin_ia32_cvttpd2uqq128_mask", 
> IX86_BUILTIN_CVTTPD2UQQ128, UNKNOWN, (int) V2DI_FTYPE_V2DF_V2DI_UQI)
>  BDESC 

[PATCH V2] Rename ufix_trunc/ufloat* patterns to fixuns_trunc/floatuns* to align with standard pattern name.

2023-03-30 Thread liuhongt via Gcc-patches
> > Just rename the instruction and fix all its call sites. The name of
> > the insn pattern is internal to the compiler and can be renamed at
> > will.
>
> Ideally, we should standardize all the names to a standard name, so
> e.g. ufix_  -> fixuns_ and ufloat -> floatuns.

Updated.

There's some typo for the standard pattern name for unsigned_{float,fix},
it should be floatunsmn2/fixuns_truncmn2, not ufloatmn2/ufix_truncmn2
in current trunk, the patch fix the typo, also change all though
ufix_trunc/ufloat patterns.

Also vcvttps2udq is available under AVX512VL, so it can be generated
directly instead of being emulated via vcvttps2dq.

gcc/ChangeLog:

PR target/85048
* config/i386/i386-builtin.def (BDESC): Adjust icode name from 
ufloat/ufix to floatuns/fixuns.
* config/i386/i386-expand.cc (ix86_expand_vector_convert_uns_vsivsf): 
Adjust comments.
* config/i386/sse.md 
(ufloat2):
Renamed to ..

(floatuns2):.. 
this.

(_ufix_notrunc):
Renamed to ..

(_fixuns_notrunc):
.. this.
(fix_truncv16sfv16si2):
Renamed to ..
(fix_truncv16sfv16si2):.. 
this.
(ufloat2): Renamed to ..
(floatuns2): .. this.
(ufloatv2siv2df2): Renamed to ..
(floatunsv2siv2df2): .. this.
(ufix_notrunc2):
Renamed to ..
(fixuns_notrunc2):
.. this.
(ufix_notruncv2dfv2si2): Renamed to ..
(fixuns_notruncv2dfv2si2):.. this.
(ufix_notruncv2dfv2si2_mask): Renamed to ..
(fixuns_notruncv2dfv2si2_mask): .. this.
(*ufix_notruncv2dfv2si2_mask_1): Renamed to ..
(*fixuns_notruncv2dfv2si2_mask_1): .. this.
(ufix_truncv2dfv2si2): Renamed to ..
(*fixuns_truncv2dfv2si2): .. this.
(ufix_truncv2dfv2si2_mask): Renamed to ..
(fixuns_truncv2dfv2si2_mask): .. this.
(*ufix_truncv2dfv2si2_mask_1): Renamed to ..
(*fixuns_truncv2dfv2si2_mask_1): .. this.
(ufix_truncv4dfv4si2): Renamed to ..
(fixuns_truncv4dfv4si2): .. this.
(ufix_notrunc2):
Renamed to ..
(fixuns_notrunc2):
.. this.
(ufix_trunc2): Renamed to ..
(fixuns_trunc2):
.. this.

gcc/testsuite/ChangeLog:

* g++.target/i386/pr85048.C: New test.
---
 gcc/config/i386/i386-builtin.def| 40 +++---
 gcc/config/i386/i386-expand.cc  |  2 +-
 gcc/config/i386/sse.md  | 69 +++--
 gcc/testsuite/g++.target/i386/pr85048.C | 33 
 4 files changed, 84 insertions(+), 60 deletions(-)
 create mode 100644 gcc/testsuite/g++.target/i386/pr85048.C

diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def
index 17dfe40fac7..6dae6972d81 100644
--- a/gcc/config/i386/i386-builtin.def
+++ b/gcc/config/i386/i386-builtin.def
@@ -1384,7 +1384,7 @@ BDESC (OPTION_MASK_ISA_AVX512F, 0, 
CODE_FOR_avx512f_compressv8df_mask, "__builti
 BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_compressv16sf_mask, 
"__builtin_ia32_compresssf512_mask", IX86_BUILTIN_COMPRESSPS512, UNKNOWN, (int) 
V16SF_FTYPE_V16SF_V16SF_UHI)
 BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_floatv8siv8df2_mask, 
"__builtin_ia32_cvtdq2pd512_mask", IX86_BUILTIN_CVTDQ2PD512, UNKNOWN, (int) 
V8DF_FTYPE_V8SI_V8DF_UQI)
 BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_vcvtps2ph512_mask_sae,  
"__builtin_ia32_vcvtps2ph512_mask", IX86_BUILTIN_CVTPS2PH512, UNKNOWN, (int) 
V16HI_FTYPE_V16SF_INT_V16HI_UHI)
-BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_ufloatv8siv8df2_mask, 
"__builtin_ia32_cvtudq2pd512_mask", IX86_BUILTIN_CVTUDQ2PD512, UNKNOWN, (int) 
V8DF_FTYPE_V8SI_V8DF_UQI)
+BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_floatunsv8siv8df2_mask, 
"__builtin_ia32_cvtudq2pd512_mask", IX86_BUILTIN_CVTUDQ2PD512, UNKNOWN, (int) 
V8DF_FTYPE_V8SI_V8DF_UQI)
 BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_cvtusi2sd32, 
"__builtin_ia32_cvtusi2sd32", IX86_BUILTIN_CVTUSI2SD32, UNKNOWN, (int) 
V2DF_FTYPE_V2DF_UINT)
 BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_expandv8df_mask, 
"__builtin_ia32_expanddf512_mask", IX86_BUILTIN_EXPANDPD512, UNKNOWN, (int) 
V8DF_FTYPE_V8DF_V8DF_UQI)
 BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_expandv8df_maskz, 
"__builtin_ia32_expanddf512_maskz", IX86_BUILTIN_EXPANDPD512Z, UNKNOWN, (int) 
V8DF_FTYPE_V8DF_V8DF_UQI)
@@ -1719,32 +1719,32 @@ BDESC (OPTION_MASK_ISA_AVX512DQ | 
OPTION_MASK_ISA_AVX512VL, 0, CODE_FOR_fixuns_t
 BDESC (OPTION_MASK_ISA_AVX512DQ | OPTION_MASK_ISA_AVX512VL, 0, 
CODE_FOR_fixuns_truncv2dfv2di2_mask, "__builtin_ia32_cvttpd2uqq128_mask", 
IX86_BUILTIN_CVTTPD2UQQ128, UNKNOWN, (int) V2DI_FTYPE_V2DF_V2DI_UQI)
 BDESC (OPTION_MASK_ISA_AVX512DQ | OPTION_MASK_ISA_AVX512VL, 0, 
CODE_FOR_fix_notruncv4dfv4di2_mask, "__builtin_ia32_cvtpd2qq256_mask", 
IX86_BUILTIN_CVTPD2QQ256, UNKNOWN, (int) V4DI_FTYPE_V4DF_V4DI_UQI)
 BDESC (OPTION_MASK_ISA_AVX512DQ | OPTION_MASK_ISA_AVX512VL, 0, 
CODE_FOR_fix_notruncv2dfv2di2_mask,