Optoelectronic logic gates (OELGs) converting photonic inputs into electric output based on Boolean logic are promising for next-generation computations, and it is highly desirable to be able to control the current polarity by light for multifunctional devices. Here we report a new strategy for OELGs based on bipolar photoconduction intrinsic to ferroelectric materials, simplifying the device configuration considerably while enabling multiple logic operations. We demonstrate this concept in two-dimensional (2D) ferroelectric CuInP2S6 (CIPS), taking advantage of the fact that its polarization switching is intimately coupled with Cu cation migration, and thus can be deterministically driven by both above- and below-bandgap illumination via the photothermal effect. This in turn switches the polarity of the photocurrent arising from the bulk photovoltaic effect (BPVE), which is sensitive to the light intensity, enabling the execution of "OR", "XOR", and "NOT" logic operations in a single device with a simple sandwich structure.