]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fold-const: Handle CTZ like CLZ in tree_call_nonnegative_warnv_p [PR115337]
authorJakub Jelinek <jakub@redhat.com>
Tue, 4 Jun 2024 13:52:09 +0000 (15:52 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 4 Jun 2024 13:52:09 +0000 (15:52 +0200)
I think we can handle CTZ exactly like CLZ in tree_call_nonnegative_warnv_p.
Like CLZ, if it is UB at zero, the result range is [0, prec-1] and if it is
well defined at zero, the second argument provides the value at zero.

2024-06-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/115337
* fold-const.cc (tree_call_nonnegative_warnv_p): Handle
CASE_CFN_CTZ like CASE_CFN_CLZ.

gcc/fold-const.cc

index 048c654c848170989985b24dbbe365fec6402cf8..92b048c307e291446c5de521ae9b6f8b710682e9 100644 (file)
@@ -15250,6 +15250,7 @@ tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
       return true;
 
     CASE_CFN_CLZ:
+    CASE_CFN_CTZ:
       if (arg1)
        return RECURSE (arg1);
       return true;