From a00b6bdbfa72a1688a866edf5f825720c9874ada Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 9 Jun 2016 23:12:46 +0200 Subject: 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 | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/src/cmd/6c/cgen.c') diff --git a/sys/src/cmd/6c/cgen.c b/sys/src/cmd/6c/cgen.c index 2cfbfbe66..d43d1d366 100644 --- a/sys/src/cmd/6c/cgen.c +++ b/sys/src/cmd/6c/cgen.c @@ -159,6 +159,7 @@ cgen(Node *n, Node *nn) regfree(&nod); break; + case OROL: case OLSHR: case OASHL: case OASHR: -- cgit v1.2.3