[LLVMbugs] [Bug 17417] New: big vector causes code explosion (no looping with vector attributes?)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 30 15:58:35 PDT 2013


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

            Bug ID: 17417
           Summary: big vector causes code explosion (no looping with
                    vector attributes?)
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kkhoo at perfwizard.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Apologies if I've misunderstood the intent of the 'ext_vector_type' attribute,
but I did not expect the following source code to generate over 4KB of machine
code:

$ cat vecadd.c
typedef float big_float_vector __attribute__((ext_vector_type(800)));

big_float_vector foo(big_float_vector x, big_float_vector y) {
    return x + y;
}

$ ./clang -Os -S -fomit-frame-pointer vecadd.c -o - -emit-llvm
; ModuleID = 'vecadd.c'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.7.0"

; Function Attrs: nounwind optsize readonly ssp uwtable
define <800 x float> @foo(<800 x float>* byval nocapture readonly align 32,
<800 x float>* byval nocapture readonly align 32) #0 {
entry:
  %x = load <800 x float>* %0, align 32
  %y = load <800 x float>* %1, align 32
  %add = fadd <800 x float> %x, %y
  ret <800 x float> %add
}

attributes #0 = { nounwind optsize readonly ssp uwtable
"less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "unsafe-fp-math"="false"
"use-soft-float"="false" }

$ ./clang -Os -S -fomit-frame-pointer vecadd.c -o -
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
_foo:                                   ## @foo
    .cfi_startproc
## BB#0:                                ## %entry
    pushq    %rbp
Ltmp2:
    .cfi_def_cfa_offset 16
Ltmp3:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
Ltmp4:
    .cfi_def_cfa_register %rbp
    andq    $-32, %rsp
    subq    $32, %rsp
    movaps    3200(%rbp), %xmm0
    movaps    3184(%rbp), %xmm1
    movaps    3152(%rbp), %xmm2
    addps    7248(%rbp), %xmm2
    addps    7280(%rbp), %xmm1
    addps    7296(%rbp), %xmm0
    movaps    16(%rbp), %xmm8
    movaps    32(%rbp), %xmm9
    movaps    48(%rbp), %xmm5
    movaps    64(%rbp), %xmm6
    movaps    3072(%rbp), %xmm7
    movaps    3136(%rbp), %xmm3
    addps    7232(%rbp), %xmm3
    addps    7168(%rbp), %xmm7
    addps    4160(%rbp), %xmm6
    movaps    3088(%rbp), %xmm4
    addps    7184(%rbp), %xmm4
    movaps    %xmm0, 3184(%rdi)
...

(and so on - no loop for an 800 element vector)

This is with:
$ ./clang -v
clang version 3.4 (trunk 191675) (llvm/trunk 191675:191681M)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

-- 
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/20130930/1fb72c4d/attachment.html>


More information about the llvm-bugs mailing list