1 ; RUN: llc -O2 --relocation-model=pic -mtriple=i386-unknown-linux-gnu < %s 2>&1 | FileCheck %s
3 ; List the source code:
4 ; // clang -m32 -fasm-blocks -S t.c -O2 -fpic -emit-llvm
7 ; extern unsigned int extern_func();
8 ; static unsigned int static_func() __attribute__((noinline));
9 ; static unsigned int static_func() {
30 @GV = local_unnamed_addr global i32 17, align 4
32 define void @func() local_unnamed_addr #0 {
36 ; CHECK-NEXT: popl %ebx
38 ; CHECK-NEXT: addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %ebx
39 ; CHECK-NEXT: calll static_func
42 ; CHECK-NEXT: calll static_func
43 ; CHECK-NEXT: calll extern_func@PLT
44 ; CHECK-NEXT: jmp extern_func@PLT
45 ; CHECK-NEXT: shrl $0, %eax
46 ; CHECK-NEXT: shrl $0, %ebx
47 ; CHECK-NEXT: shrl $0, %ecx
48 ; CHECK-NEXT: shrl $0, %edx
49 ; CHECK-NEXT: shrl $0, %edi
50 ; CHECK-NEXT: shrl $0, %esi
51 ; CHECK-NEXT: shrl $0, %ebp
52 ; CHECK-NEXT: shrl $0, %esp
56 %call = tail call i32 @static_func()
57 ;; We test call, CALL, and jmp.
58 tail call void asm sideeffect inteldialect "call ${0:P}\0A\09CALL ${1:P}\0A\09jmp ${1:P}\0A\09shr eax, $$0\0A\09shr ebx, $$0\0A\09shr ecx, $$0\0A\09shr edx, $$0\0A\09shr edi, $$0\0A\09shr esi, $$0\0A\09shr ebp, $$0\0A\09shr esp, $$0", "*m,*m,~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{flags},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"(ptr nonnull elementtype(i32 (...)) @static_func, ptr nonnull elementtype(i32 (...)) @extern_func) #0
62 declare i32 @extern_func(...) #0
64 define internal i32 @static_func() #0 {
66 %0 = load i32, ptr @GV, align 4
67 %inc = add nsw i32 %0, 1
68 store i32 %inc, ptr @GV, align 4
72 attributes #0 = { nounwind }