1 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu -relocation-model=pic \ 2 ; RUN: | FileCheck -check-prefix=X64 --check-prefix=PIC %s 3 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux-gnu \ 4 ; RUN: | FileCheck -check-prefix=X64 --check-prefix=STATIC %s 5 6 define i32 @fp_weakfunc() { 7 ; X64: weakfunc@GOTPCREL(%rip) 8 ret i32 select (i1 icmp ne (i32 ()* @weakfunc, i32 ()* null), i32 1, i32 0) 9 } 10 declare extern_weak i32 @weakfunc() nonlazybind 11 12 define void @memset_call(i8* nocapture %a, i8 %c, i32 %n) { 13 ; X64: callq *memset@GOTPCREL(%rip) 14 call void @llvm.memset.p0i8.i32(i8* %a, i8 %c, i32 %n, i1 false) 15 ret void 16 } 17 18 define void @memcpy_call(i8* nocapture %a, i8* nocapture readonly %b, i64 %n) { 19 ; X64: callq *memcpy@GOTPCREL(%rip) 20 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 %n, i32 1, i1 false) 21 ret void 22 } 23 24 define i32 @main() { 25 ; X64: callq *foo@GOTPCREL(%rip) 26 ; PIC: callq bar@PLT 27 ; STATIC: callq bar{{$}} 28 ; X64: callq baz 29 30 %retval = alloca i32, align 4 31 store i32 0, i32* %retval, align 4 32 %call1 = call i32 @foo() 33 %call2 = call i32 @bar() 34 %call3 = call i32 @baz() 35 ret i32 0 36 } 37 38 declare i32 @foo() nonlazybind 39 declare i32 @bar() 40 declare hidden i32 @baz() nonlazybind 41 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32, i1) 42 declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i1) 43 44 !llvm.module.flags = !{!1} 45 !1 = !{i32 7, !"RtLibUseGOT", i32 1} 46