See BigEd's link for Ca and SO4 (gypsum is CaSO4). Some brewers add gypsum to help achieve a certain water profile (e.g., Burton) and strictly for the effect on perceived bitterness. If you were doing it for this purpose and your water has enough calcium in it for mashing and your expected mash pH is good, then you really only need to add it to the boil.
Other brewers will add it (or other calcium compounds) to decrease pH for the mash and sparge water. In this case, calcium is the primary mineral of concern. See this
thread for more info on calcium.
But you should really know how much Ca and SO4 is in your water before adding any gypsum.