3 ms·
Note that GCC will vectorize the first version if you add `-ftree-vectorize` to your optimization arguments. In order to vectorize the same loop with floats, (p
by nwallin 3y ago
Note that GCC will vectorize the first version if you add `-ftree-vectorize` to your optimization arguments. In order to vectorize the same loop with floats, (particularly relevant for gamedev) you need to add `-ftree-vectorize -fassociative-math -fno-signed-zeros -fno-trapping-math`.
For gamedev, where numerical correctness is often secondary to speed, I would expect to use `-O3 -ffast-math`. In games where deterministic simulation is important, (eg, multiplayer) you may need to use only `-O3` in the physics simulation and only use `-ffast-math` in the graphics portion.
https://godbolt.org/z/W3GTq5oo5 https://godbolt.org/z/W3GTq5oo5
https://godbolt.org/z/3qTnWrPsr https://godbolt.org/z/3qTnWrPsr