https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96768
Wilco <wilco at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilco at gcc dot gnu.org --- Comment #5 from Wilco <wilco at gcc dot gnu.org> --- (In reply to Christophe Lyon from comment #4) > That's what I replied in the original PR94538, but Wilco said the best > option was to turn off switch tables: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94538#c14 > > See also another comment from him: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94538#c16 related to immediate > loads from rodata/bss. Yes, switching off switch tables is obviously the best option - just look at the m0 vs m3 code above. It's the fastest and smallest, and is also "pure code" since there are no extra literals generated anywhere. In AArch32 switch tables are very inefficient. An easy improvement would be to copy the AArch64 case_values_threshold to disable tables if there are fewer than 16 cases.