I don't think any API's readily available for the purpose. One thing you can do is use the register ADC_SAR_RANGE_COND_REG . The bits 31:30 of the register control the range of the register.
Values corresponding to each mode are:
RANGE_LOW = result RANGE_HIGH
RANGE_HIGH = result
result RANGE_LOW || RANGE_HIGH = result
You may change these values dynamically to change the compare mode. It is better to stop the ADC before the register write operation and start it again. Use masking technique so that you won't disturb other bits in the register.
Happy Designing !