  We search for ultra-light axions as dark matter (DM) and dark energy particle
candidates, for axion masses $10^{-32}\,\mathrm{eV} \leq m_\mathrm{a} \leq
10^{-24}\,\mathrm{eV}$, by a joint analysis of cosmic microwave background
(CMB) and galaxy clustering data -- and consider if axions can resolve the
tension in inferred values of the matter clustering parameter $S_8$. We give
legacy constraints from Planck 2018 CMB data, improving 2015 limits on the
axion density $\Omega_\mathrm{a} h^2$ by up to a factor of three; CMB data from
the Atacama Cosmology Telescope and the South Pole Telescope marginally weaken
Planck bounds at $m_\mathrm{a} = 10^{-25}\,\mathrm{eV}$, owing to lower (and
theoretically-consistent) gravitational lensing signals. We jointly infer, from
Planck CMB and full-shape galaxy power spectrum and bispectrum data from the
Baryon Oscillation Spectroscopic Survey (BOSS), that axions are, today, $<
10\%$ of the DM for $m_\mathrm{a} \leq 10^{-26}\,\mathrm{eV}$ and $< 1\%$ for
$10^{-30}\,\mathrm{eV} \leq m_\mathrm{a} \leq 10^{-28}\,\mathrm{eV}$. BOSS data
strengthen limits, in particular at higher $m_\mathrm{a}$ by probing
high-wavenumber modes ($k < 0.4 h\,\mathrm{Mpc}^{-1}$). BOSS alone finds a
preference for axions at $2.7 \sigma$, for $m_\mathrm{a} =
10^{-26}\,\mathrm{eV}$, but Planck disfavours this result. Nonetheless, axions
in a window $10^{-28}\,\mathrm{eV} \leq m_\mathrm{a} \leq
10^{-25}\,\mathrm{eV}$ can improve consistency between CMB and galaxy
clustering data, e.g., reducing the $S_8$ discrepancy from $2.7 \sigma$ to $1.6
\sigma$, since these axions suppress structure growth at the $8
h^{-1}\,\mathrm{Mpc}$ scales to which $S_8$ is sensitive. We expect improved
constraints with upcoming high-resolution CMB and galaxy lensing and future
galaxy clustering data, where we will further assess if axions can restore
cosmic concordance.
