[LLVMbugs] [Bug 8148] New: Inefficient code generated for rotate idiom

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 14 16:01:22 PDT 2010


           Summary: Inefficient code generated for rotate idiom
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: benny.kra at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Reported by helmut on IRC.

clang compiles this code:
#define ROTL(v, s) (((v) << (s))|((v) >> (32-(s))))
uint32_t foo(uint32_t a) { return ROTL(a + 0xd76aa478, 7); }

into a shift/or sequence instead of the more efficient "rol" instruction on
x86. Removing the addition or turning ROTL into an inline function produces the
expected result.

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