https://llvm.org/bugs/show_bug.cgi?id=27344
Bug ID: 27344 Summary: __builtin_expect(cond, 0) always produces CMOV under -O2 Product: clang Version: unspecified Hardware: Macintosh OS: MacOS X Status: NEW Severity: normal Priority: P Component: libclang Assignee: unassignedclangb...@nondot.org Reporter: brian.armstrong....@gmail.com CC: kli...@google.com, llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 16215 --> https://llvm.org/bugs/attachment.cgi?id=16215&action=edit Find minimum element of an array I have an if statement with __builtin_expect where I expect the branch will be taken very seldom. However, clang will always produce cmov instructions for this branch. I suspect that branches will be faster for this particular case, although I haven't been able to get clang to produce the branch version in order to do the comparison. Although I generally try to trust the compiler's judgment for these sorts of matters, it would be nice to be able to compare the behavior for branches vs cmov. In my particular program, I'm spending 25% of my CPU time on a pair of cmovs similar to the snippet attached. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs