blob: d06f9164da62f8146693b4b5957524bbded831d4 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep foos+5
2; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep foos+1
3; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep foos+9
4; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep bara+19
5; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep bara+4
6
7; make sure we compute the correct offset for a packed structure
8
9;Note: codegen for this could change rendering the above checks wrong
10
11; ModuleID = 'foo.c'
12target datalayout = "e-p:32:32"
13target endian = little
14target pointersize = 32
15target triple = "i686-pc-linux-gnu"
16 %struct.anon = type <{ sbyte, int, int, int }>
17%foos = external global %struct.anon
18%bara = weak global [4 x <{ int, sbyte }>] zeroinitializer
19
20implementation ; Functions:
21
22int %foo() {
23entry:
24 %tmp = load int* getelementptr (%struct.anon* %foos, int 0, uint 1)
25 %tmp3 = load int* getelementptr (%struct.anon* %foos, int 0, uint 2)
26 %tmp6 = load int* getelementptr (%struct.anon* %foos, int 0, uint 3)
27 %tmp4 = add int %tmp3, %tmp
28 %tmp7 = add int %tmp4, %tmp6
29 ret int %tmp7
30}
31
32sbyte %bar() {
33entry:
34 %tmp = load sbyte* getelementptr([4 x <{ int, sbyte }>]* %bara, int 0, int 0, uint 1 )
35 %tmp4 = load sbyte* getelementptr ([4 x <{ int, sbyte }>]* %bara, int 0, int 3, uint 1)
36 %tmp5 = add sbyte %tmp4, %tmp
37 ret sbyte %tmp5
38}