diff options
author | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-02-16 10:38:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 10:38:15 +0100 |
commit | 16608ca8c91d51fb48a6a55f22d392420d727b63 (patch) | |
tree | 399276d97a2442a854f4bc277e22d51fab69b128 /configure | |
parent | d2c5701fb538ec175b3fa2266d795ba63d795b3b (diff) | |
download | compcert-16608ca8c91d51fb48a6a55f22d392420d727b63.tar.gz compcert-16608ca8c91d51fb48a6a55f22d392420d727b63.zip |
Improve strength reduction of unsigned comparisons x ==u 0, x !=u 0, etc (#59)
When x is known to be either 0 or 1, comparisons such as
x == 0 x != 0 x == 1 x != 1
can be optimized away. This optimization was already performed
for signed comparisons. This commit extends the optimization to
unsigned comparisons as well.
Additionally, for PowerPC only, some unsigned (dis)equality comparisons are
turned into signed comparisons when we know it makes no difference,
i.e. when both arguments are guaranteed not to be pointers. The
reason is that Asmgen can produce shorter instruction sequences for
some signed equality comparisons than for the corresponding unsigned
comparisons.
It's important to optimize unsigned integer comparisons because casts
to the C99 type _Bool are compiled as x !=u 0 unsigned comparisons.
In particular, cascades of casts to _Bool are now reduced to a single
cast much more often than before.
Diffstat (limited to 'configure')
0 files changed, 0 insertions, 0 deletions