aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/error.cc
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2024-08-29 12:10:44 -0700
committerAndrew Pinski <quic_apinski@quicinc.com>2024-09-09 07:38:55 -0700
commit75a4143d69a842d691c14a477b0ba277d8708fc7 (patch)
tree51b69cdadd5f91ff29d089a700cc9340f76ca6ae /gcc/fortran/error.cc
parent8f3b402b6fca3e4b018e99f65bf22f478e888c16 (diff)
downloadgcc-75a4143d69a842d691c14a477b0ba277d8708fc7.zip
gcc-75a4143d69a842d691c14a477b0ba277d8708fc7.tar.gz
gcc-75a4143d69a842d691c14a477b0ba277d8708fc7.tar.bz2
middle-end: also optimized `popcount(a) <= 1` [PR90693]
This expands on optimizing `popcount(a) == 1` to also handle `popcount(a) <= 1`. `<= 1` can be expanded as `(a & -a) == 0` like what is done for `== 1` if we know that a was nonzero. We have to do the optimization in 2 places due to if we have an optab entry for popcount or not. Built and tested for aarch64-linux-gnu. PR middle-end/90693 gcc/ChangeLog: * internal-fn.cc (expand_POPCOUNT): Handle the second argument being `-1` for `<= 1`. * tree-ssa-math-opts.cc (match_single_bit_test): Handle LE/GT cases. (math_opts_dom_walker::after_dom_children): Call match_single_bit_test for LE_EXPR/GT_EXPR also. gcc/testsuite/ChangeLog: * gcc.target/aarch64/popcnt-le-1.c: New test. * gcc.target/aarch64/popcnt-le-2.c: New test. * gcc.target/aarch64/popcnt-le-3.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/fortran/error.cc')
0 files changed, 0 insertions, 0 deletions