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 .40 S&W - Beretta 92FS 9x19 Para - Rock Island Armory GI 1911 .45 ACP - Colt 1968 Detective Special .38 Spc. - Ruger LCP .380 ACP - Daniel Defense M4V1 Carbine 5.56x45 - Alpine Industries M1 Carbine .30 - Steyr-Mannlicher M1895 8x56 - Ruger 10/22 .22LR - Remington 870 Express Tactical 12GA - 1943 Izhevsk Mosin-Nagant M91/30 7.62x54R