> icc generates testq for 0-30 and btq for 31-63. > That seems like a small bug in the bit 31 case.You can’t use testq for bit 31, because the immediate gets sign-extended. You *can* use the 32b form, of course.
Is that a bug in the current clang then? .globl _IsBitSet31 .align 4, 0x90 _IsBitSet31: ## @IsBitSet31 .cfi_startproc ## BB#0: pushq %rbp Ltmp157: .cfi_def_cfa_offset 16 Ltmp158: .cfi_offset %rbp, -16 movq %rsp, %rbp Ltmp159: .cfi_def_cfa_register %rbp movl $42, %ecx subq %rdi, %rcx leaq 47(%rdi), %rax testl $-2147483648, %edi ## imm = 0xFFFFFFFF80000000 cmoveq %rcx, %rax popq %rbp retq -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150123/431f10f2/attachment.html>
No, because it uses the 32b form “testl”. – Steve> On Jan 23, 2015, at 1:27 PM, Chris Sears <chris.sears at gmail.com> wrote: > > Is that a bug in the current clang then? > > .globl _IsBitSet31 > .align 4, 0x90 > _IsBitSet31: ## @IsBitSet31 > .cfi_startproc > ## BB#0: > pushq %rbp > Ltmp157: > .cfi_def_cfa_offset 16 > Ltmp158: > .cfi_offset %rbp, -16 > movq %rsp, %rbp > Ltmp159: > .cfi_def_cfa_register %rbp > movl $42, %ecx > subq %rdi, %rcx > leaq 47(%rdi), %rax > testl $-2147483648, %edi ## imm = 0xFFFFFFFF80000000 > cmoveq %rcx, %rax > popq %rbp > retq >