Implemented cost model for masked gather and scatter operations