[llvm-bugs] [Bug 32105] New: [PowerPC] inefficient codegen for select with negative constant

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 1 09:35:19 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=32105

            Bug ID: 32105
           Summary: [PowerPC] inefficient codegen for select with negative
                    constant
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

This is a simpler example than:
https://reviews.llvm.org/D30502

define i32 @sel_with_negative_constant(i1 %cond) {
  %sel = select i1 %cond, i32 -32, i32 2
  ret i32 %sel
}

...the extension to i64 return type seems to make the simple -32 constant turn
into:

$ ./llc -o - ppcshl.ll -mtriple=powerpc64le 
...
        lis 4, 2047 ; 0x07FF (top 5 bits are clear)
        andi. 3, 3, 1
        ori 3, 4, 65535 0xFFFF
        li 4, 2
        sldi 3, 3, 5 ; 0x00000000FFFFFFE0 (-32 with top 32 bits cleared?)
        isel 3, 3, 4, 1
        blr

I'm working on DAG patches that would eliminate the isel for
select-of-constants, but the extension to i64 for negative constants seems to
be interfering on PPC64. See:
https://reviews.llvm.org/D30180
...tests with -1 should have folded to almost nothing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170301/f49bd25d/attachment-0001.html>


More information about the llvm-bugs mailing list