aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorArjun Shankar <arjun@redhat.com>2022-06-21 12:12:11 +0200
committerJakub Jelinek <jakub@redhat.com>2022-06-21 12:13:52 +0200
commitab981aab92cbc71918fbaadcf6fa64bdb2b69be7 (patch)
treef655a675752e9fd0e7a2c0b6f3d07fff26dcd8be /libgo
parenta0c30fe3b888f20215f3e040d21b62b603804ca9 (diff)
downloadgcc-ab981aab92cbc71918fbaadcf6fa64bdb2b69be7.zip
gcc-ab981aab92cbc71918fbaadcf6fa64bdb2b69be7.tar.gz
gcc-ab981aab92cbc71918fbaadcf6fa64bdb2b69be7.tar.bz2
match.pd: Remove "+ 0x80000000" in int comparisons [PR94899]
Expressions of the form "X + CST < Y + CST" where: * CST is an unsigned integer constant with only the MSB set, and * X and Y's types have integer conversion ranks <= CST's can be simplified to "(signed) X < (signed) Y". This is because, assuming a 32-bit signed numbers, (unsigned) INT_MIN + 0x80000000 is 0, and (unsigned) INT_MAX + 0x80000000 is UINT_MAX. i.e. the result increases monotonically with signed input. This means: ((signed) X < (signed) Y) iff (X + 0x80000000 < Y + 0x80000000) gcc/ PR tree-optimization/94899 * match.pd (X + C < Y + C -> (signed) X < (signed) Y, if C is 0x80000000): New simplification. gcc/testsuite/ * gcc.dg/pr94899.c: New test.
Diffstat (limited to 'libgo')
0 files changed, 0 insertions, 0 deletions