High frequency dynamics in liquids and supercritical fluids: A comparative inelastic x-ray scattering study