on the plains rohan would win hands down, they may not be able to breach a spear wall but they have far more maneuverability then a formation of pike men. they merely need to create a small break in the gondorians lines in order to trample the whole army. and even a spear wall can only kill so many horsemen.
should rohan be forced into a defensive position like helms deep it would likely end with both sides being badly wounded as gondor would not be able to bring mobile siege weapons like catapults in without dismantling them due to the dike. and rohan would be able to break down gondors army with Calvary charges and hails of arrows to disrupt spear men. but rohan is still pinned in a small valley leaving them vulnerable to starvation
should gondor be the ones on the defensive then it would likely end in rohan laying siege to minas tirith, they may not have great seige engines but they still have the most deadly weapon of all. starvation. and the horsemen could crush any attempted sortie in the open plains.