diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-09-06 10:08:16 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-09-06 10:08:16 +0200 |
commit | 8a4602c2e0f81895415ba7ee23bf81dc795d1103 (patch) | |
tree | d45c41b2fe49e3573b83c74eb9741ac12c7df030 /libgcc | |
parent | 564efbf40077c25623cdd6ce2f911c56b5b08f6c (diff) | |
download | gcc-8a4602c2e0f81895415ba7ee23bf81dc795d1103.zip gcc-8a4602c2e0f81895415ba7ee23bf81dc795d1103.tar.gz gcc-8a4602c2e0f81895415ba7ee23bf81dc795d1103.tar.bz2 |
match.pd: Fix up __builtin_*_overflow arg demotion [PR102207]
My earlier patch to demote arguments of __builtin_*_overflow unfortunately
caused a wrong-code regression. The builtins operate on infinite precision
arguments, outer_prec > inner_prec signed -> signed, unsigned -> unsigned
promotions there are just repeating the sign or 0s and can be demoted,
similarly unsigned -> signed which also is repeating 0s, but as the
testcase shows, signed -> unsigned promotions need to be preserved (unless
we'd know the inner arguments can't be negative), because for negative
numbers such promotion sets the outer_prec -> inner_prec bits to 1 bit the
bits above that to 0 in the infinite precision.
So, the following patch avoids the demotions for the signed -> unsigned
promotions.
2021-09-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/102207
* match.pd: Don't demote operands of IFN_{ADD,SUB,MUL}_OVERFLOW if they
were promoted from signed to wider unsigned type.
* gcc.dg/pr102207.c: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions