[LLVMbugs] [Bug 5039] New: inefficient code generation of C bitfields

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Sep 24 03:51:56 PDT 2009


           Summary: inefficient code generation of C bitfields
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rdivacky at freebsd.org
                CC: llvmbugs at cs.uiuc.edu

the attached test case produces on X86 this asm:

        pushq   %rbp
        movq    %rsp, %rbp
        shlq    $40, %rdx
        movabsq $34084860461056, %rax
        andq    %rdx, %rax
        shlq    $45, %rcx
        orq     %rax, %rcx
        shlq    $32, %r8
        movabsq $30064771072, %rax
        andq    %r8, %rax
        movl    %esi, %edx
        orl     $2097152, %edx
        andq    $2162687, %rdx
        orq     %rax, %rdx
        orq     %rcx, %rdx
        movabsq $140737488355328, %rax
        orq     %rdx, %rax
        movabsq $280405532016639, %rcx
        andq    %rax, %rcx
        movq    %rsi, %rax
        shlq    $32, %rax
        movabsq $-281474976710656, %rdx
        andq    %rax, %rdx
        orq     %rcx, %rdx
        movq    %rdx, idt(%rip)
        shrq    $32, %rsi
        movabsq $-4294967296, %rax
        andq    idt+8(%rip), %rax
        orq     %rsi, %rax
        movq    %rax, idt+8(%rip)
        popq    %rbp

while gcc generates much shorter:

        andl    $3, %ecx
        andl    $31, %edx
        movw    %si, idt(%rip)
        sall    $5, %ecx
        shrq    $16, %rsi
        andl    $7, %r8d
        orl     %ecx, %edx
        movw    %si, idt+6(%rip)
        shrq    $16, %rsi
        orl     $-128, %edx
        movw    $32, idt+2(%rip)
        movb    %r8b, idt+4(%rip)
        movb    %dl, idt+5(%rip)
        movl    %esi, idt+8(%rip)

both is with -O2.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list