Rather than LUT5 look at using a match_8 for each gear.
Alternatively, a mux_generic with 6 bit inputs could provide the gear number, or a pair of them could provide the speed limits.
Code:
loadrt mux_generic config="ff64,ff64,ff64" names="gear,max,min"
Your HAL file would only need to define inputs for the valid gear positions, not for all 64 possibilities.