Chris Lattner
5cc2e45e2d
In the common case where we are shuffling a vector, emit an
...
llvm vector shuffle instead of a bunch of insert/extract operations.
For: vec4 = vec4.yyyy; // splat
Emit:
%tmp1 = shufflevector <4 x float> %tmp, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 >
instead of:
%tmp1 = extractelement <4 x float> %tmp, i32 1
%tmp2 = insertelement <4 x float> undef, float %tmp1, i32 0
%tmp3 = extractelement <4 x float> %tmp, i32 1
%tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1
%tmp5 = extractelement <4 x float> %tmp, i32 1
%tmp6 = insertelement <4 x float> %tmp4, float %tmp5, i32 2
%tmp7 = extractelement <4 x float> %tmp, i32 1
%tmp8 = insertelement <4 x float> %tmp6, float %tmp7, i32 3
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40779 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 16:09:33 +00:00
Chris Lattner
3b126125ec
Add support for scalar-returning element accesses like V.x
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40777 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 15:52:31 +00:00
Chris Lattner
46ea8eb7cc
implement lvalue to rvalue conversion for ocuvector components. We can now compile stuff
...
like this:
typedef __attribute__(( ocu_vector_type(4) )) float float4;
float4 test1(float4 V) {
return V.wzyx+V;
}
to:
_test1:
pshufd $27, %xmm0, %xmm1
addps %xmm0, %xmm1
movaps %xmm1, %xmm0
ret
and:
_test1:
mfspr r2, 256
oris r3, r2, 4096
mtspr 256, r3
li r3, lo16(LCPI1_0)
lis r4, ha16(LCPI1_0)
lvx v3, r4, r3
vperm v3, v2, v2, v3
vaddfp v2, v3, v2
mtspr 256, r2
blr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40771 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 00:16:29 +00:00
Chris Lattner
349aaec106
add support for codegen of an OCUVectorComponent as an lvalue.
...
We can now codegen:
vec4.xy;
as nothing!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 23:37:31 +00:00
Chris Lattner
d14faaa7ec
silence some warnings.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40761 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 21:50:34 +00:00
Chris Lattner
bf98651d42
update this to build with LLVM ToT
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40665 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 06:24:52 +00:00
Anders Carlsson
227426661b
Implement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40162 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 05:21:51 +00:00
Chris Lattner
a87b63b492
silence a warning by treating ocuvectors the same as vectors.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40037 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 05:13:51 +00:00
Chris Lattner
5e3fbe503a
implement codegen support for sizeof/alignof
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40009 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-18 18:12:07 +00:00
Chris Lattner
da13870e99
Implement break and continue. Patch by Anders Carlsson!
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39927 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:28:45 +00:00
Chris Lattner
99e0d7905d
Add a hack (mirroring llvm-gcc) to pointer difference
...
codegen to compile:
int test(int *A, int *B) {
return A-B;
}
into:
_test:
movl 4(%esp), %eax
subl 8(%esp), %eax
sarl $2, %eax
ret
instead of:
_test:
movl 4(%esp), %eax
subl 8(%esp), %eax
movl %eax, %ecx
sarl $31, %ecx
shrl $30, %ecx
addl %ecx, %eax
sarl $2, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39902 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 05:43:05 +00:00
Chris Lattner
590b6646ef
Refactor code so that isIntegerConstantExpr has an ASTContext available.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39884 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 23:26:56 +00:00
Gabor Greif
d5e0d9854c
add FIXME and un-XFAIL test
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 20:05:18 +00:00
Chris Lattner
d2d2a11a91
A significant refactoring of the type size stuff to also
...
compute type alignment. This info is needed for struct layout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39850 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 01:29:45 +00:00
Chris Lattner
8f32f7189b
Implement trivial integer initializers, like 'int X = 4;' for global
...
vars. Approach suggested by Keith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39849 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 00:23:28 +00:00
Chris Lattner
32b266cff6
In "int X,Y;", compile both X and Y.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39848 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 00:16:50 +00:00
Chris Lattner
06c8d963bc
add a fixme
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39847 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 00:01:01 +00:00
Gabor Greif
4db18f279b
implement _Complex * == and !=
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39841 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:33:18 +00:00
Chris Lattner
a7674d8a9a
Move getSize() out of type, into ASTContext, where it has target info, and
...
where ASTContext can manage caches for struct layout, etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39835 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 22:13:22 +00:00
Chris Lattner
d07eb3b5b4
implement codegen support for implicit casts.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39831 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:25:53 +00:00
Chris Lattner
a80b0bafd4
silence a bogus gcc warning.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39824 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 20:07:11 +00:00
Chris Lattner
b0a721a51a
"Codegen for Character Literals and Conditional Operator
...
Both in one patch, and the test case that Chris didn't commit last
time is in there too...
I'll split the patch up if somebody wants it split."
Patch by Keith Bauer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 05:18:11 +00:00
Chris Lattner
88a69ad80e
implement support for basic codegen of global variables with no initializers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39795 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 05:13:43 +00:00
Chris Lattner
fa7c64562d
"Someone typed "PtrToInt" where they meant "IntToPtr".
...
I've added a tests/CodeGen directory, and a test for this case that
used to fail and now passes."
Patch by Keith Bauer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 03:25:53 +00:00
Chris Lattner
8b9023ba35
Implement codegen for + and - with pointers. Patch contributed by
...
Keith Bauer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 03:05:23 +00:00
Chris Lattner
6fa5f0943a
Fix "no newline at end of file" warnings. Patch contributed by
...
Benoit Boissinot!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39780 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 15:43:07 +00:00
Chris Lattner
1978596a6f
Evaluate the initializer for automatic variables.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39771 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 00:39:48 +00:00
Chris Lattner
572747983b
implement codegen support for pre/post inc/dec.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39765 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 23:43:46 +00:00
Reid Spencer
5f016e2cb5
Stage two of getting CFE top correct.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 17:01:13 +00:00