Operators with polynomial coefficients and generalized Gelfand-Shilov classes