Polynomial Datapaths Optimization