[LLVMbugs] [Bug 12212] New: LLVM omits the multiplication-to-shift conversion for negative non-power-of 2 constants

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 8 15:29:01 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12212

             Bug #: 12212
           Summary: LLVM omits the multiplication-to-shift conversion for
                    negative non-power-of 2 constants
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: weimingz at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


On ARM architecture, LLVM is missing multiplication-to-shift conversions when
one operand is a negative constant and the other operand is an integer typed
variable. 

For example, for 
foo(x)
{
 return x * -3;
}

LLVM emits a "mul" instr.

However, it should be converted to x-x<<2 (sub r0, r0, r0, lsl #2), which is a
more efficient operation on ARM than the "mul" instruction.

For positive constants, like x*3, LLVM emits the shift/add instruction
correctly.

-- 
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