public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level
@ 2023-05-17 23:20 pinskia at gcc dot gnu.org
2023-05-19 5:51 ` [Bug target/109900] " crazylht at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-17 23:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109900
Bug ID: 109900
Summary: _mm256_abs_epi8 is not expanded on gimple level
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: x86_64-linux-gnu
Take (at -O3 -march=x86-64-v3):
```
#include <immintrin.h>
__m256i
should_be_cmpeq_abs0 ()
{
return _mm256_set1_epi8 (1);
}
__m256i
should_be_cmpeq_abs1 ()
{
return _mm256_abs_epi8(_mm256_set1_epi8 (-1));
}
```
I would have expected these two produce the same code generation.
In the end, we still have a builtin function in the IR rather than ABS_EXPR.
The RTL level uses abs.
In fact combine tries to combine the two instructions:
Trying 5 -> 6:
5: r85:V32QI=const_vector
6: r84:V32QI=abs(r85:V32QI)
REG_DEAD r85:V32QI
REG_EQUAL const_vector
Failed to match this instruction:
(set (reg:V32QI 84)
(const_vector:V32QI [
(const_int 1 [0x1]) repeated x32
]))
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109900] _mm256_abs_epi8 is not expanded on gimple level
2023-05-17 23:20 [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level pinskia at gcc dot gnu.org
@ 2023-05-19 5:51 ` crazylht at gmail dot com
2023-05-24 1:13 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2023-05-19 5:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109900
--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
Yes, let me do the folding.
FYI, for those floating point abs intrinsics, they're already implemented as
_mm512_abs_ps (__m512 __A)
{
return (__m512) _mm512_and_epi32 ((__m512i) __A,
_mm512_set1_epi32 (0x7fffffff));
}
And no need for folding.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109900] _mm256_abs_epi8 is not expanded on gimple level
2023-05-17 23:20 [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level pinskia at gcc dot gnu.org
2023-05-19 5:51 ` [Bug target/109900] " crazylht at gmail dot com
@ 2023-05-24 1:13 ` cvs-commit at gcc dot gnu.org
2023-05-24 1:14 ` crazylht at gmail dot com
2023-05-24 2:09 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-24 1:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109900
--- Comment #2 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:1ede03e2d0437ea9c2f7453fcbe263505b4e0def
commit r14-1145-g1ede03e2d0437ea9c2f7453fcbe263505b4e0def
Author: liuhongt <hongtao.liu@intel.com>
Date: Fri May 19 13:55:50 2023 +0800
Fold _mm{,256,512}_abs_{epi8,epi16,epi32,epi64} into gimple ABS_EXPR.
Also for 64-bit vector abs intrinsics _mm_abs_{pi8,pi16,pi32}.
gcc/ChangeLog:
PR target/109900
* config/i386/i386.cc (ix86_gimple_fold_builtin): Fold
_mm{,256,512}_abs_{epi8,epi16,epi32,epi64} and
_mm_abs_{pi8,pi16,pi32} into gimple ABS_EXPR.
(ix86_masked_all_ones): Handle 64-bit mask.
* config/i386/i386-builtin.def: Replace icode of related
non-mask simd abs builtins with CODE_FOR_nothing.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr109900.c: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109900] _mm256_abs_epi8 is not expanded on gimple level
2023-05-17 23:20 [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level pinskia at gcc dot gnu.org
2023-05-19 5:51 ` [Bug target/109900] " crazylht at gmail dot com
2023-05-24 1:13 ` cvs-commit at gcc dot gnu.org
@ 2023-05-24 1:14 ` crazylht at gmail dot com
2023-05-24 2:09 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2023-05-24 1:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109900
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed for GCC14.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/109900] _mm256_abs_epi8 is not expanded on gimple level
2023-05-17 23:20 [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-05-24 1:14 ` crazylht at gmail dot com
@ 2023-05-24 2:09 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-24 2:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109900
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
Target Milestone|--- |14.0
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed as mentioned.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-24 2:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 23:20 [Bug target/109900] New: _mm256_abs_epi8 is not expanded on gimple level pinskia at gcc dot gnu.org
2023-05-19 5:51 ` [Bug target/109900] " crazylht at gmail dot com
2023-05-24 1:13 ` cvs-commit at gcc dot gnu.org
2023-05-24 1:14 ` crazylht at gmail dot com
2023-05-24 2:09 ` 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).