]> git.lizzy.rs Git - plan9front.git/commit
8c, 6c: native ROL (cyclic shift) instruction support, improve peephole optimizers
authorcinap_lenrek <cinap_lenrek@felloff.net>
Thu, 9 Jun 2016 21:12:46 +0000 (23:12 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Thu, 9 Jun 2016 21:12:46 +0000 (23:12 +0200)
commita00b6bdbfa72a1688a866edf5f825720c9874ada
tree82b2e1a62cc75c007039fe07663300706947f381
parent5cdabc5eb16db432abcf61dc126bfb7f9b2978c1
8c, 6c: native ROL (cyclic shift) instruction support, improve peephole optimizers

introduce rolor() function to subsitute (a << c) | (a >> (bits(a) - c))
with (a <<< c) where <<< is cyclic rotation and c is constant.
this almost doubles the speed of chacha encryption of 386 and amd64.

the peephole optimizer used to stop when it hit a shift or rol
instruction when attempting to eleminate moves by register
substitution. but we do not have to as long as the shift count
operand is not CX (which cannot be substituted) and CX is not
a subject for substitution.
sys/src/cmd/6c/cgen.c
sys/src/cmd/6c/peep.c
sys/src/cmd/6c/sgen.c
sys/src/cmd/6c/txt.c
sys/src/cmd/8c/cgen.c
sys/src/cmd/8c/peep.c
sys/src/cmd/8c/sgen.c
sys/src/cmd/8c/txt.c
sys/src/cmd/cc/cc.h
sys/src/cmd/cc/sub.c