https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61298
--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > I think I have seen this bug before. The problem comes from using > non-logical compares for equal but logical compares for the others. Maybe you were thinking of PR16458 ? That bugzilla did try and solve the problem that the old code always wanted to use signed compares for equal/not equal. The old code in rs6000.c did have the test for the subreg and SUBREG_PROMOTED_UNSIGNED_P. I moved that to the new unsigned_reg_p() that richi requested and added the test for REG_P and TYPE_UNSIGNED (added revision 186312). I can say that unsigned_reg_p() probably doesn't catch every case where we're doing an unsigned compare and force it to use non signed compare. Since you have a subreg, have you looked at how SUBREG_PROMOTED_UNSIGNED_P is set? Is that supposed to be set for your case?