We propose a novel scheme of realizing all-optical logic gates based on a single I/Q modulator and direct detection by adjusting bias voltages of the two arms, peak-peak voltages of the driving signals and the phase shift. Experiments are successfully carried out to demonstrate four logic gates of OR, AND, XOR and NOR at the bit rate of 1Gbit/s with extinction ratio higher than 11 dB.