Open
Description
Created on behalf of @VisualEhrmanntraut
Optimiser for min, max expressions:
TYPE val; if (Z > Y) { val = Y } else { val = Z } // after TYPE val = MIN(Y, Z);``` ```// before TYPE val; if (Z < Y) { val = Y } else { val = Z } // after TYPE val = MAX(Y, Z);
This should be done after all IL simplifications like constant propagation so that the analysis has a chance to optimize the MIN/MAX code out entirely. This really is not about any particular architecture plugin either, one can reasonably expect this operation to be performed by a set of instructions rather than any one instruction, were it the latter you might compromise and lift as an intrinsic, however even that is a little disappointing as you will stonewall certain analysis regarding the input and output registers.
Putting this as an HLIL issue because I believe that is the only place this optimization can be made considering the first sentence above.