https://llvm.org/bugs/show_bug.cgi?id=23827
Bug ID: 23827
Summary: bad code generated code for branches (&, &&)
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
consider the following code snippet (c++):
void ampamp(int x, int y) {
if (x < 3 && y > 10 )
printf("%d%d", x, y);
}
void amp(int x, int y) {
if ((x < 3) & (y > 10) )
printf("%d%d", x, y);
}
the assembly code generated by clang++ (all versions I tested), is not optimal.
Basically, for both methods the assembly code is identical. For the method
"amp" (with single `&') there should be generated only one jump, as branch
misprediction penalty is very high otherwise
As a side note: the code by intel's compiler (ICC) is however generating
optimal code for such scenarios, at least for versions icc13, and icc15 that
I've tested.
See: http://goo.gl/oiTPX5
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs