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 Type F Fullsize .40 S&W | Beretta 92FS 9x19 Para | Beretta 8040 Cougar Type G .40 S&W | Rock Island Armory GI 1911 .45 ACP | Sig Sauer SP2022 Stainless 9x19 Para | Sig Sauer P6 9x19 Para | Colt Python 4" .357 Magnum | Colt 1968 Det. Spec. .38 Spc. | Ruger LCP .380 ACP | Daniel Defense M4V1 5.56x45 | Alpine M1 Carbine .30 | Steyr M1895 8x56 | Ruger 10/22 .22LR |1943 Izhevsk Mosin-Nagant M91/30 7.62x54R | Remington 870 12GA