On 11/22/26 3:00 PM, Daniel Petrovic wrote:
Best guess is the optimized form causes us to miss the saturation discovery ..
Yes, seems to be the case. In match-sat-alu.pd there are matchers like this
one, for example:
(match (signed_integer_sat_add @0 @1)
/* T SUM = (T)((UT)X + (UT)IMM)
SAT_S_ADD = (X ^ SUM) < 0 && (X ^ IMM) >= 0 ? (-(T)(X < 0) ^ MAX) : SUM
*/
(cond^ (bit_and:c (lt (bit_xor @0 (nop_convert@2 (plus (nop_convert @0)
INTEGER_CST@1)))
integer_zerop)
(ge (bit_xor:c @0 INTEGER_CST@3) integer_zerop))
(signed_integer_sat_val @0)
@2)
...
Some of these matchers seem don't to trigger any more after our new fold.
I guess we need either some new sat-matchers to consider our new fold, or we
have to exclude some cases from the new folds so that old sat-matchers trigger.
Or maybe something else ?
The former variant seems more correct to me.
I'll have more time to look into this towards middle of the week.
ANd I'll get a bug filed for tracking purposes. It's not meant to put
pressure on you or anyone, just to make sure we don't lose track of the
regression.
jeff