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

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Looking only at x86: it seems to be down to the cost tables for the
processors, which are set in x86-tune-costs.h (code snippets like

  COSTS_N_INSNS (3),                    /* cost of CVT(T)PS2PI instruction.  */
  1, 4, 3, 3,                           /* reassoc int, fp, vec_int, vec_fp. 
*/
  {8, 8, 3},                            /* latency times throughput of

and queried in ix86_reassociation_width() in i386.c.

Here is a list of the tables, hand-extracted:

i386           1
i486           1
pentium        1
lakemont       1
pentiumpro     1
geode          1
k6             1
athlon         1
k8             1
amdfam10       1
bdver          1
znver1         4
znver2         4
znver3         4
znver4         4
znver5         6
skylake        1
icelake        1
alderlake      1
btver1         1
btver2         1
pentium4       1
nocona         1
atom           2
slm            1
tremont        1
lujiazui       1
yongfeng       4
shijidadao     4
generic        1
core           1
c86_4g_m4      4
c86_4g_m6      4

So, most of them do not reassociate at all. Seems like a tuning
parameter that was often overlooked (except for Zen, apparently).
And godbolt confirms it: -O2 -march=znver1 results in

        add     edx, ecx
        add     edi, esi
        lea     eax, [rdx+rdi]
        ret

Reply via email to