Nishikori upsets Federer in Madrid