According to Bulbapedia,
When using a move, Rivalry raises the power of the move by 25% if the target and the Pokémon with this Ability have the same gender, but reduces base power by 25% if the target and the Pokémon with this Ability have opposite genders. If the Pokémon with this Ability or the target is genderless, the move's power is unaffected.
I don't quite understand is this ability increase/decrease the power of the moves using by pokemon, or the base attack of the pokemon?
For example in Pokemon Moon, my Haxorus have Rivalry, if Haxorus used Swords Dance three times, it will increase its power by 6 stages. Is this increased power affected with its ability?