[LLVMbugs] [Bug 17170] New: missed opportunity to use wider (AVX2) vectors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 9 09:46:50 PDT 2013


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

            Bug ID: 17170
           Summary: missed opportunity to use wider (AVX2) vectors
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: kkhoo at perfwizard.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code sequence is correctly identified as an opportunity to use a
parallel (AVX) addition operation, but it could have been optimized further by
using 32-byte (8-integer) vector instructions rather than 16-byte (4-integer)
vector instructions:

$ ./clang -v
clang version 3.4 (trunk 189776)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

$ cat paddd.c
void foo(int *restrict x, int *restrict y, int *restrict z) {
    int i;
    for (i=0; i<8; i++) {
        z[i] = x[i] + y[i];
    }
}

$ ./clang -S -std=c99 -O3 -funroll-loops -fomit-frame-pointer -march=core-avx2
-o /dev/stdout paddd.c 
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
    .cfi_startproc
## BB#0:                                ## %entry
    vmovdqu    (%rdi), %xmm0
    vpaddd    (%rsi), %xmm0, %xmm0
    vmovdqu    %xmm0, (%rdx)
    vmovdqu    16(%rdi), %xmm0
    vpaddd    16(%rsi), %xmm0, %xmm0
    vmovdqu    %xmm0, 16(%rdx)
    ret

-- 
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/20130909/fc0405e5/attachment.html>


More information about the llvm-bugs mailing list