diff options
author | Jiufu Guo <guojiufu@linux.ibm.com> | 2022-12-20 11:43:57 +0800 |
---|---|---|
committer | Jiufu Guo <guojiufu@linux.ibm.com> | 2022-12-20 11:52:10 +0800 |
commit | 1060cd2ad00b5174f4f8ef8ca3d8c283e321ffca (patch) | |
tree | db92c2c3b809205b93a27d0027966cab91fe3881 /gcc/rust/backend/rust-compile-struct-field-expr.cc | |
parent | d2ef2327bb357da9d4cff8111e15547441b74c99 (diff) | |
download | gcc-1060cd2ad00b5174f4f8ef8ca3d8c283e321ffca.zip gcc-1060cd2ad00b5174f4f8ef8ca3d8c283e321ffca.tar.gz gcc-1060cd2ad00b5174f4f8ef8ca3d8c283e321ffca.tar.bz2 |
rs6000: Optimize cmp on rotated 16bits constant
Hi,
When checking eq/ne with a constant which has only 16bits, it can be
optimized to check the rotated data. By this, the constant building
is optimized.
As the example in PR103743:
For "in == 0x8000000000000000LL", this patch generates:
rotldi 3,3,1 ; cmpldi 0,3,1
instead of:
li 9,-1 ; rldicr 9,9,0,0 ; cmpd 0,3,9
Compare with previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2022-August/600475.html.
This patch refactor the code according to review comments.
e.g. updating function names/comments/code.
This patch pass bootstrap and regtest on ppc64 and ppc64le.
Is it ok for trunk? Thanks for comments!
BR,
Jeff(Jiufu)
PR target/103743
gcc/ChangeLog:
* config/rs6000/rs6000-protos.h (can_be_rotated_to_lowbits): New.
(can_be_rotated_to_positive_16bits): New.
(can_be_rotated_to_negative_15bits): New.
* config/rs6000/rs6000.cc (can_be_rotated_to_lowbits): New definition.
(can_be_rotated_to_positive_16bits): New definition.
(can_be_rotated_to_negative_15bits): New definition.
* config/rs6000/rs6000.md (*rotate_on_cmpdi): New define_insn_and_split.
(eqne): Move earlier.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr103743.c: New test.
* gcc.target/powerpc/pr103743_1.c: New test.
Diffstat (limited to 'gcc/rust/backend/rust-compile-struct-field-expr.cc')
0 files changed, 0 insertions, 0 deletions