91 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; Run with --no_x86_scrub_rip because we care a lot about how globals are3; accessed in the code model.4 5; Memset is interesting because it is an ExternalSymbol reference instead of a6; GlobalValue. Make sure we do the right GOT load for 64-bit large.7 8; RUN: llc < %s -relocation-model=pic -code-model=small | FileCheck %s --check-prefix=SMALL-PIC9; RUN: llc < %s -relocation-model=pic -code-model=medium | FileCheck %s --check-prefix=MEDIUM-PIC10; RUN: llc < %s -relocation-model=pic -code-model=large | FileCheck %s --check-prefix=LARGE-PIC11 12; Generated from this C source:13;14; int main() {15; unsigned int a[100] = {0};16; return 0;17; }18 19; ModuleID = 'model.c'20source_filename = "model.c"21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"22target triple = "x86_64--linux"23 24declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1) #125 26define i32 @main() #0 {27; SMALL-PIC-LABEL: main:28; SMALL-PIC: # %bb.0: # %entry29; SMALL-PIC-NEXT: subq $424, %rsp # imm = 0x1A830; SMALL-PIC-NEXT: .cfi_def_cfa_offset 43231; SMALL-PIC-NEXT: movl $0, {{[0-9]+}}(%rsp)32; SMALL-PIC-NEXT: leaq {{[0-9]+}}(%rsp), %rdi33; SMALL-PIC-NEXT: movl $400, %edx # imm = 0x19034; SMALL-PIC-NEXT: xorl %esi, %esi35; SMALL-PIC-NEXT: callq memset@PLT36; SMALL-PIC-NEXT: xorl %eax, %eax37; SMALL-PIC-NEXT: addq $424, %rsp # imm = 0x1A838; SMALL-PIC-NEXT: .cfi_def_cfa_offset 839; SMALL-PIC-NEXT: retq40;41; MEDIUM-PIC-LABEL: main:42; MEDIUM-PIC: # %bb.0: # %entry43; MEDIUM-PIC-NEXT: subq $424, %rsp # imm = 0x1A844; MEDIUM-PIC-NEXT: .cfi_def_cfa_offset 43245; MEDIUM-PIC-NEXT: movl $0, {{[0-9]+}}(%rsp)46; MEDIUM-PIC-NEXT: leaq {{[0-9]+}}(%rsp), %rdi47; MEDIUM-PIC-NEXT: movl $400, %edx # imm = 0x19048; MEDIUM-PIC-NEXT: xorl %esi, %esi49; MEDIUM-PIC-NEXT: callq memset@PLT50; MEDIUM-PIC-NEXT: xorl %eax, %eax51; MEDIUM-PIC-NEXT: addq $424, %rsp # imm = 0x1A852; MEDIUM-PIC-NEXT: .cfi_def_cfa_offset 853; MEDIUM-PIC-NEXT: retq54;55; LARGE-PIC-LABEL: main:56; LARGE-PIC: # %bb.0: # %entry57; LARGE-PIC-NEXT: subq $424, %rsp # imm = 0x1A858; LARGE-PIC-NEXT: .cfi_def_cfa_offset 43259; LARGE-PIC-NEXT: .L0$pb:60; LARGE-PIC-NEXT: leaq .L0$pb(%rip), %rax61; LARGE-PIC-NEXT: movabsq $_GLOBAL_OFFSET_TABLE_-.L0$pb, %rcx62; LARGE-PIC-NEXT: addq %rax, %rcx63; LARGE-PIC-NEXT: movl $0, {{[0-9]+}}(%rsp)64; LARGE-PIC-NEXT: leaq {{[0-9]+}}(%rsp), %rdi65; LARGE-PIC-NEXT: movabsq $memset@GOT, %rax66; LARGE-PIC-NEXT: movl $400, %edx # imm = 0x19067; LARGE-PIC-NEXT: xorl %esi, %esi68; LARGE-PIC-NEXT: callq *(%rcx,%rax)69; LARGE-PIC-NEXT: xorl %eax, %eax70; LARGE-PIC-NEXT: addq $424, %rsp # imm = 0x1A871; LARGE-PIC-NEXT: .cfi_def_cfa_offset 872; LARGE-PIC-NEXT: retq73entry:74 %retval = alloca i32, align 475 %a = alloca [100 x i32], align 1676 store i32 0, ptr %retval, align 477 call void @llvm.memset.p0.i64(ptr align 16 %a, i8 0, i64 400, i1 false)78 ret i32 079}80 81attributes #0 = { noinline nounwind uwtable }82attributes #0 = { argmemonly nounwind uwtable }83 84!llvm.module.flags = !{!0, !1, !2}85!llvm.ident = !{!3}86 87!0 = !{i32 1, !"wchar_size", i32 4}88!1 = !{i32 7, !"PIC Level", i32 2}89!2 = !{i32 7, !"PIE Level", i32 2}90!3 = !{!"clang version 7.0.0 "}91