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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to