First Last Prev Next    No search results available
Details
: CBE doesn't support vectors yet
Bug#: 1126
: libraries
: Backend: C
Status: RESOLVED
Resolution: FIXED
: All
: All
: trunk
: P2
: normal
: ---

:
: missing-feature
:
: 1481
  Show dependency tree - Show dependency graph
People
Reporter: Gordon Henriksen <gordonhenriksen@mac.com>
Assigned To: Unassigned LLVM Bugs <unassignedbugs@nondot.org>
:

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2007-01-20 11:14
Noticed through inspection.

% cat cbev.ll
define <4 x i32> %foo(<4 x i32> %a, <4 x i32> %b) {
  %c = sub <4 x i32> %a, %b
  %d = add <4 x i32> %b, %c
  %e = mul <4 x i32> %c, %d
;  %f = udiv <4 x i32> %d, %e   ; Fails an assertion in CBackend.cpp
;  %g = sdiv <4 x i32> %e, %f   ; Same
  ret <4 x i32> %e
}
% llvm-as -o cbev.bc cbev.ll
% llc -march=c -o cbev.c cbev.bc
% tail -n 7 cbev.c
unsigned int foo(unsigned int ltmp_0_1[4], unsigned int ltmp_1_1[4])[4] {
  unsigned int ltmp_2_1[4];

  ltmp_2_1 = ltmp_0_1 - ltmp_1_1;
  return (ltmp_2_1*(ltmp_1_1 + ltmp_2_1));
}

% gcc -o cbev.o -c cbev.c
cbev.c:106: error: ‘foo’ declared as function returning an array
cbev.c:107: warning: conflicting types for built-in function ‘malloc’
cbev.c:129: error: ‘foo’ declared as function returning an array
cbev.c: In function ‘foo’:
cbev.c:132: error: incompatible types in assignment
cbev.c:133: error: invalid operands to binary +

An error message, inserting a vector lowering pass before the CBE, or fixing the codegen would all be 
improvements.

Emitting Altivec 'vector' types instead of arrays would make fixing the codegen relatively easy when 
targetting PowerPC, since Altivec provides operator overloads for vector ops.
------- Comment #1 From Chris Lattner 2007-01-20 14:32:46 -------
Yep, you're right.  The most straight-forward way to compile this is to emit
code that uses the gcc 
__attribute__(vector_size) extension.

-Chris
------- Comment #2 From Reid Spencer 2007-01-20 20:33:02 -------
I thought we were targeting C99, not GCC ?
------- Comment #3 From Chris Lattner 2007-01-20 23:12:49 -------
We already target "any compiler that supports the gcc extensions", e.g. due to
intrinsics.

There is no way for the CBE to produce abi-compliant code without using GCC
extensions.  If the CBE 
doesn't respect the native ABI, it can't be used by bugpoint and won't interop
with native libraries right.  I 
consider this a non-starter.

-Chris
------- Comment #5 From Anton Korobeynikov 2008-01-19 16:57:53 -------
*** Bug 1930 has been marked as a duplicate of this bug. ***
------- Comment #6 From Chris Lattner 2008-03-02 02:21:39 -------
This is now done, the CBE generally supports vectors.

First Last Prev Next    No search results available