[LLVMbugs] [Bug 20648] New: having a select instruction doesn't mean we need to use it (x86 - blend)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 13 08:40:34 PDT 2014


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

            Bug ID: 20648
           Summary: having a select instruction doesn't mean we need to
                    use it (x86 - blend)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Better hardware earned us more instructions, more data, and worse performance.

Using llc with x86-64 target built from r215293:

$ cat blend.ll 
define void @foo(<4 x i32>* %f) {
  %select = select <4 x i1> <i1 1, i1 0, i1 0, i1 1>, <4 x i32> <i32 1, i32 1,
i32 1, i32 1>, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
  store <4 x i32> %select, <4 x i32>* %f, align 4
  ret void
}

$ ./llc blend.ll --mattr="-sse4.1" -o -
...
LCPI0_0:
    .long    1                       ## 0x1
    .long    2                       ## 0x2
    .long    2                       ## 0x2
    .long    1                       ## 0x1
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
    .cfi_startproc
## BB#0:
    movaps    LCPI0_0(%rip), %xmm0  <--- precomputed select data loaded
    movups    %xmm0, (%rdi)
    retq

$ ./llc blend.ll --mattr="+sse4.1" -o -
...
LCPI0_0:
    .long    2                       ## 0x2
    .long    2                       ## 0x2
    .long    2                       ## 0x2
    .long    2                       ## 0x2
LCPI0_1:                               <--- 16 extra bytes of constant pool
    .long    1                       ## 0x1
    .long    1                       ## 0x1
    .long    1                       ## 0x1
    .long    1                       ## 0x1
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
    .cfi_startproc
## BB#0:
    movaps    LCPI0_1(%rip), %xmm0        <--- 2 loads and a select
    blendps    $6, LCPI0_0(%rip), %xmm0
    movups    %xmm0, (%rdi)
    retq

-- 
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/20140813/c7a23acc/attachment.html>


More information about the llvm-bugs mailing list