If I had known you were in hospital, I would have gone to visit you. (but I didn’t know). If he had been looking where he was going, he wouldn’t have walked into the wall. (but he wasn’t looking)
Do not use would in the if-part of the sentence. We use would in the other part of sentence: If I had seen you, I would have said hello. (not ‘If I would have seen you’).
I wish I’d know that Gary was ill. I would have gone to see him. (but I didn’t know). I feel sick. I wish I hadn’t eaten so much cake. (I ate too much cake). Do you wish you had studied science instead of languages? (you didn’t study science)
If I had gone to the party last night, I would be tired now. (I am not tired now – present). If I had gone to the party last night, I would have met lots of people. (I didn’t meet lots of people – past).
If the weather hadn’t been so bad, we would have gone out/we could have gone out (=we would have been able to go out)/we might have gone out (=perhaps we would have gone out).