A search for the resonant production of high-mass photon pairs is presented. The analysis is based on samples of proton-proton collision data collected by the CMS experiment at center-of-mass energies of 8 and 13 TeV, corresponding to integrated luminosities of 19.7 and 3.3 fb-1, respectively. The interpretation of the search results focuses on spin-0 and spin-2 resonances with masses between 0.5 and 4 TeV and with widths, relative to the mass, between 1.4×10-4 and 5.6×10-2. Limits are set on scalar resonances produced through gluon-gluon fusion, and on Randall-Sundrum gravitons. A modest excess of events compatible with a narrow resonance with a mass of about 750 GeV is observed. The local significance of the excess is approximately 3.4 standard deviations. The significance is reduced to 1.6 standard deviations once the effect of searching under multiple signal hypotheses is considered. More data are required to determine the origin of this excess.