Past perfect subjunctive
The past perfect subjunctive has the same form as the past perfect tense:
had + past participle
It is used in subordinate clauses and expresses unreal past situations:
I wish they had arrived on time. (They didn't arrive on time.)
I would've bought the dress if there hadn't been such a queue. (There was a long queue, so I didn't buy the dress.)
She would rather I had gone to bed earlier. (I didn't go to bed early.)
He seems as if he hadn't slept for days. (He seems not to have slept for days, but he has.)