[cfe-dev] [LLVMdev] bitwise ops on booleans

Sanjay Patel spatel at rotateright.com
Fri Jun 26 13:56:39 PDT 2015

On Fri, Jun 26, 2015 at 2:17 PM, Joerg Sonnenberger <joerg at britannica.bec.de
> wrote:

> On Fri, Jun 26, 2015 at 12:51:38PM -0600, Sanjay Patel wrote:
> > Assuming the transform is correct, what is the recommended way to write
> > this in C/C++ to achieve the desired effect: we want both comparisons to
> be
> > evaluated (do *not* want short-circuiting)?
> Why do you want that?

For performance. The statement that materializing the condition bits is as
expensive as a branch is dependent on the arch, uarch, and data set. We're
currently only using arch for the DAG transform. So for example, x86
globally changes all of these while PPC does not. SimplifyCFG doesn't even
consider arch and does the inverse transform.

The programmer may have more knowledge about the predictability of a
specific branch and would like a way to specify that to the compiler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150626/5369c031/attachment.html>

More information about the cfe-dev mailing list