Don't fold -a / -b for unsigned operands.

Thanks to Peter Marreck and Peter Cawley. #1499
This commit is contained in:
Mike Pall 2026-08-01 19:39:35 +02:00
parent e4d805163f
commit 5ed524c09f

View File

@ -867,6 +867,8 @@ LJFOLD(MUL NEG NEG)
LJFOLD(DIV NEG NEG)
LJFOLDF(simplify_nummuldiv_negneg)
{
if (fins->o == IR_DIV && (irt_isu32(fins->t) || irt_isu64(fins->t)))
return NEXTFOLD;
PHIBARRIER(fleft);
PHIBARRIER(fright);
fins->op1 = fleft->op1; /* (-a) o (-b) ==> a o b */