]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/114203 - wrong CLZ niter computation
authorRichard Biener <rguenther@suse.de>
Mon, 4 Mar 2024 09:38:31 +0000 (10:38 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 21 Mar 2024 11:48:59 +0000 (12:48 +0100)
commita729b1227bc8c84cd91a3b8c9c9d11bc43d415de
tree83aec9798eb41de7d2db5f56d64c5a60afc52cb1
parenta3ff14ac4804be400a52dcf630f0de2d57cae835
tree-optimization/114203 - wrong CLZ niter computation

For precision less than int we apply the adjustment to make it defined
at zero after the adjustment to make it compute CLZ rather than CTZ.
That's wrong.

PR tree-optimization/114203
* tree-ssa-loop-niter.cc (build_cltz_expr): Apply CTZ->CLZ
adjustment before making the result defined at zero.

* gcc.dg/torture/pr114203.c: New testcase.

(cherry picked from commit cde50296a19b109909089b91d532d2c8455f5f10)
gcc/testsuite/gcc.dg/torture/pr114203.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.cc