How to report complicated QCD?

How can I recover the nondeductable cost basis of my IRA if I donated to a charity using QCD from my IRA acc't? My IRA is an aggregate of pretax and post tax dollars. The tax treatment of QCD uses pretax dollars.  In the past I use form 8606 to calculate the tax credit for the post tax dollars.