public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114032] ifcvt may introduce UB calls to __builtin_clz(0) Date: Thu, 22 Feb 2024 11:03:55 +0000 [thread overview] Message-ID: <bug-114032-4-UisB9NLWB5@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114032-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114032 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- In GCC 13 and earlier, .CLZ(0) was UB depending on CLZ_VALUE_DEFINED_AT_ZERO (...) != 2. In GCC 14, it is always UB, and well defined is only .CLZ(0, 32) (but with the current requirement that the second argument, value at zero, matches CLZ_VALUE_DEFINED_AT_ZERO (...) == 2 filled in value for scalars (exception for bitints). If we wanted, we could (but probably stage1 material) allow any constant second argument and just expand to conditional if the value doesn't match CLZ_VALUE_DEFINED_AT_ZERO (...) != 0 filled in value. But, still, for the ifcvt and vectorization it would be useful to know what is the well defined value that will be cheapest to compute. The backends could do that e.g. by supplying details for CLZ_VALUE_DEFINED_AT_ZERO on vector modes even if scalar is undefined. Or have some third way which would say this is not UB at 0, but we don't really care what value at zero it has (but then e.g. VRP would need to give up on that).
prev parent reply other threads:[~2024-02-22 11:03 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-21 14:03 [Bug tree-optimization/114032] New: " kristerw at gcc dot gnu.org 2024-02-21 14:37 ` [Bug tree-optimization/114032] " jakub at gcc dot gnu.org 2024-02-22 10:50 ` rguenth at gcc dot gnu.org 2024-02-22 11:03 ` jakub at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114032-4-UisB9NLWB5@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).