[LLVMbugs] [Bug 5945] New: Missed optimisation on clamp to zero

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 4 23:00:17 PST 2010


           Summary: Missed optimisation on clamp to zero
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: PowerPC
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: arplynn at gmail.com
                CC: llvmbugs at cs.uiuc.edu

In the following testcase:

define i32 @clamp0g(i32 %a)
        %cmp = icmp slt i32 %a, 0
        %sel = select i1 %cmp, i32 0, i32 %a
        ret i32 %sel

Currently, the PowerPC (32-bit) backend generates:

        cmpwi cr0, r3, 0
        li r2, 0
        blt cr0, LBB1_2
; BB#1:                                                     ; %entry
        mr r2, r3
LBB1_2:                                                     ; %entry
        mr r3, r2

This could be reduced to the much simpler:

        srawi r2, r3, 31
        andc r3, r3, r2

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