]> git.ipfire.org Git - thirdparty/gcc.git/commit
expansion: make layout of x_shift*cost[][][] more efficient
authorVineet Gupta <vineetg@rivosinc.com>
Wed, 1 Mar 2023 03:27:26 +0000 (19:27 -0800)
committerVineet Gupta <vineetg@rivosinc.com>
Fri, 21 Apr 2023 16:14:31 +0000 (09:14 -0700)
commit1fe9bef9f5536e46b901139631863b3b86b97898
treef64d84f4592efde8f0d8aece7d915f0308c08ca3
parente6f689d090011eaa4050357b3dd2d7b9109b83ec
expansion: make layout of x_shift*cost[][][] more efficient

when debugging expmed.[ch] for PR/108987 saw that some of the cost arrays have
less than ideal layout as follows:

   x_shift*cost[0..63][speed][modes]

We would want speed to be first index since a typical compile will have
that fixed, followed by mode and then the shift values.

It should be non-functional from compiler semantics pov, except
executing slightly faster due to better locality of shift values for
given speed and mode. And also a bit more intutive when debugging.

gcc/Changelog:

* expmed.h (x_shift*_cost): convert to int [speed][mode][shift].
(shift*_cost_ptr ()): Access x_shift*_cost array directly.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/expmed.h