pan/midgard: Optimize comparisions with similar operations