https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93183

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |26163, 53947
            Summary|SVE only makes the last     |SVE does not use neg as
                   |thing conditional with      |conditional
                   |ifconversion                |

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually it looks more like conditional neg does not work.
Take:
typedef unsigned char uint8_t;

static inline uint8_t x264_clip_uint8( uint8_t x )
{
  uint8_t t = -x;
  uint8_t t1 = x&(~63);
  return t1 ? t : x;
}


void mc_weight( uint8_t *__restrict dst, uint8_t *__restrict src, int n)
{
        for( int x = 0; x < n*16; x++ )
            dst[x] = x264_clip_uint8(src[x]);
}
--- CUT ---
We get:
.L3:
        ld1b    z0.b, p0/z, [x1, x3]
        movprfx z2, z0
        and     z2.b, z2.b, #0xc0
        neg     z1.b, p1/m, z0.b  ;;; <<<< THIS
        cmpeq   p2.b, p1/z, z2.b, #0
        sel     z0.b, p2, z0.b, z1.b ;;;; <<<< AND THIS
        st1b    z0.b, p0, [x0, x3]
        incb    x3
        whilelo p0.b, w3, w2
        b.any   .L3

The two instructions marked should be combined.

NOTE this does show up in real code in SPEC CPU, see PR 92492.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

Reply via email to