glStencilOp's GL_INCR & GL_DECR behaviour when masked?

Hi everybody!

What happens to a stencil index value in the stencil buffer when I specify GL_INCR or
GL_DECR as the stencil operations to do with glStencilOp() for any of the stencil tests,
if I call glStencilMask() with a mask value different than all 1’s? Does the stencil
index gets just incremented/decremented? Or the value is gathered, incremented/decremented,
and then masked to be written again to the stencil buffer? The OpenGL specification is
not very clear (at least for me) on this, so I hope anyone of you can answer me that.