gradfun: x86: Factor out common code for some gradfun_filter_line() variants