1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-- -relocation-model=static | FileCheck %s
4 @X = external dso_local global [0 x i32]
6 define void @foo() nounwind {
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: pushl %eax
10 ; CHECK-NEXT: movl %esp, %eax
11 ; CHECK-NEXT: pushl %eax
12 ; CHECK-NEXT: calll frob@PLT
13 ; CHECK-NEXT: addl $4, %esp
14 ; CHECK-NEXT: leal X(%esp), %eax
15 ; CHECK-NEXT: pushl %eax
16 ; CHECK-NEXT: calll borf@PLT
17 ; CHECK-NEXT: addl $4, %esp
18 ; CHECK-NEXT: popl %eax
22 call void @frob(ptr %Y) nounwind
23 %ctg2 = getelementptr i8, ptr %Y, i32 ptrtoint (ptr @X to i32)
24 %0 = ptrtoint ptr %ctg2 to i32
25 call void @borf(i32 %0) nounwind
29 define void @bar(i32 %i) nounwind {
31 ; CHECK: # %bb.0: # %entry
32 ; CHECK-NEXT: pushl %esi
33 ; CHECK-NEXT: subl $40, %esp
34 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %esi
35 ; CHECK-NEXT: movl %esp, %eax
36 ; CHECK-NEXT: pushl %eax
37 ; CHECK-NEXT: calll frob@PLT
38 ; CHECK-NEXT: addl $4, %esp
39 ; CHECK-NEXT: leal X(%esp,%esi,4), %eax
40 ; CHECK-NEXT: pushl %eax
41 ; CHECK-NEXT: calll borf@PLT
42 ; CHECK-NEXT: addl $44, %esp
43 ; CHECK-NEXT: popl %esi
46 %Y = alloca [10 x i32]
47 call void @frob(ptr %Y) nounwind
48 %0 = getelementptr [0 x i32], ptr @X, i32 0, i32 %i
49 %1 = ptrtoint ptr %Y to i32
50 %ctg2 = getelementptr i8, ptr %0, i32 %1
51 %2 = ptrtoint ptr %ctg2 to i32
52 call void @borf(i32 %2) nounwind
56 declare void @frob(ptr)
58 declare void @borf(i32)