Suppose I know he was ill yesterday. Here are two examples referring to unreality.
- He behaved as if he was not ill.
- if he had not been ill, we would have had a nice time yesterday.
Why we must use "had done" to refer to past unreality in "if” clause while we don't need in "as if" clause.