An Eye-Opening Single-Core Parallelism Test on M1 Mac
medium.com
medium.com
I would expect the loop to be unrolled 3, 7 or 21 times to remove all conditionals. Then the math can be dispatched at one operation per cycle for each stream.
There must have been something in the compiled assembly that broke the optimisation.