https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112816
liuhongt at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuhongt at gcc dot gnu.org
--- Comment #6 from liuhongt at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #3)
> Created attachment 56767 [details]
> gcc14-pr112816.patch
>
> Untested fix.
>
> Another issue is that the emitted code is terrible:
> pxor %xmm1, %xmm1
> psrld $31, %xmm0
> pcmpeqd %xmm1, %xmm0
> pcmpeqd %xmm1, %xmm0
> Why not just
> psrad $31, %xmm0
> instead of all this?
We have optimization in ix86_expand_int_vcond.
5090 /* Try to optimize x < 0 ? -1 : 0 into (signed) x >> 31
5091 and x < 0 ? 1 : 0 into (unsigned) x >> 31. */
But for signbit case, it's
vect__1.10_4 = MEM <vector(4) float> [(float *)&x];
vect__2.11_3 = .SIGNBIT (vect__1.10_4);
mask__11.12_22 = vect__2.11_3 != { 0, 0, 0, 0 };
vect__13.14_26 = VIEW_CONVERT_EXPR<vector(4) int>(mask__11.12_22);
I'm curious, can we move all of those to the middle-end, like match.pd?