Is it even legal to directly refer to companies other than yours in an advert? I've never seen ads that do this, at least not on TV!
It's completely legal, but you normally don't because a lot of people buy products based on name recognition alone, and so companies don't mention eachother's by name lest they inadvertently canabalize their own sells.
Everyone already knows what an iPhone is, and a lot of people already know about Samsung, so Microsoft can't hurt themselves by acknowledging the existence of competitive products.