diff options
author | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2023-07-31 16:35:33 +0200 |
---|---|---|
committer | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2023-07-31 16:35:33 +0200 |
commit | 7cdd0860949c6c3232e6cff1d7ca37bb5234074c (patch) | |
tree | 6cb1a23e54b8af2c47c2cba403e8ad73850e9230 /gcc/c/c-parser.cc | |
parent | 5a770748e8eea38a4ed1f3c4dd8d807aa1640536 (diff) | |
download | gcc-7cdd0860949c6c3232e6cff1d7ca37bb5234074c.zip gcc-7cdd0860949c6c3232e6cff1d7ca37bb5234074c.tar.gz gcc-7cdd0860949c6c3232e6cff1d7ca37bb5234074c.tar.bz2 |
combine: Narrow comparison of memory and constant
Comparisons between memory and constants might be done in a smaller mode
resulting in smaller constants which might finally end up as immediates
instead of in the literal pool.
For example, on s390x a non-symmetric comparison like
x <= 0x3fffffffffffffff
results in the constant being spilled to the literal pool and an 8 byte
memory comparison is emitted. Ideally, an equivalent comparison
x0 <= 0x3f
where x0 is the most significant byte of x, is emitted where the
constant is smaller and more likely to materialize as an immediate.
Similarly, comparisons of the form
x >= 0x4000000000000000
can be shortened into x0 >= 0x40.
gcc/ChangeLog:
* combine.cc (simplify_compare_const): Narrow comparison of
memory and constant.
(try_combine): Adapt new function signature.
(simplify_comparison): Adapt new function signature.
gcc/testsuite/ChangeLog:
* gcc.dg/cmp-mem-const-1.c: New test.
* gcc.dg/cmp-mem-const-2.c: New test.
* gcc.dg/cmp-mem-const-3.c: New test.
* gcc.dg/cmp-mem-const-4.c: New test.
* gcc.dg/cmp-mem-const-5.c: New test.
* gcc.dg/cmp-mem-const-6.c: New test.
* gcc.target/s390/cmp-mem-const-1.c: New test.
Diffstat (limited to 'gcc/c/c-parser.cc')
0 files changed, 0 insertions, 0 deletions