I have shot both extensively. Close friends and range pals own each.
Both are quality in terms of reliability and durability. Both have run flawlessly.
In terms of shootability and handling of the .40, the M&P 40 wins, and in my opinion it's not even close. Not intended as an insult to XD-40 fans - it IS a good gun - but the M&P feels very smartly designed around the .40. As I mentioned in another thread re: the M&P, I think it, the Beretta PX4, and the Sig 229 are kings of the hill in terms of how they handle .40. All three of those platforms confidently own the cartridge.
Beretta PX4; 92FS; 92S; 8040G | Rock Island GI 1911 | Sig Sauer SP2022; P6 | Colt Python 4"; 1968 Detective Special 2"| Smith & Wesson M642 No-Lock | Ruger LCP; 10/22 | Daniel Defense M4V1 | Remington 870 | Alpine M1 Carbine | Steyr M1895 |1943 Izhevsk Mosin M91/30 | Walther PPS