https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98229
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:1423318fa778649365f5a73c2c4657733e191820 commit r11-5929-g1423318fa778649365f5a73c2c4657733e191820 Author: Jakub Jelinek <[email protected]> Date: Fri Dec 11 12:47:52 2020 +0100 expand: Fix up expand_doubleword_mod on 32-bit targets [PR98229] As the testcase shows, for 32-bit word size we can end up with op1 up to 0xffffffff (0x100000000 % 0xffffffff == 1 and so we use bit == 32 for that), but the CONST_INT we got from caller is for DImode in that case and not valid for SImode operations. The following patch canonicalizes the two spots where the constant needs canonicalization. 2020-12-10 Jakub Jelinek <[email protected]> PR rtl-optimization/98229 * optabs.c (expand_doubleword_mod): Canonicalize op1 and 1 - INTVAL (op1) as word_mode constants when used in word_mode arithmetics. * gcc.c-torture/compile/pr98229.c: New test.
