Spectra of the ion mass and energy distributions of positive ions in reactive (Ar/O2) and nonreactive (Ar) dc magnetron sputtering discharges have been investigated by energy-resolved mass spectrometry. The results of three sputter target materials, i.e., Cu, In, and W are compared to each other. Besides the main gas constituents, mass spectra reveal a variety of molecular ions which are dependent on the target material. In reactive mode, ArO+ is always observed in Ar/O2 but molecules containing Ar and the metal were exclusively found for the Cu target. The occurrence of the different ions is explained in the context of their bond strengths obtained from density functional theory calculations. The energy spectra generally contain the known low-energy peak corresponding to the plasma potential. Differently extended high-energy tails due to sputtered material were observed for the different targets. Besides these, high-energetic ions were detected with up to several 100 eV. Their energies are significantly different for Ar+ and O+ with Ar+ strongly depending on the target material. The spectra are discussed together with results from transport of ions in matter (TRIM) calculation to elucidate the origin of these energetic ions.