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

--- Comment #22 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Ramana Radhakrishnan from comment #17)
> 
> 
> (In reply to Tamar Christina from comment #16)
> > (In reply to Soumya AR from comment #13)
> > > Hi Tamar,
> > > 
> > > Thanks for the fix.
> > > 
> > > This has now brought back performance for the mentioned kernels with 
> > > -Ofast
> > > but is now regressing with -O3 ...
> > > 
> > > Is this something you're still looking at? Just wanted to put it up here
> > > anyway.
> > > 
> > > Example, for the inner loop in s314:
> > > 
> > 
> > Looks like the ICE was compiler explorer caching the compile.
> > 
> > But trunk seems fine https://godbolt.org/z/1xhdM95sK
> > 
> > It does outer-loop vect as it's supposed to.
> > 
> > And VLA works correctly too https://godbolt.org/z/5of8Kq6hb
> > 
> > Am I missing some option?
> 
> 
> 
> As Soumya is out for a few days , I'll try and fill in the details - the
> options from our nightly system (because of how it all munges options
> together are)
> 
> "-O3 -Wl,-z,muldefs -lm -flto=auto -Wl,--sort-section=name -march=native
> -mcpu=neoverse-v2"
> 
> I don't fully grok your last response in #c14 -  Is the expectation that GCC
> trunk will no longer vectorize this loop at -O3 ? 
> 

No, the comment was saying that the reduced example does vectorize correctly
doing outer-loop vect rather than inner-loop vect (same as GCC 15)

i.e.

> 
> .L3:
>       ldr     s25, [x0], 4
>       fcmpe   s25, s26
>       fcsel   s26, s25, s26, gt
>       cmp     x0, x1
>       bne     .L3
>       subs    w2, w2, #1
>       bne     .L4
>       fcvtzs  w0, s26
>       ret
> 
> 
> Before:
> 
> .L3:
>       ld1r    {v25.4s}, [x0], 4
>       fcmgt   v24.4s, v25.4s, v26.4s
>       bsl     v24.16b, v25.16b, v26.16b
>       mov     v26.16b, v24.16b
>       cmp     x1, x0
>       bne     .L3
>       add     w2, w2, 1
>       cmp     w2, w4
>       bne     .L4
>       dup     s24, v24.s[3]
>       fcvtzs  w0, s24
>       ret
> 
> 
> Looks like we don't vectorize the inner loop at all now.

We don't want the ld1r here, and instead want what trunk is doing

.L2:
        add     v28.4s, v31.4s, v30.4s
        scvtf   v0.4s, v31.4s
        add     v31.4s, v31.4s, v29.4s
        scvtf   v28.4s, v28.4s
        stp     q0, q28, [x0], 32
        cmp     x0, x1
        bne     .L2


> 
> We also see a bunch of other regressions some of which are at -Ofast with
> Rajaperf Apps_Mass3DEA for the options 
> 
> "-Ofast -Wl,-z,muldefs -lm -fpermissive -march=native -mcpu=neoverse-v2
> -msve-vector-bits=128"
> "-Ofast -Wl,-z,muldefs -lm -fpermissive -march=native -mcpu=neoverse-v2"
> 
> i.e. VLS Ofast and VLA Ofast. 
> 
> We'll try and reduce this and put it over here as well. 
> 

Thanks

> regards
> Ramana

Reply via email to