Re: RFD: switch/case statement dispatch using hash

2025-06-23 Thread Andi Kleen via Gcc
Florian Weimer via Gcc writes: > * Andi Kleen via Gcc: > >> Joern Wolfgang Rennecke writes: >> >>> This has come up several time over the years: >>> https://gcc.gnu.org/legacy-ml/gcc/2006-07/msg00158.html >>> https://gcc.gnu.org/legacy-ml/gcc/2006-07/msg00155.html >>> https://gcc.gnu.org/piperma

Re: RFD: switch/case statement dispatch using hash

2025-06-23 Thread Joern Wolfgang Rennecke
On 23/06/2025 12:31, Florian Weimer wrote: Also carry-less multiply persumably. It's challenging to use those instructions for compiling switch statements because they would then be used all over the place. Not necessarily; you can hide them in an UNSPEC if you are worried that exposing the

Re: RFD: switch/case statement dispatch using hash

2025-06-23 Thread Florian Weimer via Gcc
* Andi Kleen via Gcc: > Joern Wolfgang Rennecke writes: > >> This has come up several time over the years: >> https://gcc.gnu.org/legacy-ml/gcc/2006-07/msg00158.html >> https://gcc.gnu.org/legacy-ml/gcc/2006-07/msg00155.html >> https://gcc.gnu.org/pipermail/gcc/2010-March/190234.html >> >> , but

Re: RFD: switch/case statement dispatch using hash

2025-06-22 Thread Andi Kleen via Gcc
Joern Wolfgang Rennecke writes: > This has come up several time over the years: > https://gcc.gnu.org/legacy-ml/gcc/2006-07/msg00158.html > https://gcc.gnu.org/legacy-ml/gcc/2006-07/msg00155.html > https://gcc.gnu.org/pipermail/gcc/2010-March/190234.html > > , but maybe now (or maybe a while ago)

Re: RFD: switch/case statement dispatch using hash

2025-06-21 Thread Filip Kastl
Hi Joern, I've also been thinking about implementing something like that. First I would experiment with implementing switches using perfect hashing functions to see if this really speeds up execution on current CPUs. Then I would try to come up with some heuristic that tells GCC when it is advan