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

--- Comment #17 from Martin Liška <marxin at gcc dot gnu.org> ---
> I leave that up to you guys, but I would at min probably implement something
> like s390 folks did for gcc, commit db7a90aa0de5 ("S/390: Disable prediction
> of indirect branches"), see s390_case_values_threshold() which does:

Sure, that's probably the right approach. I would appreciate help with the
benchmark.
Can you please come up with a --param case-values-threshold value that will
show
when a jump table (w/ retpolines) is equally fast as a decision tree
(-fno-jump-tables)?

> 
> +unsigned int
> +s390_case_values_threshold (void)
> +{
> +  /* Disabling branch prediction for indirect jumps makes jump tables
> +     much more expensive.  */
> +  if (TARGET_INDIRECT_BRANCH_NOBP_JUMP)
> +    return 20;
> +
> +  return default_case_values_threshold ();
> +}
> 
> > For x86 something similar could be done. Anyway, H.J. Lu asked me
> > > to reopen this issue (but seems like I cannot make this change from my
> > > account).
> > 
> > Yep, I would need an account ending with @gcc.org to change a bug.

Reply via email to