http://llvm.org/bugs/show_bug.cgi?id=17956
Bug ID: 17956
Summary: LLVM introduces unneeded shifts in bitfield comparison
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
consider:
struct foo {
int f_x : 1;
int f_y : 1;
};
int foo(struct foo *f) {
return f->f_x == f->f_y;
}
we generate:
movb (%rdi), %al
movb %al, %cl
shlb $6, %cl
sarb $7, %cl
shlb $7, %al
sarb $7, %al
cmpb %cl, %al
sete %al
movzbl %al, %eax
ret
All of those shifts seem superfluous:
movl (%rdi), %ecx
testl %ecx, %ecx
sete %al # set $al to 1 if *f == zero
cmpl $3, %ecx
sete %cl # set $cl to 1 if *f == 3
orb %al, %cl
movzbl %cl, %eax
--
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