RE: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-09 Thread Tamar Christina
> -Original Message- > From: Richard Sandiford > Sent: Thursday, January 9, 2025 3:09 PM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; Richard Earnshaw > ; ktkac...@gcc.gnu.org > Subject: Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters &g

Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-09 Thread Richard Sandiford
Tamar Christina writes: >> > + After the final loads are done it issues a >> > + vec_construct to recreate the vector from the scalar. For costing >> > when >> > + we see a vec_to_scalar on a stmt with VMAT_GATHER_SCATTER we are >> dealing >> > + with an emulated instruction and

RE: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-08 Thread Tamar Christina
> -Original Message- > From: Richard Sandiford > Sent: Wednesday, January 8, 2025 10:30 AM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; Richard Earnshaw > ; ktkac...@gcc.gnu.org > Subject: Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters &g

Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-08 Thread Richard Sandiford
Tamar Christina writes: >> >> i.e. we use separate address arithmetic and avoid UMOVs. Counting >> >> two loads and one store for each element of the scatter store seems >> >> like overkill for that. >> > >> > Hmm agreed.. >> > >> > How about for stores we increase the load counts by count / 2? >

RE: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-07 Thread Tamar Christina
> >> i.e. we use separate address arithmetic and avoid UMOVs. Counting > >> two loads and one store for each element of the scatter store seems > >> like overkill for that. > > > > Hmm agreed.. > > > > How about for stores we increase the load counts by count / 2? > > > > This would account for th

Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-02 Thread Richard Sandiford
Tamar Christina writes: >> >> So I think ideally, we should try to detect whether the indices come >> >> directly from memory or are the result of arithmetic. In the former case, >> >> we should do the loads adjustment above. In the latter case, we should >> >> keep the vec_to_scalar accounting

RE: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-02 Thread Tamar Christina
> -Original Message- > From: Richard Sandiford > Sent: Thursday, January 2, 2025 5:54 PM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; Richard Earnshaw > ; ktkac...@gcc.gnu.org > Subject: Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters &g

Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-02 Thread Richard Sandiford
Tamar Christina writes: >> > [...] >> > #define iterations 10 >> > #define LEN_1D 32000 >> > >> > float a[LEN_1D], b[LEN_1D]; >> > >> > float >> > s4115 (int *ip) >> > { >> > float sum = 0.; >> > for (int i = 0; i < LEN_1D; i++) >> > { >> > sum += a[i] * b[ip[i]]; >

RE: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-02 Thread Tamar Christina
> -Original Message- > From: Richard Sandiford > Sent: Thursday, January 2, 2025 4:52 PM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; Richard Earnshaw > ; ktkac...@gcc.gnu.org > Subject: Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters &g

Re: [PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-02 Thread Richard Sandiford
Tamar Christina writes: > Hi All, > > When a target does not support gathers and scatters the vectorizer tries to > emulate these using scalar loads/stores and a reconstruction of vectors from > scalar. > > The loads are still marked with VMAT_GATHER_SCATTER to indicate that they are > gather/scat

[PATCH]AArch64: Fix costing of emulated gathers/scatters [PR118188]

2025-01-02 Thread Tamar Christina
Hi All, When a target does not support gathers and scatters the vectorizer tries to emulate these using scalar loads/stores and a reconstruction of vectors from scalar. The loads are still marked with VMAT_GATHER_SCATTER to indicate that they are gather/scatters, however the vectorizer also asks