simple rewriting optimizations for primitive ops