If + the subject + the past perfect, the subject + would have + past participle And you can also swap those round: What would you have done if you'd known your friend was coming?