When you need a logic element to calculate some number of logical functions (M outputs) from a number (N) of inputs, there are some standard ways to implement and optimize them in terms of and/or planes.  This practice is so standard in implementations that there are versions of these that are programmable through other writable state elements to control interconnections, making them programable to any M functions in N variables.  See also FPLAs.