Observational constraint on axion dark matter with gravitational waves