This is (hopefully) the last part of PR35875. The code sequence we currently have
is slightly worse than the original form, due to a higher register pressure causing
more spills on thumb1 cores with few registers.
The sequence:
%an = xor i8 %a, -1 %bn = xor i8 %b, -1 %cmp15 = icmp ult i8 %an, %bn %cond = select i1 %cmp15, i8 %an, i8 %bn
is strength-reduced to
%an = xor i8 %a, -1 %bn = xor i8 %b, -1 %cmp15 = icmp ult i8 %b, %a %cond = select i1 %cmp15, i8 %an, i8 %bn
I originally tried to do this during ISEL optimisation, but constant-hoist has
transformed the -1 to constants and pulled them out into higher blocks. So it
would need to look through truncate/zext/register chains into different basic
blocks. Instead it is done here in codegen prepare, late in the pipeline so as to
not break the representation of min/max.