Skip to content
This repository has been archived by the owner. It is now read-only.

CBE doesn't support vectors yet #1126

Closed
llvmbot opened this issue Jan 20, 2007 · 9 comments
Closed

CBE doesn't support vectors yet #1126

llvmbot opened this issue Jan 20, 2007 · 9 comments

Comments

@llvmbot
Copy link
Collaborator

@llvmbot llvmbot commented Jan 20, 2007

Bugzilla Link 1126
Resolution FIXED
Resolved on Mar 02, 2008 02:21
Version trunk
OS All
Blocks #1481
Reporter LLVM Bugzilla Contributor
CC @nlewycky

Extended Description

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.

@lattner
Copy link

@lattner lattner commented Jan 20, 2007

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

Loading

@llvmbot
Copy link
Collaborator Author

@llvmbot llvmbot commented Jan 21, 2007

I thought we were targeting C99, not GCC ?

Loading

@lattner
Copy link

@lattner lattner commented Jan 21, 2007

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

Loading

@asl
Copy link

@asl asl commented Jan 20, 2008

*** Bug #1930 has been marked as a duplicate of this bug. ***

Loading

@lattner
Copy link

@lattner lattner commented Mar 2, 2008

This is now done, the CBE generally supports vectors.

Loading

@llvmbot
Copy link
Collaborator Author

@llvmbot llvmbot commented Nov 26, 2021

mentioned in issue #1481

Loading

@asl
Copy link

@asl asl commented Nov 26, 2021

mentioned in issue #1930

Loading

@llvmbot
Copy link
Collaborator Author

@llvmbot llvmbot commented Nov 27, 2021

mentioned in issue #970

Loading

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants