US stocks end with gains following Trump's Davos speech