blob: b694b95e9d3a5794cf81c32636c3539a5154fb10 [file] [edit]
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=large -o %t
; RUN: llvm-readelf -S %t | FileCheck %s
; RUN: llc < %s -relocation-model=pic -filetype=obj -code-model=medium -large-data-threshold=0 -o %t2
; RUN: llvm-readelf -S %t2 | FileCheck %s --check-prefix=MED
; RUN: llc < %s -relocation-model=pic -code-model=medium -large-data-threshold=0 | FileCheck %s --check-prefix=ASM-MED
; RUN: llc < %s -relocation-model=pic -code-model=large | FileCheck %s --check-prefix=ASM-LARGE
; Verify that anonymous constant pool entries get SHF_X86_64_LARGE
; and are placed in .lrodata.cst* sections under the large code model,
; but stay in .rodata.cst* under the medium code model.
; CHECK: .lrodata.cst16 {{.*}} AMl
; CHECK: .lrodata.cst4 {{.*}} AMl
; CHECK: .lrodata {{.*}} Al
; MED: .rodata.cst16 {{.*}} AM
; MED: .rodata.cst4 {{.*}} AM
; MED: .rodata {{.*}} A {{.*}}
; ASM-MED: movaps .LCPI0_0(%rip),
; ASM-LARGE: movabsq $.LCPI0_0@GOTOFF,
; Also verify the suffixed path (via -partition-static-data-sections).
; The .hot suffix requires profile information (see !prof metadata below)
; so that the partitioner can distinguish hot from cold constant pool entries.
; RUN: llc < %s -relocation-model=pic -code-model=large \
; RUN: -partition-static-data-sections -o - | FileCheck %s --check-prefix=SUFFIX
; RUN: llc < %s -relocation-model=pic -code-model=medium -large-data-threshold=0 \
; RUN: -partition-static-data-sections -o - | FileCheck %s --check-prefix=SUFFIX-MED
; SUFFIX: .section .lrodata.cst16.hot.,"aMl",@progbits,16
; SUFFIX: .section .lrodata.cst4,"aMl",@progbits,4
; SUFFIX-MED: .section .rodata.cst16.hot.,"aM",@progbits,16
; SUFFIX-MED: .section .rodata.cst4,"aM",@progbits,4
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64--linux"
define void @vec_add(ptr %out, ptr %a, ptr %b, i32 %n) !prof !17 {
entry:
%cmp = icmp sgt i32 %n, 0
br i1 %cmp, label %loop, label %exit
loop:
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
%idx = sext i32 %iv to i64
%pa = getelementptr float, ptr %a, i64 %idx
%pb = getelementptr float, ptr %b, i64 %idx
%po = getelementptr float, ptr %out, i64 %idx
%va = load <4 x float>, ptr %pa, align 4
%vb = load <4 x float>, ptr %pb, align 4
%add = fadd <4 x float> %va, %vb
; Adding a vector splat of 1.0 forces a constant pool entry in .rodata.cst16
%ones = fadd <4 x float> %add, <float 1.0, float 1.0, float 1.0, float 1.0>
store <4 x float> %ones, ptr %po, align 4
%iv.next = add i32 %iv, 4
%done = icmp sge i32 %iv.next, %n
br i1 %done, label %exit, label %loop
exit:
ret void
}
; A scalar float constant forces a .rodata.cst4 entry.
define float @scalar_const(float %x) {
%r = fadd float %x, 1.0
ret float %r
}
; A 64-byte vector constant is not mergeable and goes to .lrodata.
define <16 x float> @wide() "target-features"="+avx512f" {
ret <16 x float> <float 1.0, float 2.0, float 3.0, float 4.0,
float 5.0, float 6.0, float 7.0, float 8.0,
float 9.0, float 10.0, float 11.0, float 12.0,
float 13.0, float 14.0, float 15.0, float 16.0>
}
!llvm.module.flags = !{!1}
!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 1460617}
!5 = !{!"MaxCount", i64 849536}
!6 = !{!"MaxInternalCount", i64 32769}
!7 = !{!"MaxFunctionCount", i64 849536}
!8 = !{!"NumCounts", i64 23784}
!9 = !{!"NumFunctions", i64 3301}
!10 = !{!"IsPartialProfile", i64 0}
!11 = !{!"PartialProfileRatio", double 0.000000e+00}
!12 = !{!"DetailedSummary", !13}
!13 = !{!14, !15}
!14 = !{i32 990000, i64 166, i32 73}
!15 = !{i32 999999, i64 1, i32 1463}
!16 = !{!"function_entry_count", i64 1}
!17 = !{!"function_entry_count", i64 100000}