[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Andrew Pinski  ---
Fixed.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-09 Thread benjsith at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #9 from Benji Smith  ---
Yes, updated to the latest trunk (dac73e4c64bf62be18bd5203e4e0f3e6bc64b4dc) and
confirmed that it no longer repros. Thanks for the fix!

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-08 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #8 from Hongtao.liu  ---
Fixed for trunk.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #7 from CVS Commits  ---
The releases/gcc-12 branch has been updated by hongtao Liu
:

https://gcc.gnu.org/g:887f903ab05ddcac498247384734efbc6cf45147

commit r12-9686-g887f903ab05ddcac498247384734efbc6cf45147
Author: liuhongt 
Date:   Mon Jun 5 12:38:41 2023 +0800

Explicitly view_convert_expr mask to signed type when folding pblendvb
builtins.

Since mask < 0 will be always false for vector char when
-funsigned-char, but vpblendvb needs to check the most significant
bit. The patch explicitly VCE to vector signed char.

gcc/ChangeLog:

PR target/110108
* config/i386/i386.cc (ix86_gimple_fold_builtin): Explicitly
view_convert_expr mask to signed type when folding pblendvb
builtins.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr110108-2.c: New test.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #6 from CVS Commits  ---
The releases/gcc-13 branch has been updated by hongtao Liu
:

https://gcc.gnu.org/g:5e01a590aa719d235811c1549547f736de2b5190

commit r13-7430-g5e01a590aa719d235811c1549547f736de2b5190
Author: liuhongt 
Date:   Mon Jun 5 12:38:41 2023 +0800

Explicitly view_convert_expr mask to signed type when folding pblendvb
builtins.

Since mask < 0 will be always false for vector char when
-funsigned-char, but vpblendvb needs to check the most significant
bit. The patch explicitly VCE to vector signed char.

gcc/ChangeLog:

PR target/110108
* config/i386/i386.cc (ix86_gimple_fold_builtin): Explicitly
view_convert_expr mask to signed type when folding pblendvb
builtins.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr110108-2.c: New test.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #4 from CVS Commits  ---
The master branch has been updated by hongtao Liu :

https://gcc.gnu.org/g:07b86ab138bf8be8cb331015cd2b9775c6856ac6

commit r14-1640-g07b86ab138bf8be8cb331015cd2b9775c6856ac6
Author: liuhongt 
Date:   Mon Jun 5 11:59:33 2023 +0800

Fold _mm{,256,512}_abs_{epi8,epi16,epi32,epi64} into gimple ABSU_EXPR +
VCE.

r14-1145 fold the intrinsics into gimple ABS_EXPR which has UB for
TYPE_MIN, but PABSB will store unsigned result into dst. The patch
uses ABSU_EXPR + VCE instead of ABS_EXPR.

Also don't fold _mm_abs_{pi8,pi16,pi32} w/o TARGET_64BIT since 64-bit
vector absm2 is guarded with TARGET_MMX_WITH_SSE.

gcc/ChangeLog:

PR target/110108
* config/i386/i386.cc (ix86_gimple_fold_builtin): Fold
_mm{,256,512}_abs_{epi8,epi16,epi32,epi64} into gimple
ABSU_EXPR + VCE, don't fold _mm_abs_{pi8,pi16,pi32} w/o
TARGET_64BIT.
* config/i386/i386-builtin.def: Replace CODE_FOR_nothing with
real codename for __builtin_ia32_pabs{b,w,d}.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr110108.c: New test.
* gcc.target/i386/pr110108-3.c: New test.
* gcc.target/i386/pr109900.c: Adjust testcase.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #5 from CVS Commits  ---
The master branch has been updated by hongtao Liu :

https://gcc.gnu.org/g:dac73e4c64bf62be18bd5203e4e0f3e6bc64b4dc

commit r14-1641-gdac73e4c64bf62be18bd5203e4e0f3e6bc64b4dc
Author: liuhongt 
Date:   Mon Jun 5 12:38:41 2023 +0800

Explicitly view_convert_expr mask to signed type when folding pblendvb
builtins.

Since mask < 0 will be always false for vector char when
-funsigned-char, but vpblendvb needs to check the most significant
bit. The patch explicitly VCE to vector signed char.

gcc/ChangeLog:

PR target/110108
* config/i386/i386.cc (ix86_gimple_fold_builtin): Explicitly
view_convert_expr mask to signed type when folding pblendvb
builtins.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr110108-2.c: New test.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-04 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

Richard Biener  changed:

   What|Removed |Added

 Target|x86_64  |x86_64-*-*
   Priority|P3  |P1

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-04 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #3 from Hongtao.liu  ---
(In reply to Andrew Pinski from comment #1)
> So we should be using ABSU_EXPR instead of ABS for _mm_abs_epi8 I think ...
> 
> That will fix the issue.

Yes, ABSU_EXPR + VIEW_CONVERT_EXPR.

And also I notice a potential bug with -funsigned-char when folding
_mm_blendv_epi8 into VCOND_EXPR (mask < 0, a, b), -funsigned-char will always
make mask < 0 false which is not true for pblendvb, I'll submit another
separate fix to fold _mm_blendv_epi8 only without -funsigned-char

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

--- Comment #2 from Andrew Pinski  ---
No, there is code which ABS on a signed integer does not overflow (that
includes on vector of signed integers) so `ABS<0` is always considered true.
This is where ABSU_EXPR comes into play which does not cause an overflow for
SCHAR_MIN and will produce SCHAR_MIN always.

[Bug target/110108] [14 Regression] Wrong code from combining VPABSB/VPBLENDVB since g:1ede03e2d0437ea9c2f7

2023-06-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110108

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2023-06-03
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Target Milestone|--- |14.0
   Keywords||wrong-code

--- Comment #1 from Andrew Pinski  ---
So we should be using ABSU_EXPR instead of ABS for _mm_abs_epi8 I think ...

That will fix the issue.