[LLVMbugs] [Bug 17236] New: missed opportunity to use vector FMA instruction

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 13 11:34:22 PDT 2013


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

            Bug ID: 17236
           Summary: missed opportunity to use vector FMA instruction
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: kkhoo at perfwizard.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I think this problem is similar to bug 17172. For a short vector, the SLP
vectorizer is not recognizing an FMA operation as a vector candidate?

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

$ cat fma.c 
#pragma STDC FP_CONTRACT ON
void foo(double *x) {
    int i;
    for(i=0; i<8; i++) {    
        x[i] = x[i] * x[i] + x[i];
    }
}

$ ./clang -S -O3 -fomit-frame-pointer -march=core-avx2 -o /dev/stdout fma.c
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
    .cfi_startproc
## BB#0:                                ## %entry
    vmovsd    (%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, (%rdi)
    vmovsd    8(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 8(%rdi)
    vmovsd    16(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 16(%rdi)
    vmovsd    24(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 24(%rdi)
    vmovsd    32(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 32(%rdi)
    vmovsd    40(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 40(%rdi)
    vmovsd    48(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 48(%rdi)
    vmovsd    56(%rdi), %xmm0
    vfmadd213sd    %xmm0, %xmm0, %xmm0
    vmovsd    %xmm0, 56(%rdi)
    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/20130913/f782576a/attachment.html>


More information about the llvm-bugs mailing list