Gap beat Wall Street's expectations on the top and bottom lines but said new tariffs could cost it hundreds of millions of dollars.