summaryrefslogtreecommitdiff
path: root/sys/src/cmd/6c/cgen.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-06-09 23:12:46 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-06-09 23:12:46 +0200
commita00b6bdbfa72a1688a866edf5f825720c9874ada (patch)
tree82b2e1a62cc75c007039fe07663300706947f381 /sys/src/cmd/6c/cgen.c
parent5cdabc5eb16db432abcf61dc126bfb7f9b2978c1 (diff)
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.
Diffstat (limited to 'sys/src/cmd/6c/cgen.c')
-rw-r--r--sys/src/cmd/6c/cgen.c1
1 files changed, 1 insertions, 0 deletions
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: