diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-11-21 09:32:37 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-11-21 09:32:37 +0100 |
commit | 8a8a6d60c670c5153c5109df5fe68deb6fcf466d (patch) | |
tree | a29901a239bdaa4cb0972956ee2f76f5446a096b /gcc/tree-vect-loop.cc | |
parent | 7ad308bd4cca871e7509a5eeaef83ee68678820f (diff) | |
download | gcc-8a8a6d60c670c5153c5109df5fe68deb6fcf466d.zip gcc-8a8a6d60c670c5153c5109df5fe68deb6fcf466d.tar.gz gcc-8a8a6d60c670c5153c5109df5fe68deb6fcf466d.tar.bz2 |
builtins: Fix fold_builtin_query clzg/ctzg side-effects handling [PR112639]
As the testcase shows, I've missed one spot where initially the code thinks
it could use 2 argument IFN_CLZ/IFN_CTZ form, but then verifies it can't
because it doesn't have the right target value and turns it into the
arg0 ? arg1 : .C[LT]Z (arg0)
form. That form evaluates the argument twice though and so needs save_expr,
which I've missed to call in that case. In other cases where it is known
from the beginning that it will be needed (e.g. the __builtin_clzg case
on types smaller than unsigned int where we'll need to add an addend
to the clz value) or the unsigned __int128 expansion called save_expr
before.
2023-11-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/112639
* builtins.cc (fold_builtin_bit_query): If arg0 has side-effects, arg1
is specified but cleared, call save_expr on arg0.
* gcc.dg/torture/pr112639.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
0 files changed, 0 insertions, 0 deletions