[Bug 15018] New: [PATCH] Use x86 BSR instruction in Log2 functions

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Mar 14 19:19:30 PDT 2008


           Summary: [PATCH] Use x86 BSR instruction in Log2 functions
           Product: xorg
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: medium
         Component: Driver/Radeon
        AssignedTo: xorg-driver-ati at lists.x.org
        ReportedBy: mattst88 at gmail.com
         QAContact: xorg-team at lists.x.org

Created an attachment (id=15133)
 --> (http://bugs.freedesktop.org/attachment.cgi?id=15133)
Enable BSR in Log2 functions

This patch edits RADEONLog2 and ATILog2 to use the x86 BSR instruction instead
of looping through bits. It should provide a somewhat of a speed increase in
this function on x86 and AMD64 architectures.

Note: the BSR instruction was added with the 80386 CPU and is therefore not
compatible with earlier CPUs, though I highly doubt it's even possible to use a
286 in conjunction with a Radeon.

The inline assembly also works with Intel's compiler (icc).

Assembly output for current RADEONLog2:
        testl   %edi, %edi
        movl    $-1, %eax
        je      .L4
        xorl    %eax, %eax
        .p2align 4,,7
        addl    $1, %eax
        sarl    %edi
        jne     .L5
        subl    $1, %eax
        rep ; ret

Assembly output for BSR-enabled RADEONLog2:
        movl    %edi, %ecx
        bsrl    %ecx, %eax

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

More information about the xorg-driver-ati mailing list