cmd/compile: regalloc fails to reserve key register (CX) for future code #44671
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
After CLs 297049 and 297050, generate code for shrVU_g in math/big.
The tight inner loop compiles to:
This contains unnecessary copies. One is #44670.
The others are
CX
contention. Regalloc decided to puti
inCX
. Unfortunately,CX
is the required register for the shift amount input for theSHRDQ
instruction. So we shufflei
in and out ofCX
on every iteration.I thought regalloc had some amount of lookahead to avoid using highly restricted registers in upcoming code, to avoid this situation. Either I was wrong, or it isn't working as desired here.
I believe that fixing this issue would make the generated code as fast (or nearly so) as the hand-written assembly, allowing us to delete the assembly.
cc @randall77 @cherrymui
The text was updated successfully, but these errors were encountered: