packed initializers too in the test
[oota-llvm.git] / test / Feature / packed_struct.ll
1 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
2 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3 ; RUN: diff %t1.ll %t2.ll &&
4 ; RUN: not grep cast %t2.ll &&
5 ; RUN: grep "<{" %t2.ll
6
7 %struct.anon = type <{ sbyte, int, int, int }>
8 %foos = external global %struct.anon 
9 %bara = external global [2 x <{ int, sbyte }>]
10
11 ;initializers should work for packed and non-packed the same way
12 %E1 = global <{sbyte, int, int}> {sbyte 1, int 2, int 3}
13 %E2 = global {sbyte, int, int} {sbyte 4, int 5, int 6}
14
15 implementation   ; Functions:
16
17 int %main() 
18 {
19         %tmp = load int*  getelementptr (%struct.anon* %foos, int 0, uint 1)            ; <int> [#uses=1]
20         %tmp3 = load int* getelementptr (%struct.anon* %foos, int 0, uint 2)            ; <int> [#uses=1]
21         %tmp6 = load int* getelementptr (%struct.anon* %foos, int 0, uint 3)            ; <int> [#uses=1]
22         %tmp4 = add int %tmp3, %tmp             ; <int> [#uses=1]
23         %tmp7 = add int %tmp4, %tmp6            ; <int> [#uses=1]
24         ret int %tmp7
25 }
26
27 int %bar() {
28 entry:
29         %tmp = load int* getelementptr([2 x <{ int, sbyte }>]* %bara, int 0, int 0, uint 0 )            ; <int> [#uses=1]
30         %tmp4 = load int* getelementptr ([2 x <{ int, sbyte }>]* %bara, int 0, int 1, uint 0)           ; <int> [#uses=1]
31         %tmp5 = add int %tmp4, %tmp             ; <int> [#uses=1]
32         ret int %tmp5
33 }