A compression ignition engine (60) has a control system (66) for processing data, one or more combustion chambers (62), and fuel injectors (64) for injecting fuel into the chambers. The control system controls fueling by processing engine speed and load, to select one of four fueling modes (HCCI+RVT, HCCI+IVC, HCCI+IVC+EVC, and CD+RVT) for operating the engine (FIG. 5). When HCCI+RVT mode is selected, intake valves operate with regular valve timing (RVT), and the engine is fueled to cause homogeneous-charge compression-ignition (HCCI) combustion. When HCCI+IVC mode or HCCI+IVC+EVC mode is selected, intake valve timing is changed relative to RVT, and the engine is fueled to cause HCCI combustion. When the processing selects the CD+RVT mode, the intake valves operate with RVT, and the engine is fueled to cause CD combustion. In HCCI+IVC+EVC mode, exhaust valve closing is retarded relative to its timing in HCCI+IVC mode to reduce cylinder pressure and temperature.