public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103753] New: Unoptimal avx2 V16HF vector insert to element 0
@ 2021-12-16 19:55 ubizjak at gmail dot com
2021-12-16 21:53 ` [Bug target/103753] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2021-12-16 19:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103753
Bug ID: 103753
Summary: Unoptimal avx2 V16HF vector insert to element 0
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
(Cloned from PR103571#18)
Following testcase:
--cut here--
typedef _Float16 __v16hf __attribute__ ((__vector_size__ (32)));
__v16hf foo (_Float16 x)
{
return (__v16hf) { x, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
}
--cut here--
compiles with -O2 -mavx2 to:
vpxor %xmm1, %xmm1, %xmm1
vpbroadcastw %xmm0, %ymm0
vpblendw $1, %ymm0, %ymm1, %ymm0
vpblendd $15, %ymm0, %ymm1, %ymm1
vmovdqa %ymm1, %ymm0
ret
while similar version with 16bit integer:
--cut here--
typedef short __v16hi __attribute__ ((__vector_size__ (32)));
__v16hi bar (short x)
{
return (__v16hi) { x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
}
--cut here--
compiles to much shorter:
vpxor %xmm1, %xmm1, %xmm1
vpinsrw $0, %edi, %xmm1, %xmm0
vinserti128 $0x1, %xmm1, %ymm0, %ymm0
ret
Please also note that with -O2 -mavx, the _Float16 version compiles to optimal:
vpxor %xmm1, %xmm1, %xmm1
vpblendw $1, %xmm0, %xmm1, %xmm0
vinsertf128 $0x1, %xmm1, %ymm0, %ymm0
ret
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/103753] Unoptimal avx2 V16HF vector insert to element 0
2021-12-16 19:55 [Bug target/103753] New: Unoptimal avx2 V16HF vector insert to element 0 ubizjak at gmail dot com
@ 2021-12-16 21:53 ` pinskia at gcc dot gnu.org
2022-01-07 3:08 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-16 21:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103753
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/103753] Unoptimal avx2 V16HF vector insert to element 0
2021-12-16 19:55 [Bug target/103753] New: Unoptimal avx2 V16HF vector insert to element 0 ubizjak at gmail dot com
2021-12-16 21:53 ` [Bug target/103753] " pinskia at gcc dot gnu.org
@ 2022-01-07 3:08 ` cvs-commit at gcc dot gnu.org
2022-01-07 3:09 ` crazylht at gmail dot com
2022-01-07 3:21 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-07 3:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103753
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:
https://gcc.gnu.org/g:1f759dbdcddd5eae795da48f46edae274a431cbc
commit r12-6337-g1f759dbdcddd5eae795da48f46edae274a431cbc
Author: liuhongt <hongtao.liu@intel.com>
Date: Wed Jan 5 15:26:18 2022 +0800
Optimize V16HF vector insert to element 0 for AVX2.
gcc/ChangeLog:
PR target/103753
* config/i386/i386-expand.c (ix86_expand_vector_set): Not use
gen_avx2_pblendph_1 when elt == 0.
* config/i386/sse.md (avx2_pblendph): Rename to ..
(avx2_pblend<ssemodesuffix>_1).. this, and extend to V16HI.
(*avx2_pblendw): Rename to ..
(*avx2_pblend<ssemodesuffix>): .. this, and extend to V16HF.
(avx2_pblendw): Rename to ..
(*avx2_pblend<ssemodesuffix>): .. this, and extend to V16HF.
(blendsuf): Removed.
(sse4_1_pblend<blendsuf>): Renamed to ..
(sse4_1_pblend<ssemodesuffix>): .. this.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr103753.c: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/103753] Unoptimal avx2 V16HF vector insert to element 0
2021-12-16 19:55 [Bug target/103753] New: Unoptimal avx2 V16HF vector insert to element 0 ubizjak at gmail dot com
2021-12-16 21:53 ` [Bug target/103753] " pinskia at gcc dot gnu.org
2022-01-07 3:08 ` cvs-commit at gcc dot gnu.org
@ 2022-01-07 3:09 ` crazylht at gmail dot com
2022-01-07 3:21 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2022-01-07 3:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103753
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC12.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/103753] Unoptimal avx2 V16HF vector insert to element 0
2021-12-16 19:55 [Bug target/103753] New: Unoptimal avx2 V16HF vector insert to element 0 ubizjak at gmail dot com
` (2 preceding siblings ...)
2022-01-07 3:09 ` crazylht at gmail dot com
@ 2022-01-07 3:21 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 3:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103753
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-07 3:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 19:55 [Bug target/103753] New: Unoptimal avx2 V16HF vector insert to element 0 ubizjak at gmail dot com
2021-12-16 21:53 ` [Bug target/103753] " pinskia at gcc dot gnu.org
2022-01-07 3:08 ` cvs-commit at gcc dot gnu.org
2022-01-07 3:09 ` crazylht at gmail dot com
2022-01-07 3:21 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).