This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On x86 we expand the code to ((xl& al) ^ al) | ((xh& ah) ^ ah) == 0 which is then if-converted. Modified testcase:
long long x; _Bool __attribute__((regparm(2))) mask (long long a) { return (x& a) == a; }
on i?86 gets you
mask: .LFB0: .cfi_startproc pushl %ebx .cfi_def_cfa_offset 8 .cfi_offset 3, -8 movl %eax, %ebx andl x, %ebx movl %edx, %ecx andl x+4, %ecx xorl %ebx, %eax xorl %ecx, %edx orl %edx, %eax sete %al popl %ebx .cfi_restore 3 .cfi_def_cfa_offset 4 ret
so I wonder if you should investigate why the xor variant doesn't trigger for you?
On i?86 if-conversion probably solves your specific issue, but I guess the initial expansion is where you could improve placement of the 1 (after all, the 0 is after the jumps).
-- PMatos
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |