A 31.2 dB-contrast optical AND gate based on a Fabry–Pérot semiconductor optical amplifier is experimentally demonstrated, exceeding previously demonstrated data for such a device by over 24 dB. Whereas cross-phase modulation shifts the Fabry–Pérot resonance to trigger the AND-gate functionality, cross-polarisation modulation enables ultrahigh contrast by producing a state of polarisation (SOP) for the high output-power state that is different than that of the low output-power state; a linear polariser is then used to block the low-power SOP. This technique is applicable to other resonator geometries, Kerr-nonlinear media, and to other all-optical combinational-logic gates.